summaryrefslogtreecommitdiff
path: root/test/CodeGen/AArch64
diff options
context:
space:
mode:
authorVolkan Keles <vkeles@apple.com>2017-12-01 08:19:10 +0000
committerVolkan Keles <vkeles@apple.com>2017-12-01 08:19:10 +0000
commitaf9296a79cc769035080c4dc41a217914c55cae7 (patch)
tree47b3d278662ffb59f314f7bbe7633217c98cb777 /test/CodeGen/AArch64
parente9838656296473ac99fd64329744eb6465928633 (diff)
GlobalISel: Enable the legalization of G_MERGE_VALUES and G_UNMERGE_VALUES
Summary: LegalizerInfo assumes all G_MERGE_VALUES and G_UNMERGE_VALUES instructions are legal, so it is not possible to legalize vector operations on illegal vector types. This patch fixes the problem by removing the related check and adding default actions for G_MERGE_VALUES and G_UNMERGE_VALUES. Reviewers: qcolombet, ab, dsanders, aditya_nandakumar, t.p.northover, kristof.beyls Reviewed By: dsanders Subscribers: rovka, javed.absar, igorb, llvm-commits Differential Revision: https://reviews.llvm.org/D39823 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319524 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/AArch64')
-rw-r--r--test/CodeGen/AArch64/GlobalISel/legalize-combines.mir21
-rw-r--r--test/CodeGen/AArch64/GlobalISel/legalize-merge-values.mir30
-rw-r--r--test/CodeGen/AArch64/GlobalISel/legalize-nonpowerof2eltsvec.mir34
-rw-r--r--test/CodeGen/AArch64/GlobalISel/legalize-unmerge-values.mir28
-rw-r--r--test/CodeGen/AArch64/GlobalISel/no-regclass.mir4
5 files changed, 76 insertions, 41 deletions
diff --git a/test/CodeGen/AArch64/GlobalISel/legalize-combines.mir b/test/CodeGen/AArch64/GlobalISel/legalize-combines.mir
index 82594b8c476..9cf0f8fd0e7 100644
--- a/test/CodeGen/AArch64/GlobalISel/legalize-combines.mir
+++ b/test/CodeGen/AArch64/GlobalISel/legalize-combines.mir
@@ -8,7 +8,6 @@
define void @test_combines_3() { ret void }
define void @test_combines_4() { ret void }
define void @test_combines_5() { ret void }
- define void @test_combines_6() { ret void }
...
---
@@ -90,23 +89,3 @@ body: |
%5:_(s32) = G_ADD %3, %4
%w0 = COPY %5
...
-
----
-name: test_combines_6
-body: |
- bb.0:
- liveins: %w0
-
- ; Check that we replace all the uses of a G_EXTRACT.
- ; CHECK-LABEL: name: test_combines_6
- ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY %w0
- ; CHECK: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[COPY]], [[COPY]]
- ; CHECK: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[MUL]]
- %0:_(s32) = COPY %w0
-
- %1:_(s32) = G_MERGE_VALUES %0
- %2:_(s32) = G_UNMERGE_VALUES %1
- %3:_(s32) = G_MUL %2, %2
- %4:_(s32) = G_ADD %2, %3
- %w0 = COPY %4
-...
diff --git a/test/CodeGen/AArch64/GlobalISel/legalize-merge-values.mir b/test/CodeGen/AArch64/GlobalISel/legalize-merge-values.mir
new file mode 100644
index 00000000000..e6171380344
--- /dev/null
+++ b/test/CodeGen/AArch64/GlobalISel/legalize-merge-values.mir
@@ -0,0 +1,30 @@
+# RUN: llc -O0 -run-pass=legalizer -global-isel -global-isel-abort=0 -pass-remarks-missed='gisel*' %s -o - 2>&1 | FileCheck %s
+
+--- |
+ target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+ target triple = "aarch64--"
+ define void @test_merge_s4() {
+ ret void
+ }
+...
+
+---
+name: test_merge_s4
+registers:
+ - { id: 0, class: _ }
+ - { id: 1, class: _ }
+ - { id: 2, class: _ }
+ - { id: 3, class: _ }
+ - { id: 4, class: _ }
+body: |
+ bb.0:
+ %0(s64) = G_CONSTANT i64 0
+ %1(s4) = G_TRUNC %0(s64)
+ ; Previously, LegalizerInfo was assuming all G_MERGE_VALUES and G_UNMERGE_VALUES
+ ; instructions are legal. Make sure that is no longer happening.
+ ; CHECK: unable to legalize instruction: {{.*}} G_MERGE_VALUES
+ %2(s8) = G_MERGE_VALUES %1(s4), %1(s4)
+ %3(s8) = COPY %2(s8)
+ %4(s64) = G_ANYEXT %3(s8)
+ %x0 = COPY %4(s64)
+...
diff --git a/test/CodeGen/AArch64/GlobalISel/legalize-nonpowerof2eltsvec.mir b/test/CodeGen/AArch64/GlobalISel/legalize-nonpowerof2eltsvec.mir
index a586e69c855..168e1df0277 100644
--- a/test/CodeGen/AArch64/GlobalISel/legalize-nonpowerof2eltsvec.mir
+++ b/test/CodeGen/AArch64/GlobalISel/legalize-nonpowerof2eltsvec.mir
@@ -4,33 +4,31 @@
--- |
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--"
- define void @test_legalize_merge_v3s32() {
+ define void @test_legalize_merge_v3s64() {
ret void
}
...
---
-name: test_legalize_merge_v3s32
+name: test_legalize_merge_v3s64
registers:
- { id: 0, class: _ }
- { id: 1, class: _ }
- { id: 2, class: _ }
- { id: 3, class: _ }
+ - { id: 4, class: _ }
+ - { id: 5, class: _ }
body: |
bb.0:
- liveins: %w0, %w1, %w2
- ; CHECK-LABEL: name: test_legalize_merge_v3s32
- ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY %w0
- ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY %w1
- ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY %w2
- ; CHECK: %w0 = COPY [[COPY]](s32)
- ; CHECK: %w1 = COPY [[COPY1]](s32)
- ; CHECK: %w2 = COPY [[COPY2]](s32)
- %0(s32) = COPY %w0
- %1(s32) = COPY %w1
- %2(s32) = COPY %w2
- %3(<3 x s32>) = G_MERGE_VALUES %0(s32), %1(s32), %2(s32)
- %4:_(s32), %5:_(s32), %6:_(s32) = G_UNMERGE_VALUES %3
- %w0 = COPY %4
- %w1 = COPY %5
- %w2 = COPY %6
+ liveins: %w0
+ ; CHECK-LABEL: name: test_legalize_merge_v3s64
+ ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY %x0
+ ; CHECK: [[MV:%[0-9]+]]:_(<3 x s64>) = G_MERGE_VALUES [[COPY]](s64), [[COPY]](s64), [[COPY]](s64)
+ ; CHECK: [[COPY1:%[0-9]+]]:_(<3 x s64>) = COPY [[MV]](<3 x s64>)
+ ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64), [[UV2:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY1]](<3 x s64>)
+ ; CHECK: %x0 = COPY [[UV]](s64)
+ %0(s64) = COPY %x0
+ %1(<3 x s64>) = G_MERGE_VALUES %0(s64), %0(s64), %0(s64)
+ %2(<3 x s64>) = COPY %1(<3 x s64>)
+ %3(s64), %4(s64), %5(s64) = G_UNMERGE_VALUES %2(<3 x s64>)
+ %x0 = COPY %3(s64)
...
diff --git a/test/CodeGen/AArch64/GlobalISel/legalize-unmerge-values.mir b/test/CodeGen/AArch64/GlobalISel/legalize-unmerge-values.mir
new file mode 100644
index 00000000000..85b65e94548
--- /dev/null
+++ b/test/CodeGen/AArch64/GlobalISel/legalize-unmerge-values.mir
@@ -0,0 +1,28 @@
+# RUN: llc -O0 -run-pass=legalizer -global-isel -global-isel-abort=0 -pass-remarks-missed='gisel*' %s -o - 2>&1 | FileCheck %s
+
+--- |
+ target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+ target triple = "aarch64--"
+ define void @test_unmerge_s4() {
+ ret void
+ }
+...
+
+---
+name: test_unmerge_s4
+registers:
+ - { id: 0, class: _ }
+ - { id: 1, class: _ }
+ - { id: 2, class: _ }
+ - { id: 3, class: _ }
+body: |
+ bb.0:
+ %0(s8) = G_CONSTANT i8 0
+ ; Previously, LegalizerInfo was assuming all G_MERGE_VALUES and G_UNMERGE_VALUES
+ ; instructions are legal. Make sure that is no longer happening.
+ ; CHECK: unable to legalize instruction: {{.*}} G_UNMERGE_VALUES
+ %1(s4), %2(s4)= G_UNMERGE_VALUES %0(s8)
+ %3(s64) = G_ANYEXT %1(s4)
+ %x0 = COPY %3(s64)
+
+...
diff --git a/test/CodeGen/AArch64/GlobalISel/no-regclass.mir b/test/CodeGen/AArch64/GlobalISel/no-regclass.mir
index d4d23142ab9..8732274fe03 100644
--- a/test/CodeGen/AArch64/GlobalISel/no-regclass.mir
+++ b/test/CodeGen/AArch64/GlobalISel/no-regclass.mir
@@ -25,7 +25,7 @@ body: |
; CHECK: [[COPY:%[0-9]+]]:gpr32all = COPY %w0
; CHECK: %w0 = COPY [[COPY]]
%0:gpr(s32) = COPY %w0
- %1:gpr(s32) = G_MERGE_VALUES %0(s32)
- %2:gpr(s32) = G_UNMERGE_VALUES %1(s32)
+ %1:gpr(s64) = G_MERGE_VALUES %0(s32), %0(s32)
+ %2:gpr(s32), %3:gpr(s32) = G_UNMERGE_VALUES %1(s64)
%w0 = COPY %2(s32)
...