[PATCH] D134561: AtomicExpand: Support cmpxchg expansion for small FP types

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 07:13:14 PDT 2022


jyknight added a comment.

Can you add a simple test to llvm/test/Transforms/AtomicExpand/SPARC/partword.ll for fadd, since that's where the other "generic" tests of this code live.



================
Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:820
+  case AtomicRMWInst::FMax: {
+    Value *Loaded_Extract = extractMaskedValue(Builder, Loaded, PMV);
+    Value *NewVal = buildAtomicRMWValue(Op, Builder, Loaded_Extract, Inc);
----------------
Same code as section above. Merge the two and update comment.


================
Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:847-852
+  Value *ValOperand = AI->getValOperand();
+  ValOperand = Builder.CreateBitCast(ValOperand, PMV.IntValueType);
+
   Value *ValOperand_Shifted =
-      Builder.CreateShl(Builder.CreateZExt(AI->getValOperand(), PMV.WordType),
+      Builder.CreateShl(Builder.CreateZExt(ValOperand, PMV.WordType),
                         PMV.ShiftAmt, "ValOperand_Shifted");
----------------
This shifted value isn't actually used for the existing min/max/umin/umax -- nor the new fadd/fsub/fmin/fmax support.

Perhaps we should just avoid creating it when it's unneeded?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134561/new/

https://reviews.llvm.org/D134561



More information about the llvm-commits mailing list