[llvm] [GISel] Add more FP opcodes to CSE (PR #123624)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 02:38:11 PST 2025


================
@@ -75,6 +75,36 @@ TEST_F(AArch64GISelMITest, TestCSE) {
   auto MIBUnmerge2 = CSEB.buildUnmerge({s32, s32}, Copies[0]);
   EXPECT_TRUE(&*MIBUnmerge == &*MIBUnmerge2);
 
+  // Check G_FADD
+  auto MIBFAdd = CSEB.buildFAdd(s32, Copies[0], Copies[1]);
+  auto MIBFAdd2 = CSEB.buildFAdd(s32, Copies[0], Copies[1]);
+  EXPECT_TRUE(&*MIBFAdd == &*MIBFAdd2);
+
+  // Check G_FSUB
+  auto MIBFSub = CSEB.buildFSub(s32, Copies[0], Copies[1]);
+  auto MIBFSub2 = CSEB.buildFSub(s32, Copies[0], Copies[1]);
+  EXPECT_TRUE(&*MIBFSub == &*MIBFSub2);
+
+  // Check G_FMUL
+  auto MIBFMul = CSEB.buildFMul(s32, Copies[0], Copies[1]);
+  auto MIBFMul2 = CSEB.buildFMul(s32, Copies[0], Copies[1]);
+  EXPECT_TRUE(&*MIBFMul == &*MIBFMul2);
+
+  // Check G_FDIV
+  auto MIBFDiv = CSEB.buildFDiv(s32, Copies[0], Copies[1]);
+  auto MIBFDiv2 = CSEB.buildFDiv(s32, Copies[0], Copies[1]);
+  EXPECT_TRUE(&*MIBFDiv == &*MIBFDiv2);
+
+  // // Check G_FNEG
+  // auto MIBFNeg = CSEB.buildFNeg(s32, Copies[0]);
+  // auto MIBFNeg2 = CSEB.buildFNeg(s32, Copies[0]);
+  // EXPECT_TRUE(&*MIBFNeg == &*MIBFNeg2);
----------------
arsenm wrote:

No, but don't handle it here if it doesn't work 

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


More information about the llvm-commits mailing list