Skip to content

Commit 1362f8b

Browse files
brads55tstellar
authored andcommitted
[AArch64][SVE] Fix selection failure caused by fp/int convert using non-Neon types
Fixes: #53679 Differential Revision: https://reviews.llvm.org/D119428 (cherry picked from commit c53ad72)
1 parent 88f8980 commit 1362f8b

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13676,8 +13676,10 @@ static SDValue performFpToIntCombine(SDNode *N, SelectionDAG &DAG,
1367613676
return SDValue();
1367713677

1367813678
SDValue Op = N->getOperand(0);
13679-
if (!Op.getValueType().isVector() || !Op.getValueType().isSimple() ||
13680-
Op.getOpcode() != ISD::FMUL)
13679+
if (!Op.getValueType().isSimple() || Op.getOpcode() != ISD::FMUL)
13680+
return SDValue();
13681+
13682+
if (!Op.getValueType().is64BitVector() && !Op.getValueType().is128BitVector())
1368113683
return SDValue();
1368213684

1368313685
SDValue ConstVec = Op->getOperand(1);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc < %s | FileCheck %s
3+
4+
target triple = "aarch64-unknown-linux-gnu"
5+
6+
; Ensure we don't crash when trying to combine fp<->int conversions
7+
define void @fp_convert_combine_crash(<8 x float> *%a, <8 x i32> *%b) #0 {
8+
; CHECK-LABEL: fp_convert_combine_crash:
9+
; CHECK: // %bb.0:
10+
; CHECK-NEXT: ptrue p0.s
11+
; CHECK-NEXT: fmov z1.s, #8.00000000
12+
; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0]
13+
; CHECK-NEXT: fmul z0.s, z0.s, z1.s
14+
; CHECK-NEXT: fcvtzs z0.s, p0/m, z0.s
15+
; CHECK-NEXT: st1w { z0.s }, p0, [x1]
16+
; CHECK-NEXT: ret
17+
%f = load <8 x float>, <8 x float>* %a
18+
%mul.i = fmul <8 x float> %f, <float 8.000000e+00, float 8.000000e+00, float 8.000000e+00, float 8.000000e+00,
19+
float 8.000000e+00, float 8.000000e+00, float 8.000000e+00, float 8.000000e+00>
20+
%vcvt.i = fptosi <8 x float> %mul.i to <8 x i32>
21+
store <8 x i32> %vcvt.i, <8 x i32>* %b
22+
ret void
23+
}
24+
25+
attributes #0 = { vscale_range(2,2) "target-features"="+sve" }

0 commit comments

Comments
 (0)