Skip to content

Commit e7e4d99

Browse files
authored
[AArch64] Use vecshiftL64 instead of vecshiftR64 to match scalar SLI imm. (#139904)
`SIMDScalarLShiftDTied` should be using `vecshiftL64` to match the immediate argument rather than `vecshiftR64` as the latter prevents the pattern from matching 0 (and allows 64 instead). Fixes #139879.
1 parent fbdf38e commit e7e4d99

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

llvm/lib/Target/AArch64/AArch64InstrFormats.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10188,7 +10188,7 @@ multiclass SIMDScalarLShiftDTied<bit U, bits<5> opc, string asm,
1018810188
def d : BaseSIMDScalarShiftTied<U, opc, {1,?,?,?,?,?,?},
1018910189
FPR64, FPR64, vecshiftL64, asm,
1019010190
[(set (v1i64 FPR64:$dst), (OpNode (v1i64 FPR64:$Rd), (v1i64 FPR64:$Rn),
10191-
(i32 vecshiftR64:$imm)))]> {
10191+
(i32 vecshiftL64:$imm)))]> {
1019210192
let Inst{21-16} = imm{5-0};
1019310193
}
1019410194
}

llvm/test/CodeGen/AArch64/arm64-vshift.ll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
; CHECK-GI-NEXT: warning: Instruction selection used fallback path for sli4h
9696
; CHECK-GI-NEXT: warning: Instruction selection used fallback path for sli2s
9797
; CHECK-GI-NEXT: warning: Instruction selection used fallback path for sli1d
98+
; CHECK-GI-NEXT: warning: Instruction selection used fallback path for sli1d_imm0
9899
; CHECK-GI-NEXT: warning: Instruction selection used fallback path for sli16b
99100
; CHECK-GI-NEXT: warning: Instruction selection used fallback path for sli8h
100101
; CHECK-GI-NEXT: warning: Instruction selection used fallback path for sli4s
@@ -4088,6 +4089,16 @@ define <1 x i64> @sli1d(ptr %A, ptr %B) nounwind {
40884089
ret <1 x i64> %tmp3
40894090
}
40904091

4092+
; Ensure we can select scalar SLI with a zero shift (see issue #139879).
4093+
define <1 x i64> @sli1d_imm0(<1 x i64> %a, <1 x i64> %b) {
4094+
; CHECK-LABEL: sli1d_imm0:
4095+
; CHECK: // %bb.0:
4096+
; CHECK-NEXT: sli d0, d1, #0
4097+
; CHECK-NEXT: ret
4098+
%r = call <1 x i64> @llvm.aarch64.neon.vsli(<1 x i64> %a, <1 x i64> %b, i32 0)
4099+
ret <1 x i64> %r
4100+
}
4101+
40914102
define <16 x i8> @sli16b(ptr %A, ptr %B) nounwind {
40924103
; CHECK-LABEL: sli16b:
40934104
; CHECK: // %bb.0:

0 commit comments

Comments
 (0)