Skip to content

Commit 9d4307a

Browse files
committed
[AArch64] Avoid NEON fixed-point SCVTF in Streaming-SVE mode.
NEON fixed-point SCVTF instruction is not available in Streaming-SVE mode. There is no equivalent SVE instruction, so we simply expand to a regular FDIV operation.
1 parent ad09d20 commit 9d4307a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17912,7 +17912,7 @@ static SDValue performFpToIntCombine(SDNode *N, SelectionDAG &DAG,
1791217912
static SDValue performFDivCombine(SDNode *N, SelectionDAG &DAG,
1791317913
TargetLowering::DAGCombinerInfo &DCI,
1791417914
const AArch64Subtarget *Subtarget) {
17915-
if (!Subtarget->hasNEON())
17915+
if (!Subtarget->isNeonAvailable())
1791617916
return SDValue();
1791717917

1791817918
SDValue Op = N->getOperand(0);

llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-fp-arith.ll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,12 @@ define <2 x float> @fdiv_v2f32(<2 x float> %op1, <2 x float> %op2) {
219219
define <2 x float> @fdiv_v232_pow2(<2 x i32> %in) {
220220
; CHECK-LABEL: fdiv_v232_pow2:
221221
; CHECK: // %bb.0: // %entry
222-
; CHECK-NEXT: scvtf v0.2s, v0.2s, #4
222+
; CHECK-NEXT: ptrue p0.s, vl2
223+
; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
224+
; CHECK-NEXT: fmov z1.s, #16.00000000
225+
; CHECK-NEXT: scvtf z0.s, p0/m, z0.s
226+
; CHECK-NEXT: fdiv z0.s, p0/m, z0.s, z1.s
227+
; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
223228
; CHECK-NEXT: ret
224229
entry:
225230
%vcvt.i = sitofp <2 x i32> %in to <2 x float>

0 commit comments

Comments
 (0)