Skip to content

Commit 4ab2719

Browse files
committed
Don't sink splat operands when VT is scalable
1 parent 6b9c2e2 commit 4ab2719

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5240,6 +5240,10 @@ bool AArch64TTIImpl::isProfitableToSinkOperands(
52405240
return !Ops.empty() && (NumSExts == 2 || NumZExts == 2);
52415241
}
52425242
case Instruction::FMul: {
5243+
// For SVE the lane-indexing is within 128-bits, so we can't fold splats.
5244+
if (I->getType()->isScalableTy())
5245+
return false;
5246+
52435247
// Sink splats for index lane variants
52445248
if (isSplatShuffle(I->getOperand(0)))
52455249
Ops.push_back(&I->getOperandUse(0));

llvm/test/CodeGen/AArch64/sinksplat.ll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,13 +426,12 @@ l2:
426426
define <vscale x 4 x float> @fmul_scalable(ptr %x, ptr %y) {
427427
; CHECK-LABEL: fmul_scalable:
428428
; CHECK: // %bb.0: // %entry
429+
; CHECK-NEXT: ptrue p0.s
429430
; CHECK-NEXT: rdvl x8, #1
430-
; CHECK-NEXT: ldr s1, [x0]
431431
; CHECK-NEXT: mov z0.s, #0 // =0x0
432432
; CHECK-NEXT: sxtw x8, w8
433-
; CHECK-NEXT: ptrue p0.s
434433
; CHECK-NEXT: mov w9, #1 // =0x1
435-
; CHECK-NEXT: mov z1.s, s1
434+
; CHECK-NEXT: ld1rw { z1.s }, p0/z, [x0]
436435
; CHECK-NEXT: lsl x8, x8, #2
437436
; CHECK-NEXT: .LBB13_1: // %l1
438437
; CHECK-NEXT: // =>This Inner Loop Header: Depth=1

0 commit comments

Comments
 (0)