diff options
| author | Arnaud A. de Grandmaison <arnaud.degrandmaison@arm.com> | 2018-10-13 07:43:56 +0000 |
|---|---|---|
| committer | Arnaud A. de Grandmaison <arnaud.degrandmaison@arm.com> | 2018-10-13 07:43:56 +0000 |
| commit | 162435e7b5e026b9f988c730bb6527683f6aa853 (patch) | |
| tree | bc3754e96afec1728ef847b66dac53cd8254e8b7 /llvm/test/CodeGen/AArch64/sat-add.ll | |
| parent | 3afc346dd093fad4a5a24e35204040d0be5a5b17 (diff) | |
| download | bcm5719-llvm-162435e7b5e026b9f988c730bb6527683f6aa853.tar.gz bcm5719-llvm-162435e7b5e026b9f988c730bb6527683f6aa853.zip | |
[AArch64] Swap comparison operands if that enables some folding.
Summary:
AArch64 can fold some shift+extend operations on the RHS operand of
comparisons, so swap the operands if that makes sense.
This provides a fix for https://bugs.llvm.org/show_bug.cgi?id=38751
Reviewers: efriedma, t.p.northover, javed.absar
Subscribers: mcrosier, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D53067
llvm-svn: 344439
Diffstat (limited to 'llvm/test/CodeGen/AArch64/sat-add.ll')
| -rw-r--r-- | llvm/test/CodeGen/AArch64/sat-add.ll | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/test/CodeGen/AArch64/sat-add.ll b/llvm/test/CodeGen/AArch64/sat-add.ll index d9082859988..4d865a2b14b 100644 --- a/llvm/test/CodeGen/AArch64/sat-add.ll +++ b/llvm/test/CodeGen/AArch64/sat-add.ll @@ -52,11 +52,10 @@ define i8 @unsigned_sat_constant_i8_using_cmp_notval(i8 %x) { define i16 @unsigned_sat_constant_i16_using_min(i16 %x) { ; CHECK-LABEL: unsigned_sat_constant_i16_using_min: ; CHECK: // %bb.0: -; CHECK-NEXT: and w8, w0, #0xffff -; CHECK-NEXT: mov w9, #65493 -; CHECK-NEXT: cmp w8, w9 +; CHECK-NEXT: mov w8, #65493 +; CHECK-NEXT: cmp w8, w0, uxth ; CHECK-NEXT: mov w8, #-43 -; CHECK-NEXT: csel w8, w0, w8, lo +; CHECK-NEXT: csel w8, w0, w8, hi ; CHECK-NEXT: add w0, w8, #42 // =42 ; CHECK-NEXT: ret %c = icmp ult i16 %x, -43 @@ -82,11 +81,10 @@ define i16 @unsigned_sat_constant_i16_using_cmp_sum(i16 %x) { define i16 @unsigned_sat_constant_i16_using_cmp_notval(i16 %x) { ; CHECK-LABEL: unsigned_sat_constant_i16_using_cmp_notval: ; CHECK: // %bb.0: -; CHECK-NEXT: and w8, w0, #0xffff -; CHECK-NEXT: mov w10, #65493 -; CHECK-NEXT: add w9, w0, #42 // =42 -; CHECK-NEXT: cmp w8, w10 -; CHECK-NEXT: csinv w0, w9, wzr, ls +; CHECK-NEXT: mov w9, #65493 +; CHECK-NEXT: add w8, w0, #42 // =42 +; CHECK-NEXT: cmp w9, w0, uxth +; CHECK-NEXT: csinv w0, w8, wzr, hs ; CHECK-NEXT: ret %a = add i16 %x, 42 %c = icmp ugt i16 %x, -43 |

