[PATCH] D70083: [TargetLowering][DAGCombine][MSP430] Shift Amount Threshold in DAGCombine (4) (Baseline tests)

Joan LLuch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 07:18:29 PST 2019


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGabbbf9880c27: [TargetLowering][DAGCombine][MSP430] Shift Amount Threshold in DAGCombine (4)… (authored by joanlluch).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70083/new/

https://reviews.llvm.org/D70083

Files:
  llvm/test/CodeGen/MSP430/shift-amount-threshold.ll


Index: llvm/test/CodeGen/MSP430/shift-amount-threshold.ll
===================================================================
--- llvm/test/CodeGen/MSP430/shift-amount-threshold.ll
+++ llvm/test/CodeGen/MSP430/shift-amount-threshold.ll
@@ -147,3 +147,73 @@
   %cond = select i1 %cmp, i16 32, i16 0
   ret i16 %cond
 }
+
+; Check the following conversion in TargetLowering::SimplifySetCC
+; (X & 8) != 0  -->  (X & 8) >> 3
+define i16 @testSimplifySetCC_0_sh8(i16 %x) {
+; CHECK-LABEL: testSimplifySetCC_0_sh8:
+; CHECK:       ; %bb.0: ; %entry
+; CHECK-NEXT:    bit #256, r12
+; CHECK-NEXT:    mov r2, r12
+; CHECK-NEXT:    and #1, r12
+; CHECK-NEXT:    ret
+entry:
+  %and = and i16 %x, 256
+  %cmp = icmp ne i16 %and, 0
+  %conv = zext i1 %cmp to i16
+  ret i16 %conv
+}
+
+; Check the following conversion in TargetLowering::SimplifySetCC
+; (X & 8) == 8  -->  (X & 8) >> 3
+define i16 @testSimplifySetCC_1_sh8(i16 %x) {
+; CHECK-LABEL: testSimplifySetCC_1_sh8:
+; CHECK:       ; %bb.0: ; %entry
+; CHECK-NEXT:    bit #256, r12
+; CHECK-NEXT:    mov r2, r12
+; CHECK-NEXT:    and #1, r12
+; CHECK-NEXT:    ret
+entry:
+  %and = and i16 %x, 256
+  %cmp = icmp eq i16 %and, 256
+  %conv = zext i1 %cmp to i16
+  ret i16 %conv
+}
+
+; Check the following conversion in DAGCombiner::foldSelectCCToShiftAnd
+; select_cc setlt X, 0, A, 0 -> "and (srl X, C2), A" iff A is a single-bit
+define i16 @testShiftAnd_1_sh8(i16 %x) {
+; CHECK-LABEL: testShiftAnd_1_sh8:
+; CHECK:       ; %bb.0: ; %entry
+; CHECK-NEXT:    mov r12, r13
+; CHECK-NEXT:    mov #128, r12
+; CHECK-NEXT:    tst r13
+; CHECK-NEXT:    jl .LBB10_2
+; CHECK-NEXT:  ; %bb.1: ; %entry
+; CHECK-NEXT:    clr r12
+; CHECK-NEXT:  .LBB10_2: ; %entry
+; CHECK-NEXT:    ret
+entry:
+  %cmp = icmp slt i16 %x, 0
+  %cond = select i1 %cmp, i16 128, i16 0
+  ret i16 %cond
+}
+
+; Check the following conversion in DAGCombiner::foldSelectCCToShiftAnd
+; select_cc setlt X, 0, A, 0 -> "and (srl X, C2), A" iff A is a single-bit
+define i16 @testShiftAnd_1_sh9(i16 %x) {
+; CHECK-LABEL: testShiftAnd_1_sh9:
+; CHECK:       ; %bb.0: ; %entry
+; CHECK-NEXT:    mov r12, r13
+; CHECK-NEXT:    mov #64, r12
+; CHECK-NEXT:    tst r13
+; CHECK-NEXT:    jl .LBB11_2
+; CHECK-NEXT:  ; %bb.1: ; %entry
+; CHECK-NEXT:    clr r12
+; CHECK-NEXT:  .LBB11_2: ; %entry
+; CHECK-NEXT:    ret
+entry:
+  %cmp = icmp slt i16 %x, 0
+  %cond = select i1 %cmp, i16 64, i16 0
+  ret i16 %cond
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70083.228692.patch
Type: text/x-patch
Size: 2424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191111/c1c8612a/attachment-0001.bin>


More information about the llvm-commits mailing list