diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2017-03-31 20:28:06 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2017-03-31 20:28:06 +0000 |
| commit | 34da36e74f1f5ab5874f825074f04ecde2be50f4 (patch) | |
| tree | 8c4751ea510ea14259cb7de6efa6269a08d606b1 /llvm/test/CodeGen/PowerPC | |
| parent | 4c08fe284125d6505008239c39b3847d5818ff40 (diff) | |
| download | bcm5719-llvm-34da36e74f1f5ab5874f825074f04ecde2be50f4.tar.gz bcm5719-llvm-34da36e74f1f5ab5874f825074f04ecde2be50f4.zip | |
[DAGCombiner] add fold for 'All sign bits set?'
(and (setlt X, 0), (setlt Y, 0)) --> (setlt (and X, Y), 0)
We have 7 similar folds, but this one got away. The fact that the
x86 test with a branch didn't change is probably a separate bug. We
may also be missing this and the related folds in instcombine.
llvm-svn: 299252
Diffstat (limited to 'llvm/test/CodeGen/PowerPC')
| -rw-r--r-- | llvm/test/CodeGen/PowerPC/setcc-logic.ll | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/test/CodeGen/PowerPC/setcc-logic.ll b/llvm/test/CodeGen/PowerPC/setcc-logic.ll index f7f2caa190a..38db2a8bcef 100644 --- a/llvm/test/CodeGen/PowerPC/setcc-logic.ll +++ b/llvm/test/CodeGen/PowerPC/setcc-logic.ll @@ -45,11 +45,8 @@ define zeroext i1 @all_bits_set(i32 %P, i32 %Q) { define zeroext i1 @all_sign_bits_set(i32 %P, i32 %Q) { ; CHECK-LABEL: all_sign_bits_set: ; CHECK: # BB#0: -; CHECK-NEXT: cmpwi 0, 3, 0 -; CHECK-NEXT: cmpwi 1, 4, 0 -; CHECK-NEXT: li 3, 1 -; CHECK-NEXT: crnand 20, 0, 4 -; CHECK-NEXT: isel 3, 0, 3, 20 +; CHECK-NEXT: and 3, 3, 4 +; CHECK-NEXT: srwi 3, 3, 31 ; CHECK-NEXT: blr %a = icmp slt i32 %P, 0 %b = icmp slt i32 %Q, 0 @@ -188,10 +185,9 @@ return: define i32 @all_sign_bits_set_branch(i32 %P, i32 %Q) { ; CHECK-LABEL: all_sign_bits_set_branch: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: cmpwi 0, 3, 0 -; CHECK-NEXT: cmpwi 1, 4, 0 -; CHECK-NEXT: crand 20, 0, 4 -; CHECK-NEXT: bc 4, 20, .LBB11_2 +; CHECK-NEXT: and 3, 3, 4 +; CHECK-NEXT: cmpwi 0, 3, -1 +; CHECK-NEXT: bgt 0, .LBB11_2 ; CHECK-NEXT: # BB#1: # %bb1 ; CHECK-NEXT: li 3, 4 ; CHECK-NEXT: blr |

