diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2019-01-30 22:41:35 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2019-01-30 22:41:35 +0000 |
| commit | 9ab23101a82440c91d630596e0e8264103a34f74 (patch) | |
| tree | 93b9b6ebf9b3a7dd227909a2876f220d6799f768 /llvm/test/CodeGen | |
| parent | c6d261efdb184cddf4380d8c450d09936afdecf4 (diff) | |
| download | bcm5719-llvm-9ab23101a82440c91d630596e0e8264103a34f74.tar.gz bcm5719-llvm-9ab23101a82440c91d630596e0e8264103a34f74.zip | |
[DAGCombiner] sub X, 0/1 --> add X, 0/-1
This extends the existing transform for:
add X, 0/1 --> sub X, 0/-1
...to allow the sibling subtraction fold.
This pattern could regress with the proposed change in D57401.
llvm-svn: 352680
Diffstat (limited to 'llvm/test/CodeGen')
| -rw-r--r-- | llvm/test/CodeGen/AArch64/bool-ext-inc.ll | 7 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/bool-ext-inc.ll | 9 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/select_const.ll | 5 |
3 files changed, 8 insertions, 13 deletions
diff --git a/llvm/test/CodeGen/AArch64/bool-ext-inc.ll b/llvm/test/CodeGen/AArch64/bool-ext-inc.ll index 2b702f9644a..8f45e979241 100644 --- a/llvm/test/CodeGen/AArch64/bool-ext-inc.ll +++ b/llvm/test/CodeGen/AArch64/bool-ext-inc.ll @@ -17,9 +17,7 @@ define <4 x i32> @zextbool_sub_vector(<4 x i32> %c1, <4 x i32> %c2, <4 x i32> %x ; CHECK-LABEL: zextbool_sub_vector: ; CHECK: // %bb.0: ; CHECK-NEXT: cmeq v0.4s, v0.4s, v1.4s -; CHECK-NEXT: movi v1.4s, #1 -; CHECK-NEXT: and v0.16b, v0.16b, v1.16b -; CHECK-NEXT: sub v0.4s, v2.4s, v0.4s +; CHECK-NEXT: add v0.4s, v2.4s, v0.4s ; CHECK-NEXT: ret %c = icmp eq <4 x i32> %c1, %c2 %b = zext <4 x i1> %c to <4 x i32> @@ -30,8 +28,7 @@ define <4 x i32> @zextbool_sub_vector(<4 x i32> %c1, <4 x i32> %c2, <4 x i32> %x define i32 @assertsext_sub_1(i1 signext %cond, i32 %y) { ; CHECK-LABEL: assertsext_sub_1: ; CHECK: // %bb.0: -; CHECK-NEXT: and w8, w0, #0x1 -; CHECK-NEXT: sub w0, w1, w8 +; CHECK-NEXT: add w0, w1, w0 ; CHECK-NEXT: ret %e = zext i1 %cond to i32 %r = sub i32 %y, %e diff --git a/llvm/test/CodeGen/X86/bool-ext-inc.ll b/llvm/test/CodeGen/X86/bool-ext-inc.ll index cfd6dc8c62c..d89893f94bd 100644 --- a/llvm/test/CodeGen/X86/bool-ext-inc.ll +++ b/llvm/test/CodeGen/X86/bool-ext-inc.ll @@ -118,8 +118,7 @@ define <4 x i32> @zextbool_sub_vector(<4 x i32> %cmp1, <4 x i32> %cmp2, <4 x i32 ; CHECK-LABEL: zextbool_sub_vector: ; CHECK: # %bb.0: ; CHECK-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0 -; CHECK-NEXT: vpsrld $31, %xmm0, %xmm0 -; CHECK-NEXT: vpsubd %xmm0, %xmm2, %xmm0 +; CHECK-NEXT: vpaddd %xmm0, %xmm2, %xmm0 ; CHECK-NEXT: retq %c = icmp eq <4 x i32> %cmp1, %cmp2 %b = zext <4 x i1> %c to <4 x i32> @@ -130,9 +129,9 @@ define <4 x i32> @zextbool_sub_vector(<4 x i32> %cmp1, <4 x i32> %cmp2, <4 x i32 define i32 @assertsext_sub_1(i1 signext %cond, i32 %y) { ; CHECK-LABEL: assertsext_sub_1: ; CHECK: # %bb.0: -; CHECK-NEXT: movl %esi, %eax -; CHECK-NEXT: andl $1, %edi -; CHECK-NEXT: subl %edi, %eax +; CHECK-NEXT: # kill: def $esi killed $esi def $rsi +; CHECK-NEXT: # kill: def $edi killed $edi def $rdi +; CHECK-NEXT: leal (%rdi,%rsi), %eax ; CHECK-NEXT: retq %e = zext i1 %cond to i32 %r = sub i32 %y, %e diff --git a/llvm/test/CodeGen/X86/select_const.ll b/llvm/test/CodeGen/X86/select_const.ll index 0f252c8261f..8ab603d396f 100644 --- a/llvm/test/CodeGen/X86/select_const.ll +++ b/llvm/test/CodeGen/X86/select_const.ll @@ -193,9 +193,8 @@ define i32 @select_C_Cplus1_zeroext(i1 zeroext %cond) { define i32 @select_C_Cplus1_signext(i1 signext %cond) { ; CHECK-LABEL: select_C_Cplus1_signext: ; CHECK: # %bb.0: -; CHECK-NEXT: andl $1, %edi -; CHECK-NEXT: movl $42, %eax -; CHECK-NEXT: subl %edi, %eax +; CHECK-NEXT: # kill: def $edi killed $edi def $rdi +; CHECK-NEXT: leal 42(%rdi), %eax ; CHECK-NEXT: retq %sel = select i1 %cond, i32 41, i32 42 ret i32 %sel |

