[PATCH] D125600: [VP] Pass fast math flags to VP SDNodes.
Yeting Kuo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 15 05:44:21 PDT 2022
fakepaper56 updated this revision to Diff 429529.
fakepaper56 added a comment.
The update removes the part of vp.fcmp support and using argument of DAG.getNode to pass flags.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125600/new/
https://reviews.llvm.org/D125600
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/RISCV/pass-fast-math-flags-sdnode.ll
Index: llvm/test/CodeGen/RISCV/pass-fast-math-flags-sdnode.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/RISCV/pass-fast-math-flags-sdnode.ll
@@ -0,0 +1,8 @@
+; RUN: llc < %s -mtriple=riscv64 -mattr=+v -debug-only=isel -o /dev/null 2>&1 | FileCheck %s
+declare <vscale x 1 x double> @llvm.vp.fmul.nxv1f64(<vscale x 1 x double> %x, <vscale x 1 x double> %y, <vscale x 1 x i1> %m, i32 %vl)
+
+define <vscale x 1 x double> @foo(<vscale x 1 x double> %x, <vscale x 1 x double> %y, <vscale x 1 x double> %z, <vscale x 1 x i1> %m, i32 %vl) {
+; CHECK: t14: nxv1f64 = vp_fmul nnan ninf nsz arcp contract afn reassoc t2, t4, t8, t13
+ %1 = call fast <vscale x 1 x double> @llvm.vp.fmul.nxv1f64(<vscale x 1 x double> %x, <vscale x 1 x double> %y, <vscale x 1 x i1> %m, i32 %vl)
+ ret <vscale x 1 x double> %1
+}
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -7606,7 +7606,14 @@
switch (Opcode) {
default: {
- SDValue Result = DAG.getNode(Opcode, DL, VTs, OpValues);
+ SDValue Result;
+ if (auto *FPMO = dyn_cast<FPMathOperator>(&VPIntrin)) {
+ SDNodeFlags SDFlags;
+ SDFlags.copyFMF(*FPMO);
+ Result = DAG.getNode(Opcode, DL, ValueVTs[0], OpValues, SDFlags);
+ } else {
+ Result = DAG.getNode(Opcode, DL, VTs, OpValues);
+ }
setValue(&VPIntrin, Result);
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125600.429529.patch
Type: text/x-patch
Size: 1603 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220515/4be5decc/attachment.bin>
More information about the llvm-commits
mailing list