1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

GlobalISel: Add buildFMA to MachineIRBuilder

llvm-svn: 360888
This commit is contained in:
Matt Arsenault 2019-05-16 13:04:20 +00:00
parent 5fe7f3e187
commit 082b98432d
2 changed files with 9 additions and 0 deletions

View File

@ -1268,6 +1268,12 @@ public:
return buildInstr(TargetOpcode::G_FSUB, {Dst}, {Src0, Src1});
}
/// Build and insert \p Res = G_FMA \p Op0, \p Op1, \p Op2
MachineInstrBuilder buildFMA(const DstOp &Dst, const SrcOp &Src0,
const SrcOp &Src1, const SrcOp &Src2) {
return buildInstr(TargetOpcode::G_FMA, {Dst}, {Src0, Src1, Src2});
}
/// Build and insert \p Res = G_FNEG \p Op0
MachineInstrBuilder buildFNeg(const DstOp &Dst, const SrcOp &Src0) {
return buildInstr(TargetOpcode::G_FNEG, {Dst}, {Src0});

View File

@ -127,6 +127,7 @@ TEST_F(GISelMITest, TestBuildFPInsts) {
B.buildFAdd(S64, Copies[0], Copies[1]);
B.buildFSub(S64, Copies[0], Copies[1]);
B.buildFMA(S64, Copies[0], Copies[1], Copies[2]);
B.buildFNeg(S64, Copies[0]);
B.buildFAbs(S64, Copies[0]);
B.buildFCopysign(S64, Copies[0], Copies[1]);
@ -134,8 +135,10 @@ TEST_F(GISelMITest, TestBuildFPInsts) {
auto CheckStr = R"(
; CHECK: [[COPY0:%[0-9]+]]:_(s64) = COPY $x0
; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
; CHECK: [[FADD:%[0-9]+]]:_(s64) = G_FADD [[COPY0]]:_, [[COPY1]]:_
; CHECK: [[FSUB:%[0-9]+]]:_(s64) = G_FSUB [[COPY0]]:_, [[COPY1]]:_
; CHECK: [[FMA:%[0-9]+]]:_(s64) = G_FMA [[COPY0]]:_, [[COPY1]]:_, [[COPY2]]:_
; CHECK: [[FNEG:%[0-9]+]]:_(s64) = G_FNEG [[COPY0]]:_
; CHECK: [[FABS:%[0-9]+]]:_(s64) = G_FABS [[COPY0]]:_
; CHECK: [[FCOPYSIGN:%[0-9]+]]:_(s64) = G_FCOPYSIGN [[COPY0]]:_, [[COPY1]]:_