diff options
| -rw-r--r-- | llvm/lib/Target/ARM/ARMLegalizerInfo.cpp | 7 | ||||
| -rw-r--r-- | llvm/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp b/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp index 569e61aae29..fe526fef97e 100644 --- a/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp +++ b/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp @@ -59,7 +59,7 @@ widen_8_16(const LegalizerInfo::SizeAndActionsVec &v) { } static LegalizerInfo::SizeAndActionsVec -widen_1_8_16(const LegalizerInfo::SizeAndActionsVec &v) { +widen_1_8_16_narrowToLargest(const LegalizerInfo::SizeAndActionsVec &v) { assert(v.size() >= 1); assert(v[0].first > 17); LegalizerInfo::SizeAndActionsVec result = { @@ -68,7 +68,7 @@ widen_1_8_16(const LegalizerInfo::SizeAndActionsVec &v) { {16, LegalizerInfo::WidenScalar}, {17, LegalizerInfo::Unsupported}}; addAndInterleaveWithUnsupported(result, v); auto Largest = result.back().first; - result.push_back({Largest + 1, LegalizerInfo::Unsupported}); + result.push_back({Largest + 1, LegalizerInfo::NarrowScalar}); return result; } @@ -151,7 +151,8 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) { setAction({G_CONSTANT, s32}, Legal); setAction({G_CONSTANT, p0}, Legal); - setLegalizeScalarToDifferentSizeStrategy(G_CONSTANT, 0, widen_1_8_16); + setLegalizeScalarToDifferentSizeStrategy(G_CONSTANT, 0, + widen_1_8_16_narrowToLargest); setAction({G_ICMP, s1}, Legal); setLegalizeScalarToDifferentSizeStrategy(G_ICMP, 1, diff --git a/llvm/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir b/llvm/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir index e3c9839682a..d88f48c2654 100644 --- a/llvm/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir +++ b/llvm/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir @@ -879,6 +879,9 @@ registers: - { id: 3, class: _ } - { id: 4, class: _ } - { id: 5, class: _ } + - { id: 6, class: _ } + - { id: 7, class: _ } + - { id: 8, class: _ } body: | bb.0: liveins: %r0 @@ -913,6 +916,14 @@ body: | G_STORE %5(p0), %4(p0) :: (store 4) ; CHECK: {{%[0-9]+}}:_(p0) = G_CONSTANT 0 + %6(s64) = G_CONSTANT i64 17179869200 ; = 4 * 2 ^ 32 + 16 + %7(s32), %8(s32) = G_UNMERGE_VALUES %6(s64) + G_STORE %7(s32), %4(p0) :: (store 4) + G_STORE %8(s32), %4(p0) :: (store 4) + ; CHECK-DAG: {{%[0-9]+}}:_(s32) = G_CONSTANT i32 4 + ; CHECK-DAG: {{%[0-9]+}}:_(s32) = G_CONSTANT i32 16 + ; CHECK-NOT: G_CONSTANT i64 + %r0 = COPY %0(s32) BX_RET 14, %noreg, implicit %r0 ... |

