[llvm] [GlobalISel] replace right identity X * -1.0 with fneg(x) (PR #80526)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 01:23:08 PST 2024


================
@@ -6651,3 +6651,10 @@ bool CombinerHelper::matchSelect(MachineInstr &MI, BuildFnTy &MatchInfo) {
 
   return false;
 }
+
+void CombinerHelper::replaceNegOneWithFNeg(MachineInstr &MI) const {
+  Register Dst = MI.getOperand(0).getReg();
+  Register Src = MI.getOperand(1).getReg();
+  Builder.buildFNeg(Dst, Src, MI.getFlags());
+  MI.eraseFromParent();
----------------
arsenm wrote:

Should be able to do this in tablegen, it's just build one instruction 

https://github.com/llvm/llvm-project/pull/80526


More information about the llvm-commits mailing list