summaryrefslogtreecommitdiff
path: root/test/CodeGen/AArch64
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2017-10-16 22:28:40 +0000
committerQuentin Colombet <qcolombet@apple.com>2017-10-16 22:28:40 +0000
commit364dbc593b0d9275c891a735006adc6d68cab6b4 (patch)
treebbeb61da9fb6fde7e6b7daae353ac7f56734e9b0 /test/CodeGen/AArch64
parente4ffbabdc0c427086b7046ba13e1e7450689b9cc (diff)
Re-apply [AArch64][RegisterBankInfo] Use the statically computed mappings for COPY
This reverts commit r315823, thus re-applying r315781. Also make sure we don't use G_BITCAST mapping for non-generic registers. Non-generic registers don't have a type but do have a reg bank. Something the COPY mapping now how to deal with but the G_BITCAST mapping don't. -- Original Commit Message -- We use to resort on the generic implementation to get the mappings for COPYs. The generic implementation resorts on table lookup and dynamically allocated objects to get the valid mappings. Given we already know how to map G_BITCAST and have the static mappings for them, use that code path for COPY as well. This is much more efficient. Improve the compile time of RegBankSelect by up to 20%. Note: When we eventually generate all the mappings via TableGen, we wouldn't have to do that dance to shave compile time. The intent of this change was to make sure that moving to static structure really pays off. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315947 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/AArch64')
-rw-r--r--test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir b/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir
index 1d4781a9d98..03861b19a77 100644
--- a/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir
+++ b/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir
@@ -67,6 +67,8 @@
define void @bitcast_s64_gpr_fpr() { ret void }
define void @bitcast_s64_fpr_gpr() { ret void }
define void @bitcast_s128() { ret void }
+ define void @copy_s128() { ret void }
+ define void @copy_s128_from_load() { ret void }
define i64 @greedyWithChainOfComputation(i64 %arg1, <2 x i32>* %addr) {
%varg1 = bitcast i64 %arg1 to <2 x i32>
@@ -643,6 +645,69 @@ body: |
...
---
+# CHECK-LABEL: name: copy_s128
+# This test checks that we issue the proper mapping
+# for copy of size > 64.
+# The mapping should be the same as G_BITCAST.
+name: copy_s128
+legalized: true
+tracksRegLiveness: true
+registers:
+ - { id: 0, class: _}
+ - { id: 1, class: _}
+ - { id: 2, class: _}
+ - { id: 3, class: _}
+ - { id: 4, class: _}
+# CHECK: registers:
+# CHECK: - { id: 2, class: fpr, preferred-register: '' }
+# CHECK: - { id: 3, class: fpr, preferred-register: '' }
+# CHECK: - { id: 4, class: fpr, preferred-register: '' }
+# CHECK: %4(s128) = COPY %3(s128)
+# CHECK-NEXT: %2(<2 x s64>) = G_BITCAST %4(s128)
+body: |
+ bb.1:
+ liveins: %x0, %x1
+ %0(s64) = COPY %x0
+ %1(s64) = COPY %x1
+ %3(s128) = G_MERGE_VALUES %0(s64), %1(s64)
+ %4(s128) = COPY %3(s128)
+ %2(<2 x s64>) = G_BITCAST %4(s128)
+ %q0 = COPY %2(<2 x s64>)
+ RET_ReallyLR implicit %q0
+
+...
+
+---
+# CHECK-LABEL: name: copy_s128_from_load
+# This test checks that we issue the proper mapping
+# for copy of size > 64 when the input is neither
+# a physcal register nor a generic register.
+# This used to crash when we moved to the statically
+# computed mapping, because we were assuming non-physregs
+# were generic registers and thus have a type, whereas
+# it is not necessarily the case.
+name: copy_s128_from_load
+legalized: true
+tracksRegLiveness: true
+registers:
+ - { id: 0, class: fpr128}
+ - { id: 1, class: _}
+# CHECK: registers:
+# CHECK: - { id: 0, class: fpr128, preferred-register: '' }
+# CHECK: - { id: 1, class: fpr, preferred-register: '' }
+# CHECK: %1(s128) = COPY %0
+body: |
+ bb.1:
+ liveins: %x0
+ %0 = LDRQui killed %x0, 0
+ %1(s128) = COPY %0
+ %q0 = COPY %1(s128)
+ RET_ReallyLR implicit %q0
+
+...
+
+
+---
# Make sure the greedy mode is able to take advantage of the
# alternative mappings of G_LOAD to coalesce the whole chain
# of computation on GPR.