[llvm] 5a50f8b - [AArch64][GlobalISel] Add legalization and selection support for <4 x s16> G_SHL.
Amara Emerson via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 18 23:38:57 PDT 2020
Author: Amara Emerson
Date: 2020-09-18T23:32:01-07:00
New Revision: 5a50f8b39f4e02cc05e78f1faf3c82c9c7449026
URL: https://github.com/llvm/llvm-project/commit/5a50f8b39f4e02cc05e78f1faf3c82c9c7449026
DIFF: https://github.com/llvm/llvm-project/commit/5a50f8b39f4e02cc05e78f1faf3c82c9c7449026.diff
LOG: [AArch64][GlobalISel] Add legalization and selection support for <4 x s16> G_SHL.
Added:
Modified:
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
llvm/test/CodeGen/AArch64/GlobalISel/legalize-shift.mir
llvm/test/CodeGen/AArch64/GlobalISel/select-vector-shift.mir
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
index 2a85edea65d5..5469456ff63e 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
@@ -1493,6 +1493,8 @@ bool AArch64InstructionSelector::selectVectorSHL(
Opc = ImmVal ? AArch64::SHLv4i32_shift : AArch64::USHLv4i32;
} else if (Ty == LLT::vector(2, 32)) {
Opc = ImmVal ? AArch64::SHLv2i32_shift : AArch64::USHLv2i32;
+ } else if (Ty == LLT::vector(4, 16)) {
+ Opc = ImmVal ? AArch64::SHLv4i16_shift : AArch64::USHLv4i16;
} else {
LLVM_DEBUG(dbgs() << "Unhandled G_SHL type");
return false;
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
index b69a70bc0bbd..bbdd2381ccdf 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -98,13 +98,17 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
.moreElementsToNextPow2(0);
getActionDefinitionsBuilder(G_SHL)
- .legalFor({{s32, s32},
- {s64, s64},
- {v2s32, v2s32},
- {v4s32, v4s32},
- {v2s64, v2s64},
- {v16s8, v16s8},
- {v8s16, v8s16}})
+ .legalFor({
+ {s32, s32},
+ {s64, s64},
+ {v16s8, v16s8},
+ {v4s16, v4s16},
+ {v8s16, v8s16},
+ {v2s32, v2s32},
+ {v4s32, v4s32},
+ {v2s64, v2s64},
+
+ })
.clampScalar(1, s32, s64)
.clampScalar(0, s32, s64)
.widenScalarToNextPow2(0)
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-shift.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-shift.mir
index 05cb4cb2908a..ce7c8e7f1b86 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-shift.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-shift.mir
@@ -368,3 +368,17 @@ body: |
%2:_(<8 x s16>) = G_LSHR %0, %1
$q0 = COPY %2
...
+---
+name: test_shl_v4i16
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: test_shl_v4i16
+ ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
+ ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
+ ; CHECK: [[SHL:%[0-9]+]]:_(<4 x s16>) = G_SHL [[COPY]], [[COPY1]](<4 x s16>)
+ ; CHECK: $d0 = COPY [[SHL]](<4 x s16>)
+ %0:_(<4 x s16>) = COPY $d0
+ %1:_(<4 x s16>) = COPY $d1
+ %2:_(<4 x s16>) = G_SHL %0, %1
+ $d0 = COPY %2
+...
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/select-vector-shift.mir b/llvm/test/CodeGen/AArch64/GlobalISel/select-vector-shift.mir
index 29e6f442542e..d0717ee4b75b 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/select-vector-shift.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/select-vector-shift.mir
@@ -351,3 +351,24 @@ body: |
RET_ReallyLR implicit $q0
...
+---
+name: shl_v4i16
+legalized: true
+regBankSelected: true
+tracksRegLiveness: true
+body: |
+ bb.1:
+ liveins: $d0, $d1
+ ; CHECK-LABEL: name: shl_v4i16
+ ; CHECK: liveins: $d0, $d1
+ ; CHECK: [[COPY:%[0-9]+]]:fpr64 = COPY $d0
+ ; CHECK: [[COPY1:%[0-9]+]]:fpr64 = COPY $d1
+ ; CHECK: [[USHLv4i16_:%[0-9]+]]:fpr64 = USHLv4i16 [[COPY]], [[COPY1]]
+ ; CHECK: $d0 = COPY [[USHLv4i16_]]
+ ; CHECK: RET_ReallyLR implicit $d0
+ %0:fpr(<4 x s16>) = COPY $d0
+ %1:fpr(<4 x s16>) = COPY $d1
+ %2:fpr(<4 x s16>) = G_SHL %0, %1(<4 x s16>)
+ $d0 = COPY %2(<4 x s16>)
+ RET_ReallyLR implicit $d0
+...
More information about the llvm-commits
mailing list