[llvm] r315945 - [AArch64][LegalizerInfo] Mark s128 G_BITCAST legal
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 16 15:28:27 PDT 2017
Author: qcolombet
Date: Mon Oct 16 15:28:27 2017
New Revision: 315945
URL: http://llvm.org/viewvc/llvm-project?rev=315945&view=rev
Log:
[AArch64][LegalizerInfo] Mark s128 G_BITCAST legal
We used to mark all G_BITCAST of 128-bit legal but only for vector
types. Scalars of this size are just fine as well.
Modified:
llvm/trunk/lib/Target/AArch64/AArch64LegalizerInfo.cpp
llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-simple.mir
Modified: llvm/trunk/lib/Target/AArch64/AArch64LegalizerInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64LegalizerInfo.cpp?rev=315945&r1=315944&r2=315945&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LegalizerInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64LegalizerInfo.cpp Mon Oct 16 15:28:27 2017
@@ -31,6 +31,7 @@ AArch64LegalizerInfo::AArch64LegalizerIn
const LLT s16 = LLT::scalar(16);
const LLT s32 = LLT::scalar(32);
const LLT s64 = LLT::scalar(64);
+ const LLT s128 = LLT::scalar(128);
const LLT v2s32 = LLT::vector(2, 32);
const LLT v4s32 = LLT::vector(4, 32);
const LLT v2s64 = LLT::vector(2, 64);
@@ -229,7 +230,8 @@ AArch64LegalizerInfo::AArch64LegalizerIn
setAction({G_INTTOPTR, 1, s64}, Legal);
// Casts for 32 and 64-bit width type are just copies.
- for (auto Ty : {s1, s8, s16, s32, s64}) {
+ // Same for 128-bit width type, except they are on the FPR bank.
+ for (auto Ty : {s1, s8, s16, s32, s64, s128}) {
setAction({G_BITCAST, 0, Ty}, Legal);
setAction({G_BITCAST, 1, Ty}, Legal);
}
Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-simple.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-simple.mir?rev=315945&r1=315944&r2=315945&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-simple.mir (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-simple.mir Mon Oct 16 15:28:27 2017
@@ -9,6 +9,9 @@
next:
ret void
}
+ define void @bitcast128() {
+ ret void
+ }
...
---
@@ -84,3 +87,26 @@ body: |
%15(<4 x s8>) = G_BITCAST %0
%16(<2 x s16>) = G_BITCAST %0
...
+
+---
+name: bitcast128
+tracksRegLiveness: true
+registers:
+ - { id: 0, class: _}
+ - { id: 1, class: _}
+ - { id: 2, class: _}
+ - { id: 3, class: _}
+body: |
+ bb.1:
+ liveins: %x0, %x1
+ ; CHECK-LABEL: bitcast128
+ ; This is legal and shouldn't be changed.
+ ; CHECK: %2(<2 x s64>) = G_BITCAST %3(s128)
+ %0(s64) = COPY %x0
+ %1(s64) = COPY %x1
+ %3(s128) = G_MERGE_VALUES %0(s64), %1(s64)
+ %2(<2 x s64>) = G_BITCAST %3(s128)
+ %q0 = COPY %2(<2 x s64>)
+ RET_ReallyLR implicit %q0
+
+...
More information about the llvm-commits
mailing list