[llvm] r307239 - [ARM] GlobalISel: Widen s1, s8, s16 G_CONSTANT
Diana Picus via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 6 01:04:16 PDT 2017
Author: rovka
Date: Thu Jul 6 01:04:16 2017
New Revision: 307239
URL: http://llvm.org/viewvc/llvm-project?rev=307239&view=rev
Log:
[ARM] GlobalISel: Widen s1, s8, s16 G_CONSTANT
Get the legalizer to widen small constants.
Modified:
llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp
llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir
Modified: llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp?rev=307239&r1=307238&r2=307239&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp Thu Jul 6 01:04:16 2017
@@ -89,6 +89,8 @@ ARMLegalizerInfo::ARMLegalizerInfo(const
setAction({G_SELECT, 1, s1}, Legal);
setAction({G_CONSTANT, s32}, Legal);
+ for (auto Ty : {s1, s8, s16})
+ setAction({G_CONSTANT, Ty}, WidenScalar);
setAction({G_ICMP, s1}, Legal);
for (auto Ty : {s8, s16})
Modified: llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir?rev=307239&r1=307238&r2=307239&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir (original)
+++ llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir Thu Jul 6 01:04:16 2017
@@ -689,11 +689,26 @@ selected: false
tracksRegLiveness: true
registers:
- { id: 0, class: _ }
+ - { id: 1, class: _ }
+ - { id: 2, class: _ }
+ - { id: 3, class: _ }
body: |
bb.0:
%0(s32) = G_CONSTANT 42
; CHECK: {{%[0-9]+}}(s32) = G_CONSTANT 42
+ %1(s16) = G_CONSTANT i16 21
+ ; CHECK: [[EXT:%[0-9]+]](s32) = G_CONSTANT i32 21
+ ; CHECK: {{%[0-9]+}}(s16) = G_TRUNC [[EXT]](s32)
+
+ %2(s8) = G_CONSTANT i8 10
+ ; CHECK: [[EXT:%[0-9]+]](s32) = G_CONSTANT i32 10
+ ; CHECK: {{%[0-9]+}}(s8) = G_TRUNC [[EXT]](s32)
+
+ %3(s1) = G_CONSTANT i1 1
+ ; CHECK: [[EXT:%[0-9]+]](s32) = G_CONSTANT i32 -1
+ ; CHECK: {{%[0-9]+}}(s1) = G_TRUNC [[EXT]](s32)
+
%r0 = COPY %0(s32)
BX_RET 14, _, implicit %r0
...
More information about the llvm-commits
mailing list