[llvm] [AMDGPU] Implement IR expansion for frem instruction (PR #130988)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 13 00:31:38 PDT 2025


================
@@ -595,7 +944,38 @@ static void scalarize(Instruction *I, SmallVectorImpl<Instruction *> &Replace) {
   I->eraseFromParent();
 }
 
-static bool runImpl(Function &F, const TargetLowering &TLI) {
+// This covers all floating point types; more than we need here.
+// TODO Move somewhere else for general use?
+/// Return the Libcall for a frem instruction of
+/// type \p Ty.
+static RTLIB::Libcall fremToLibcall(Type *Ty) {
+  assert(Ty->isFloatingPointTy());
+  if (Ty->isFloatTy() || Ty->is16bitFPTy())
----------------
arsenm wrote:

```suggestion
  if (Ty->isFloatTy())
```

Promotion logic should be decoupled from the libcall, this isn't exactly matching the libcall 

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


More information about the llvm-commits mailing list