[llvm] r279757 - GlobalISel: mark small extends as legal on AArch64
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 25 10:37:25 PDT 2016
Author: tnorthover
Date: Thu Aug 25 12:37:25 2016
New Revision: 279757
URL: http://llvm.org/viewvc/llvm-project?rev=279757&view=rev
Log:
GlobalISel: mark small extends as legal on AArch64
Added:
llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-ext.mir
Modified:
llvm/trunk/lib/Target/AArch64/AArch64MachineLegalizer.cpp
Modified: llvm/trunk/lib/Target/AArch64/AArch64MachineLegalizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64MachineLegalizer.cpp?rev=279757&r1=279756&r2=279757&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64MachineLegalizer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64MachineLegalizer.cpp Thu Aug 25 12:37:25 2016
@@ -86,6 +86,19 @@ AArch64MachineLegalizer::AArch64MachineL
}
}
+ // Extensions
+ for (auto Ty : { s1, s8, s16, s32, s64 }) {
+ setAction({G_ZEXT, Ty}, Legal);
+ setAction({G_SEXT, Ty}, Legal);
+ setAction({G_ANYEXT, Ty}, Legal);
+ }
+
+ for (auto Ty : { s1, s8, s16, s32 }) {
+ setAction({G_ZEXT, 1, Ty}, Legal);
+ setAction({G_SEXT, 1, Ty}, Legal);
+ setAction({G_ANYEXT, 1, Ty}, Legal);
+ }
+
// Control-flow
setAction({G_BR, LLT::unsized()}, Legal);
setAction({G_BRCOND, s32}, Legal);
Added: llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-ext.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-ext.mir?rev=279757&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-ext.mir (added)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-ext.mir Thu Aug 25 12:37:25 2016
@@ -0,0 +1,73 @@
+# RUN: llc -O0 -run-pass=legalize-mir -global-isel %s -o - 2>&1 | FileCheck %s
+
+--- |
+ target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+ target triple = "aarch64-apple-ios"
+ define void @test_ext() {
+ entry:
+ ret void
+ }
+...
+
+---
+name: test_ext
+registers:
+ - { id: 0, class: _ }
+ - { id: 1, class: _ }
+ - { id: 2, class: _ }
+ - { id: 3, class: _ }
+ - { id: 4, class: _ }
+ - { id: 5, class: _ }
+ - { id: 6, class: _ }
+ - { id: 7, class: _ }
+ - { id: 8, class: _ }
+ - { id: 9, class: _ }
+ - { id: 10, class: _ }
+ - { id: 11, class: _ }
+ - { id: 12, class: _ }
+ - { id: 13, class: _ }
+ - { id: 14, class: _ }
+ - { id: 15, class: _ }
+ - { id: 16, class: _ }
+body: |
+ bb.0.entry:
+ liveins: %x0, %x1, %x2, %x3
+ %0(64) = COPY %x0
+
+ ; CHECK: %1(1) = G_TRUNC { s1, s64 } %0
+ ; CHECK: %2(8) = G_TRUNC { s8, s64 } %0
+ ; CHECK: %3(16) = G_TRUNC { s16, s64 } %0
+ ; CHECK: %4(32) = G_TRUNC { s16, s64 } %0
+ %1(1) = G_TRUNC { s1, s64 } %0
+ %2(8) = G_TRUNC { s8, s64 } %0
+ %3(16) = G_TRUNC { s16, s64 } %0
+ %4(32) = G_TRUNC { s16, s64 } %0
+
+ ; CHECK: %5(64) = G_ANYEXT { s64, s1 } %1
+ ; CHECK: %6(64) = G_ZEXT { s64, s8 } %2
+ ; CHECK: %7(64) = G_ANYEXT { s64, s16 } %3
+ ; CHECK: %8(64) = G_SEXT { s64, s32 } %4
+ %5(64) = G_ANYEXT { s64, s1 } %1
+ %6(64) = G_ZEXT { s64, s8 } %2
+ %7(64) = G_ANYEXT { s64, s16 } %3
+ %8(64) = G_SEXT { s64, s32 } %4
+
+ ; CHECK: %9(32) = G_SEXT { s32, s1 } %1
+ ; CHECK: %10(32) = G_ZEXT { s32, s8 } %2
+ ; CHECK: %11(32) = G_ANYEXT { s32, s16 } %3
+ %9(32) = G_SEXT { s32, s1 } %1
+ %10(32) = G_ZEXT { s32, s8 } %2
+ %11(32) = G_ANYEXT { s32, s16 } %3
+
+ ; CHECK: %12(32) = G_ZEXT { s32, s1 } %1
+ ; CHECK: %13(32) = G_ANYEXT { s32, s8 } %2
+ ; CHECK: %14(32) = G_SEXT { s32, s16 } %3
+ %12(32) = G_ZEXT { s32, s1 } %1
+ %13(32) = G_ANYEXT { s32, s8 } %2
+ %14(32) = G_SEXT { s32, s16 } %3
+
+ ; CHECK: %15(8) = G_ZEXT { s8, s1 } %1
+ ; CHECK: %16(16) = G_ANYEXT { s16, s8 } %2
+ %15(8) = G_ZEXT { s8, s1 } %1
+ %16(16) = G_ANYEXT { s16, s8 } %2
+...
More information about the llvm-commits
mailing list