diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-06-02 15:35:45 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-06-02 15:35:45 +0000 |
commit | 630a524e8d320dd3af8e7dadcf7b08bb9311f111 (patch) | |
tree | ccf032e113071bb3a1516f2ef4374c01f9df0766 /llvm/test | |
parent | 3f70b619a9830925f7edbfe51f07a7b45d8a44b9 (diff) | |
download | bcm5719-llvm-630a524e8d320dd3af8e7dadcf7b08bb9311f111.tar.gz bcm5719-llvm-630a524e8d320dd3af8e7dadcf7b08bb9311f111.zip |
[InstCombine] fix/add tests for icmp with not ops; NFC
The existing test was not minimal, and there was no coverage
for the variants with a constant or vector types.
llvm-svn: 304555
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/Transforms/InstCombine/not.ll | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/llvm/test/Transforms/InstCombine/not.ll b/llvm/test/Transforms/InstCombine/not.ll index 6ff0a50318d..b52919071d2 100644 --- a/llvm/test/Transforms/InstCombine/not.ll +++ b/llvm/test/Transforms/InstCombine/not.ll @@ -33,17 +33,47 @@ define i1 @invert_fcmp(float %X, float %Y) { ; PR2298 -define zeroext i8 @test6(i32 %a, i32 %b) { -; CHECK-LABEL: @test6( -; CHECK-NEXT: [[TMP3:%.*]] = icmp slt i32 %b, %a -; CHECK-NEXT: [[RETVAL67:%.*]] = zext i1 [[TMP3]] to i8 -; CHECK-NEXT: ret i8 [[RETVAL67]] +define i1 @not_not_cmp(i32 %a, i32 %b) { +; CHECK-LABEL: @not_not_cmp( +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 %b, %a +; CHECK-NEXT: ret i1 [[CMP]] +; + %nota = xor i32 %a, -1 + %notb = xor i32 %b, -1 + %cmp = icmp slt i32 %nota, %notb + ret i1 %cmp +} + +define <2 x i1> @not_not_cmp_vector(<2 x i32> %a, <2 x i32> %b) { +; CHECK-LABEL: @not_not_cmp_vector( +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i32> %b, %a +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %nota = xor <2 x i32> %a, <i32 -1, i32 -1> + %notb = xor <2 x i32> %b, <i32 -1, i32 -1> + %cmp = icmp ugt <2 x i32> %nota, %notb + ret <2 x i1> %cmp +} + +define i1 @not_cmp_constant(i32 %a) { +; CHECK-LABEL: @not_cmp_constant( +; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 %a, -43 +; CHECK-NEXT: ret i1 [[CMP]] +; + %nota = xor i32 %a, -1 + %cmp = icmp ugt i32 %nota, 42 + ret i1 %cmp +} + +define <2 x i1> @not_cmp_constant_vector(<2 x i32> %a) { +; CHECK-LABEL: @not_cmp_constant_vector( +; CHECK-NEXT: [[NOTA:%.*]] = xor <2 x i32> %a, <i32 -1, i32 -1> +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <2 x i32> [[NOTA]], <i32 42, i32 42> +; CHECK-NEXT: ret <2 x i1> [[CMP]] ; - %tmp1not = xor i32 %a, -1 - %tmp2not = xor i32 %b, -1 - %tmp3 = icmp slt i32 %tmp1not, %tmp2not - %retval67 = zext i1 %tmp3 to i8 - ret i8 %retval67 + %nota = xor <2 x i32> %a, <i32 -1, i32 -1> + %cmp = icmp slt <2 x i32> %nota, <i32 42, i32 42> + ret <2 x i1> %cmp } define <2 x i1> @test7(<2 x i32> %A, <2 x i32> %B) { |