Skip to content

Commit 1ee50b4

Browse files
committed
[AArch64] Fix scalar imm variants of SIMD shift left instructions
This issue was reported in PR50057: Cannot select: t10: i64 = AArch64ISD::VSHL t2, Constant:i32<2> Shift intrinsics (llvm.aarch64.neon.ushl.i64 and sshl) with a constant shift operand are lowered into AArch64ISD::VSHL in tryCombineShiftImm. VSHL has i64 and v1i64 patterns for a right shift, but only v1i64 for a left shift. This patch adds the missing i64 pattern for AArch64ISD::VSHL, and LIT tests to cover scalar variants (i64 and v1i64) of all shift intrinsics (only ushl and sshl cases fail without the patch, others were just not covered). Differential Revision: https://reviews.llvm.org/D101580
1 parent 3ee8265 commit 1ee50b4

File tree

2 files changed

+371
-2
lines changed

2 files changed

+371
-2
lines changed

llvm/lib/Target/AArch64/AArch64InstrFormats.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8958,10 +8958,13 @@ multiclass SIMDScalarLShiftD<bit U, bits<5> opc, string asm,
89588958
SDPatternOperator OpNode> {
89598959
def d : BaseSIMDScalarShift<U, opc, {1,?,?,?,?,?,?},
89608960
FPR64, FPR64, vecshiftL64, asm,
8961-
[(set (v1i64 FPR64:$Rd),
8962-
(OpNode (v1i64 FPR64:$Rn), (i32 vecshiftL64:$imm)))]> {
8961+
[(set (i64 FPR64:$Rd),
8962+
(OpNode (i64 FPR64:$Rn), (i32 vecshiftL64:$imm)))]> {
89638963
let Inst{21-16} = imm{5-0};
89648964
}
8965+
8966+
def : Pat<(v1i64 (OpNode (v1i64 FPR64:$Rn), (i32 vecshiftL64:$imm))),
8967+
(!cast<Instruction>(NAME # "d") FPR64:$Rn, vecshiftL64:$imm)>;
89658968
}
89668969

89678970
let mayStore = 0, mayLoad = 0, hasSideEffects = 0 in

0 commit comments

Comments
 (0)