; CHECK-NEXT: [[AND:%.*]] = zext <2 x i1> [[TMP1]] to <2 x i8>
; CHECK-NEXT: ret <2 x i8> [[AND]]
;
%sh=lshr<2xi8><i81,i81>,%x
%and=and<2xi8>%sh,<i81,i81>
ret<2xi8>%and
}
; The add in this test is unnecessary because the LSBs of the LHS are 0 and the 'and' only consumes bits from those LSBs. It doesn't matter what happens to the upper bits.
definei32@test11(i32%a,i32%b){
; CHECK-LABEL: @test11(
; CHECK-NEXT: [[X:%.*]] = shl i32 [[A:%.*]], 8
; CHECK-NEXT: [[Z:%.*]] = and i32 [[B:%.*]], 128
; CHECK-NEXT: [[W:%.*]] = mul i32 [[Z]], [[X]]
; CHECK-NEXT: ret i32 [[W]]
;
%x=shli32%a,8
%y=addi32%x,%b
%z=andi32%y,128
%w=muli32%z,%x; to keep the shift from being removed
reti32%w
}
; The add in this test is unnecessary because the LSBs of the RHS are 0 and the 'and' only consumes bits from those LSBs. It doesn't matter what happens to the upper bits.
definei32@test12(i32%a,i32%b){
; CHECK-LABEL: @test12(
; CHECK-NEXT: [[X:%.*]] = shl i32 [[A:%.*]], 8
; CHECK-NEXT: [[Z:%.*]] = and i32 [[B:%.*]], 128
; CHECK-NEXT: [[W:%.*]] = mul i32 [[Z]], [[X]]
; CHECK-NEXT: ret i32 [[W]]
;
%x=shli32%a,8
%y=addi32%b,%x
%z=andi32%y,128
%w=muli32%z,%x; to keep the shift from being removed
reti32%w
}
; The sub in this test is unnecessary because the LSBs of the RHS are 0 and the 'and' only consumes bits from those LSBs. It doesn't matter what happens to the upper bits.
definei32@test13(i32%a,i32%b){
; CHECK-LABEL: @test13(
; CHECK-NEXT: [[X:%.*]] = shl i32 [[A:%.*]], 8
; CHECK-NEXT: [[Z:%.*]] = and i32 [[B:%.*]], 128
; CHECK-NEXT: [[W:%.*]] = mul i32 [[Z]], [[X]]
; CHECK-NEXT: ret i32 [[W]]
;
%x=shli32%a,8
%y=subi32%b,%x
%z=andi32%y,128
%w=muli32%z,%x; to keep the shift from being removed
reti32%w
}
; The sub in this test cannot be removed because we need to keep the negation of %b. TODO: But we should be able to replace the LHS of it with a 0.
definei32@test14(i32%a,i32%b){
; CHECK-LABEL: @test14(
; CHECK-NEXT: [[X:%.*]] = shl i32 [[A:%.*]], 8
; CHECK-NEXT: [[Y:%.*]] = sub i32 0, [[B:%.*]]
; CHECK-NEXT: [[Z:%.*]] = and i32 [[Y]], 128
; CHECK-NEXT: [[W:%.*]] = mul i32 [[Z]], [[X]]
; CHECK-NEXT: ret i32 [[W]]
;
%x=shli32%a,8
%y=subi32%x,%b
%z=andi32%y,128
%w=muli32%z,%x; to keep the shift from being removed