[PATCH] D30786: [GlobalISel] LegalizerHelper: Lower (G_FSUB X, Y) to (G_FADD X, (G_FNEG Y))
Volkan Keles via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 11:34:53 PST 2017
volkan created this revision.
Herald added subscribers: igorb, kristof.beyls, rovka, dberris.
No test case as none of the in-tree targets with GlobalISel support has this condition.
https://reviews.llvm.org/D30786
Files:
lib/CodeGen/GlobalISel/LegalizerHelper.cpp
Index: lib/CodeGen/GlobalISel/LegalizerHelper.cpp
===================================================================
--- lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -571,6 +571,20 @@
MI.eraseFromParent();
return Legalized;
}
+ case TargetOpcode::G_FSUB: {
+ // Lower (G_FSUB X, Y) to (G_FADD X, (G_FNEG Y))
+ unsigned Res = MI.getOperand(0).getReg();
+ unsigned LHS = MI.getOperand(1).getReg();
+ unsigned RHS = MI.getOperand(2).getReg();
+ unsigned Neg = MRI.createGenericVirtualRegister(Ty);
+ MIRBuilder.buildInstr(TargetOpcode::G_FNEG).addDef(Neg).addUse(RHS);
+ MIRBuilder.buildInstr(TargetOpcode::G_FADD)
+ .addDef(Res)
+ .addUse(LHS)
+ .addUse(Neg);
+ MI.eraseFromParent();
+ return Legalized;
+ }
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30786.91195.patch
Type: text/x-patch
Size: 828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170309/22f79222/attachment.bin>
More information about the llvm-commits
mailing list