forked from OSchip/llvm-project
[CVP] Add tests for mask comparisons (NFC)
This commit is contained in:
parent
f94bbe19b6
commit
91af6a78d0
|
@ -989,4 +989,136 @@ if.false:
|
|||
ret void
|
||||
}
|
||||
|
||||
define void @test_icmp_mask_two_values(i32 %a) {
|
||||
; CHECK-LABEL: @test_icmp_mask_two_values(
|
||||
; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], -2
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 10
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
|
||||
; CHECK: if.true:
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i32 [[A]], 10
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP2]])
|
||||
; CHECK-NEXT: [[CMP3:%.*]] = icmp ule i32 [[A]], 11
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP3]])
|
||||
; CHECK-NEXT: [[CMP4:%.*]] = icmp ult i32 [[A]], 10
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP4]])
|
||||
; CHECK-NEXT: [[CMP5:%.*]] = icmp ugt i32 [[A]], 11
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP5]])
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK: if.false:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%and = and i32 %a, -2
|
||||
%cmp = icmp eq i32 %and, 10
|
||||
br i1 %cmp, label %if.true, label %if.false
|
||||
|
||||
if.true:
|
||||
%cmp2 = icmp uge i32 %a, 10
|
||||
call void @check1(i1 %cmp2)
|
||||
%cmp3 = icmp ule i32 %a, 11
|
||||
call void @check1(i1 %cmp3)
|
||||
%cmp4 = icmp ult i32 %a, 10
|
||||
call void @check1(i1 %cmp4)
|
||||
%cmp5 = icmp ugt i32 %a, 11
|
||||
call void @check1(i1 %cmp5)
|
||||
ret void
|
||||
|
||||
if.false:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @test_icmp_mask_bit_set(i32 %a) {
|
||||
; CHECK-LABEL: @test_icmp_mask_bit_set(
|
||||
; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], 32
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 32
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
|
||||
; CHECK: if.true:
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i32 [[A]], 32
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP2]])
|
||||
; CHECK-NEXT: [[CMP3:%.*]] = icmp uge i32 [[A]], 33
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP3]])
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK: if.false:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%and = and i32 %a, 32
|
||||
%cmp = icmp eq i32 %and, 32
|
||||
br i1 %cmp, label %if.true, label %if.false
|
||||
|
||||
if.true:
|
||||
%cmp2 = icmp uge i32 %a, 32
|
||||
call void @check1(i1 %cmp2)
|
||||
%cmp3 = icmp uge i32 %a, 33
|
||||
call void @check1(i1 %cmp3)
|
||||
ret void
|
||||
|
||||
if.false:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @test_icmp_mask_bit_unset(i32 %a) {
|
||||
; CHECK-LABEL: @test_icmp_mask_bit_unset(
|
||||
; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], 32
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
|
||||
; CHECK: if.true:
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i32 [[A]], -33
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP2]])
|
||||
; CHECK-NEXT: [[CMP3:%.*]] = icmp ule i32 [[A]], -34
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP3]])
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK: if.false:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%and = and i32 %a, 32
|
||||
%cmp = icmp eq i32 %and, 0
|
||||
br i1 %cmp, label %if.true, label %if.false
|
||||
|
||||
if.true:
|
||||
%cmp2 = icmp ule i32 %a, -33
|
||||
call void @check1(i1 %cmp2)
|
||||
%cmp3 = icmp ule i32 %a, -34
|
||||
call void @check1(i1 %cmp3)
|
||||
ret void
|
||||
|
||||
if.false:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @test_icmp_mask_wrong_predicate(i32 %a) {
|
||||
; CHECK-LABEL: @test_icmp_mask_wrong_predicate(
|
||||
; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], -2
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[AND]], 10
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
|
||||
; CHECK: if.true:
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i32 [[A]], 10
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP2]])
|
||||
; CHECK-NEXT: [[CMP3:%.*]] = icmp ule i32 [[A]], 11
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP3]])
|
||||
; CHECK-NEXT: [[CMP4:%.*]] = icmp ult i32 [[A]], 10
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP4]])
|
||||
; CHECK-NEXT: [[CMP5:%.*]] = icmp ugt i32 [[A]], 11
|
||||
; CHECK-NEXT: call void @check1(i1 [[CMP5]])
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK: if.false:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%and = and i32 %a, -2
|
||||
%cmp = icmp ne i32 %and, 10
|
||||
br i1 %cmp, label %if.true, label %if.false
|
||||
|
||||
if.true:
|
||||
%cmp2 = icmp uge i32 %a, 10
|
||||
call void @check1(i1 %cmp2)
|
||||
%cmp3 = icmp ule i32 %a, 11
|
||||
call void @check1(i1 %cmp3)
|
||||
%cmp4 = icmp ult i32 %a, 10
|
||||
call void @check1(i1 %cmp4)
|
||||
%cmp5 = icmp ugt i32 %a, 11
|
||||
call void @check1(i1 %cmp5)
|
||||
ret void
|
||||
|
||||
if.false:
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #4 = { noreturn }
|
||||
|
|
Loading…
Reference in New Issue