[llvm] r347447 - [ARM GlobalISel] Add test for BFC. NFCI

Diana Picus via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 22 01:54:14 PST 2018


Author: rovka
Date: Thu Nov 22 01:54:14 2018
New Revision: 347447

URL: http://llvm.org/viewvc/llvm-project?rev=347447&view=rev
Log:
[ARM GlobalISel] Add test for BFC. NFCI

r334871 has made it possible for TableGen'erated code to select BFC, but
it has not added a test for it on the ARM side. Add it now to make sure
we don't introduce regressions if we ever change anything about that
rule.

Modified:
    llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-instruction-select-combos.mir

Modified: llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-instruction-select-combos.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-instruction-select-combos.mir?rev=347447&r1=347446&r2=347447&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-instruction-select-combos.mir (original)
+++ llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-instruction-select-combos.mir Thu Nov 22 01:54:14 2018
@@ -42,6 +42,9 @@
 
   define void @test_vfnmss() #4 { ret void }
 
+  define void @test_bfc() #2 { ret void }
+  define void @test_no_bfc_bad_mask() #2 { ret void }
+
   attributes #0 = { "target-features"="+v6" }
   attributes #1 = { "target-features"="-v6" }
   attributes #2 = { "target-features"="+v6t2" }
@@ -1142,3 +1145,57 @@ body:             |
     BX_RET 14, $noreg, implicit $s0
     ; CHECK: BX_RET 14, $noreg, implicit $s0
 ...
+---
+name:            test_bfc
+# CHECK-LABEL: name: test_bfc
+legalized:       true
+regBankSelected: true
+selected:        false
+# CHECK: selected: true
+registers:
+  - { id: 0, class: gprb }
+  - { id: 1, class: gprb }
+  - { id: 2, class: gprb }
+body:             |
+  bb.0:
+    liveins: $r0
+
+    %0(s32) = COPY $r0
+    %1(s32) = G_CONSTANT i32 -65529 ; 0xFFFF0007
+    %2(s32) = G_AND %0, %1
+    ; CHECK: [[RS:%[0-9]+]]:gpr = COPY $r0
+    ; CHECK: [[RD:%[0-9]+]]:gpr = BFC [[RS]], -65529, 14, $noreg
+
+    $r0 = COPY %2(s32)
+    ; CHECK: $r0 = COPY [[RD]]
+
+    BX_RET 14, $noreg, implicit $r0
+    ; CHECK: BX_RET 14, $noreg, implicit $r0
+...
+---
+name:            test_no_bfc_bad_mask
+# CHECK-LABEL: name: test_no_bfc_bad_mask
+legalized:       true
+regBankSelected: true
+selected:        false
+# CHECK: selected: true
+registers:
+  - { id: 0, class: gprb }
+  - { id: 1, class: gprb }
+  - { id: 2, class: gprb }
+body:             |
+  bb.0:
+    liveins: $r0
+
+    %0(s32) = COPY $r0
+    %1(s32) = G_CONSTANT i32 6 ; 0x00000006
+    %2(s32) = G_AND %0, %1
+    ; CHECK: [[RS:%[0-9]+]]:gpr = COPY $r0
+    ; CHECK-NOT: BFC
+
+    $r0 = COPY %2(s32)
+    ; CHECK: $r0 = COPY [[RD]]
+
+    BX_RET 14, $noreg, implicit $r0
+    ; CHECK: BX_RET 14, $noreg, implicit $r0
+...




More information about the llvm-commits mailing list