[PATCH] D85249: [SelectionDAG][SVE] Support scalable vectors in getConstantFP()
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 4 14:23:40 PDT 2020
efriedma created this revision.
efriedma added reviewers: sdesmalen, paulwalker-arm.
Herald added subscribers: psnobl, hiraditya, tschuett.
Herald added a project: LLVM.
efriedma requested review of this revision.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D85249
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/AArch64/sve-vector-splat.ll
Index: llvm/test/CodeGen/AArch64/sve-vector-splat.ll
===================================================================
--- llvm/test/CodeGen/AArch64/sve-vector-splat.ll
+++ llvm/test/CodeGen/AArch64/sve-vector-splat.ll
@@ -355,5 +355,22 @@
ret <vscale x 2 x double> %2
}
+define <vscale x 4 x i32> @splat_nxv4i32_fold(<vscale x 4 x i32> %x) {
+; CHECK-LABEL: splat_nxv4i32_fold:
+; CHECK: mov z0.s, #0
+; CHECK-NEXT: ret
+ %r = sub <vscale x 4 x i32> %x, %x
+ ret <vscale x 4 x i32> %r
+}
+
+
+define <vscale x 4 x float> @splat_nxv4f32_fold(<vscale x 4 x float> %x) {
+; CHECK-LABEL: splat_nxv4f32_fold:
+; CHECK: mov z0.s, #0
+; CHECK-NEXT: ret
+ %r = fsub nnan <vscale x 4 x float> %x, %x
+ ret <vscale x 4 x float> %r
+}
+
; +bf16 is required for the bfloat version.
attributes #0 = { "target-features"="+sve,+bf16" }
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1380,7 +1380,9 @@
}
SDValue Result(N, 0);
- if (VT.isVector())
+ if (VT.isScalableVector())
+ Result = getSplatVector(VT, DL, Result);
+ else if (VT.isVector())
Result = getSplatBuildVector(VT, DL, Result);
NewSDValueDbgMsg(Result, "Creating fp constant: ", this);
return Result;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85249.283032.patch
Type: text/x-patch
Size: 1369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200804/26c8b977/attachment.bin>
More information about the llvm-commits
mailing list