diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2017-05-24 22:36:14 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2017-05-24 22:36:14 +0000 |
| commit | a8ac360a0c5796ec5560b3d4abaf511b1177c14d (patch) | |
| tree | 3f81f43bbf095b05ca3a23b54dd33b7c77ef1331 /llvm/test/Transforms/InstCombine | |
| parent | 0e8521c05ab2ec291bf53a1c56c32128df11014c (diff) | |
| download | bcm5719-llvm-a8ac360a0c5796ec5560b3d4abaf511b1177c14d.tar.gz bcm5719-llvm-a8ac360a0c5796ec5560b3d4abaf511b1177c14d.zip | |
[InstCombine] add tests for icmp eq (mul X, C), (mul Y, C); NFC
llvm-svn: 303816
Diffstat (limited to 'llvm/test/Transforms/InstCombine')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/icmp.ll | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index 64242cffb03..9a952bad1da 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -2918,3 +2918,46 @@ define i1 @eq_mul_constants(i32 %x, i32 %y) { ret i1 %C } +define <2 x i1> @eq_mul_constants_splat(<2 x i32> %x, <2 x i32> %y) { +; CHECK-LABEL: @eq_mul_constants_splat( +; CHECK-NEXT: [[A:%.*]] = mul <2 x i32> %x, <i32 5, i32 5> +; CHECK-NEXT: [[B:%.*]] = mul <2 x i32> %y, <i32 5, i32 5> +; CHECK-NEXT: [[C:%.*]] = icmp ne <2 x i32> [[A]], [[B]] +; CHECK-NEXT: ret <2 x i1> [[C]] +; + %A = mul <2 x i32> %x, <i32 5, i32 5> + %B = mul <2 x i32> %y, <i32 5, i32 5> + %C = icmp ne <2 x i32> %A, %B + ret <2 x i1> %C +} + +; If the multiply constant has any trailing zero bits, we get something completely different. +; We mask off the high bits of each input and then convert: +; (X&Z) == (Y&Z) -> (X^Y) & Z == 0 + +define i1 @eq_mul_constants_with_tz(i32 %x, i32 %y) { +; CHECK-LABEL: @eq_mul_constants_with_tz( +; CHECK-NEXT: [[TMP1:%.*]] = xor i32 %x, %y +; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], 1073741823 +; CHECK-NEXT: [[C:%.*]] = icmp ne i32 [[TMP2]], 0 +; CHECK-NEXT: ret i1 [[C]] +; + %A = mul i32 %x, 12 + %B = mul i32 %y, 12 + %C = icmp ne i32 %A, %B + ret i1 %C +} + +define <2 x i1> @eq_mul_constants_with_tz_splat(<2 x i32> %x, <2 x i32> %y) { +; CHECK-LABEL: @eq_mul_constants_with_tz_splat( +; CHECK-NEXT: [[A:%.*]] = mul <2 x i32> %x, <i32 12, i32 12> +; CHECK-NEXT: [[B:%.*]] = mul <2 x i32> %y, <i32 12, i32 12> +; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> [[A]], [[B]] +; CHECK-NEXT: ret <2 x i1> [[C]] +; + %A = mul <2 x i32> %x, <i32 12, i32 12> + %B = mul <2 x i32> %y, <i32 12, i32 12> + %C = icmp eq <2 x i32> %A, %B + ret <2 x i1> %C +} + |

