summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2018-01-12 12:44:36 +0000
committerDiana Picus <diana.picus@linaro.org>2018-01-12 12:44:36 +0000
commitcf044647c4850e35129c7875a09ef6d2f97269bf (patch)
tree69bc6fa41aa6b27e8d9d3ec6fcb08d485df8c6f1 /llvm
parent2dc54056932c2469c198a73d5fc4471a7774c31e (diff)
downloadbcm5719-llvm-cf044647c4850e35129c7875a09ef6d2f97269bf.tar.gz
bcm5719-llvm-cf044647c4850e35129c7875a09ef6d2f97269bf.zip
[ARM GlobalISel] Add inst selector tests for G_FMA
We don't yet match all the patterns involving G_FMA. Add tests for some of the ones that we do match. llvm-svn: 322368
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select-combos.mir181
-rw-r--r--llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select.mir72
2 files changed, 253 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select-combos.mir b/llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select-combos.mir
index f328a938356..3227febb7ea 100644
--- a/llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select-combos.mir
+++ b/llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select-combos.mir
@@ -34,10 +34,19 @@
define void @test_vnmuls_reassociate() #3 { ret void }
define void @test_vnmuld() #3 { ret void }
+ define void @test_vfnmas() #4 { ret void }
+ define void @test_vfnmad() #4 { ret void }
+
+ define void @test_vfmss() #4 { ret void }
+ define void @test_vfmsd() #4 { ret void }
+
+ define void @test_vfnmss() #4 { ret void }
+
attributes #0 = { "target-features"="+v6" }
attributes #1 = { "target-features"="-v6" }
attributes #2 = { "target-features"="+v6t2" }
attributes #3 = { "target-features"="+vfp2" }
+ attributes #4 = { "target-features"="+vfp4" }
...
---
name: test_mla
@@ -961,3 +970,175 @@ body: |
BX_RET 14, %noreg, implicit %d0
; CHECK: BX_RET 14, %noreg, implicit %d0
...
+---
+name: test_vfnmas
+# CHECK-LABEL: name: test_vfnmas
+legalized: true
+regBankSelected: true
+selected: false
+# CHECK: selected: true
+registers:
+ - { id: 0, class: fprb }
+ - { id: 1, class: fprb }
+ - { id: 2, class: fprb }
+ - { id: 3, class: fprb }
+ - { id: 4, class: fprb }
+body: |
+ bb.0:
+ liveins: %s0, %s1, %s2
+
+ %0(s32) = COPY %s0
+ %1(s32) = COPY %s1
+ %2(s32) = COPY %s2
+ ; CHECK-DAG: [[VREGX:%[0-9]+]]:spr = COPY %s0
+ ; CHECK-DAG: [[VREGY:%[0-9]+]]:spr = COPY %s1
+ ; CHECK-DAG: [[VREGZ:%[0-9]+]]:spr = COPY %s2
+
+ %3(s32) = G_FMA %0, %1, %2
+ %4(s32) = G_FNEG %3
+ ; CHECK: [[VREGR:%[0-9]+]]:spr = VFNMAS [[VREGZ]], [[VREGX]], [[VREGY]], 14, %noreg
+
+ %s0 = COPY %4(s32)
+ ; CHECK: %s0 = COPY [[VREGR]]
+
+ BX_RET 14, %noreg, implicit %s0
+ ; CHECK: BX_RET 14, %noreg, implicit %s0
+...
+---
+name: test_vfnmad
+# CHECK-LABEL: name: test_vfnmad
+legalized: true
+regBankSelected: true
+selected: false
+# CHECK: selected: true
+registers:
+ - { id: 0, class: fprb }
+ - { id: 1, class: fprb }
+ - { id: 2, class: fprb }
+ - { id: 3, class: fprb }
+ - { id: 4, class: fprb }
+ - { id: 5, class: fprb }
+body: |
+ bb.0:
+ liveins: %d0, %d1, %d2
+
+ %0(s64) = COPY %d0
+ %1(s64) = COPY %d1
+ %2(s64) = COPY %d2
+ ; CHECK-DAG: [[VREGX:%[0-9]+]]:dpr = COPY %d0
+ ; CHECK-DAG: [[VREGY:%[0-9]+]]:dpr = COPY %d1
+ ; CHECK-DAG: [[VREGZ:%[0-9]+]]:dpr = COPY %d2
+
+ %3(s64) = G_FNEG %0
+ %4(s64) = G_FNEG %2
+ %5(s64) = G_FMA %3, %1, %4
+ ; CHECK: [[VREGR:%[0-9]+]]:dpr = VFNMAD [[VREGZ]], [[VREGX]], [[VREGY]], 14, %noreg
+
+ %d0 = COPY %5(s64)
+ ; CHECK: %d0 = COPY [[VREGR]]
+
+ BX_RET 14, %noreg, implicit %d0
+ ; CHECK: BX_RET 14, %noreg, implicit %d0
+...
+---
+name: test_vfmss
+# CHECK-LABEL: name: test_vfmss
+legalized: true
+regBankSelected: true
+selected: false
+# CHECK: selected: true
+registers:
+ - { id: 0, class: fprb }
+ - { id: 1, class: fprb }
+ - { id: 2, class: fprb }
+ - { id: 3, class: fprb }
+ - { id: 4, class: fprb }
+body: |
+ bb.0:
+ liveins: %s0, %s1, %s2
+
+ %0(s32) = COPY %s0
+ %1(s32) = COPY %s1
+ %2(s32) = COPY %s2
+ ; CHECK-DAG: [[VREGX:%[0-9]+]]:spr = COPY %s0
+ ; CHECK-DAG: [[VREGY:%[0-9]+]]:spr = COPY %s1
+ ; CHECK-DAG: [[VREGZ:%[0-9]+]]:spr = COPY %s2
+
+ %3(s32) = G_FNEG %0
+ %4(s32) = G_FMA %3, %1, %2
+ ; CHECK: [[VREGR:%[0-9]+]]:spr = VFMSS [[VREGZ]], [[VREGX]], [[VREGY]], 14, %noreg
+
+ %s0 = COPY %4(s32)
+ ; CHECK: %s0 = COPY [[VREGR]]
+
+ BX_RET 14, %noreg, implicit %s0
+ ; CHECK: BX_RET 14, %noreg, implicit %s0
+...
+---
+name: test_vfmsd
+# CHECK-LABEL: name: test_vfmsd
+legalized: true
+regBankSelected: true
+selected: false
+# CHECK: selected: true
+registers:
+ - { id: 0, class: fprb }
+ - { id: 1, class: fprb }
+ - { id: 2, class: fprb }
+ - { id: 3, class: fprb }
+ - { id: 4, class: fprb }
+body: |
+ bb.0:
+ liveins: %d0, %d1, %d2
+
+ %0(s64) = COPY %d0
+ %1(s64) = COPY %d1
+ %2(s64) = COPY %d2
+ ; CHECK-DAG: [[VREGX:%[0-9]+]]:dpr = COPY %d0
+ ; CHECK-DAG: [[VREGY:%[0-9]+]]:dpr = COPY %d1
+ ; CHECK-DAG: [[VREGZ:%[0-9]+]]:dpr = COPY %d2
+
+ %3(s64) = G_FNEG %1
+ %4(s64) = G_FMA %0, %3, %2
+ ; CHECK: [[VREGR:%[0-9]+]]:dpr = VFMSD [[VREGZ]], [[VREGX]], [[VREGY]], 14, %noreg
+
+ %d0 = COPY %4(s64)
+ ; CHECK: %d0 = COPY [[VREGR]]
+
+ BX_RET 14, %noreg, implicit %d0
+ ; CHECK: BX_RET 14, %noreg, implicit %d0
+...
+---
+name: test_vfnmss
+# CHECK-LABEL: name: test_vfnmss
+legalized: true
+regBankSelected: true
+selected: false
+# CHECK: selected: true
+registers:
+ - { id: 0, class: fprb }
+ - { id: 1, class: fprb }
+ - { id: 2, class: fprb }
+ - { id: 3, class: fprb }
+ - { id: 4, class: fprb }
+body: |
+ bb.0:
+ liveins: %s0, %s1, %s2
+
+ %0(s32) = COPY %s0
+ %1(s32) = COPY %s1
+ %2(s32) = COPY %s2
+ ; CHECK-DAG: [[VREGX:%[0-9]+]]:spr = COPY %s0
+ ; CHECK-DAG: [[VREGY:%[0-9]+]]:spr = COPY %s1
+ ; CHECK-DAG: [[VREGZ:%[0-9]+]]:spr = COPY %s2
+
+ %3(s32) = G_FNEG %2
+ %4(s32) = G_FMA %0, %1, %3
+ ; CHECK: [[VREGR:%[0-9]+]]:spr = VFNMSS [[VREGZ]], [[VREGX]], [[VREGY]], 14, %noreg
+
+ %s0 = COPY %4(s32)
+ ; CHECK: %s0 = COPY [[VREGR]]
+
+ BX_RET 14, %noreg, implicit %s0
+ ; CHECK: BX_RET 14, %noreg, implicit %s0
+...
diff --git a/llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select.mir b/llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select.mir
index 490ffa82154..8ed2f7baee4 100644
--- a/llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select.mir
+++ b/llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select.mir
@@ -27,6 +27,9 @@
define void @test_fneg_s32() #0 { ret void }
define void @test_fneg_s64() #0 { ret void }
+ define void @test_fma_s32() #4 { ret void }
+ define void @test_fma_s64() #4 { ret void }
+
define void @test_sub_s32() { ret void }
define void @test_sub_imm_s32() { ret void }
define void @test_sub_rev_imm_s32() { ret void }
@@ -70,6 +73,7 @@
attributes #1 = { "target-features"="+v6" }
attributes #2 = { "target-features"="+hwdiv-arm" }
attributes #3 = { "target-features"="+v6t2" }
+ attributes #4 = { "target-features"="+vfp4,-neonfp" }
...
---
name: test_trunc_and_zext_s1
@@ -664,6 +668,74 @@ body: |
; CHECK: BX_RET 14, %noreg, implicit %d0
...
---
+name: test_fma_s32
+# CHECK-LABEL: name: test_fma_s32
+legalized: true
+regBankSelected: true
+selected: false
+# CHECK: selected: true
+registers:
+ - { id: 0, class: fprb }
+ - { id: 1, class: fprb }
+ - { id: 2, class: fprb }
+ - { id: 3, class: fprb }
+body: |
+ bb.0:
+ liveins: %s0, %s1, %s2
+
+ %0(s32) = COPY %s0
+ ; CHECK: [[VREGX:%[0-9]+]]:spr = COPY %s0
+
+ %1(s32) = COPY %s1
+ ; CHECK: [[VREGY:%[0-9]+]]:spr = COPY %s1
+
+ %2(s32) = COPY %s2
+ ; CHECK: [[VREGZ:%[0-9]+]]:spr = COPY %s2
+
+ %3(s32) = G_FMA %0, %1, %2
+ ; CHECK: [[VREGR:%[0-9]+]]:spr = VFMAS [[VREGZ]], [[VREGX]], [[VREGY]], 14, %noreg
+
+ %s0 = COPY %3(s32)
+ ; CHECK: %s0 = COPY [[VREGR]]
+
+ BX_RET 14, %noreg, implicit %s0
+ ; CHECK: BX_RET 14, %noreg, implicit %s0
+...
+---
+name: test_fma_s64
+# CHECK-LABEL: name: test_fma_s64
+legalized: true
+regBankSelected: true
+selected: false
+# CHECK: selected: true
+registers:
+ - { id: 0, class: fprb }
+ - { id: 1, class: fprb }
+ - { id: 2, class: fprb }
+ - { id: 3, class: fprb }
+body: |
+ bb.0:
+ liveins: %d0, %d1, %d2
+
+ %0(s64) = COPY %d0
+ ; CHECK: [[VREGX:%[0-9]+]]:dpr = COPY %d0
+
+ %1(s64) = COPY %d1
+ ; CHECK: [[VREGY:%[0-9]+]]:dpr = COPY %d1
+
+ %2(s64) = COPY %d2
+ ; CHECK: [[VREGZ:%[0-9]+]]:dpr = COPY %d2
+
+ %3(s64) = G_FMA %0, %1, %2
+ ; CHECK: [[VREGR:%[0-9]+]]:dpr = VFMAD [[VREGZ]], [[VREGX]], [[VREGY]], 14, %noreg
+
+ %d0 = COPY %3(s64)
+ ; CHECK: %d0 = COPY [[VREGR]]
+
+ BX_RET 14, %noreg, implicit %d0
+ ; CHECK: BX_RET 14, %noreg, implicit %d0
+...
+---
name: test_sub_s32
# CHECK-LABEL: name: test_sub_s32
legalized: true
OpenPOWER on IntegriCloud