[llvm] [X86][GlobalISel] Enable SINCOS with libcall mapping (PR #142438)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 06:06:21 PDT 2025


================
@@ -1275,6 +1324,19 @@ LegalizerHelper::libcall(MachineInstr &MI, LostDebugLocObserver &LocObserver) {
       return Status;
     break;
   }
+  case TargetOpcode::G_FSINCOS: {
+    LLT LLTy = MRI.getType(MI.getOperand(0).getReg());
+    unsigned Size = LLTy.getSizeInBits();
+    Type *HLTy = getFloatTypeForLLT(Ctx, LLTy);
+    if (!HLTy || (Size != 32 && Size != 64 && Size != 80 && Size != 128)) {
+      LLVM_DEBUG(dbgs() << "No libcall available for type " << LLTy << ".\n");
+      return UnableToLegalize;
+    }
+    auto Status = simpleLibcallSinCos(MI, MIRBuilder, Size, HLTy, LocObserver);
+    if (Status != Legalized)
+      return Status;
+    break;
----------------
arsenm wrote:

```suggestion
    return simpleLibcallSinCos(MI, MIRBuilder, Size, HLTy, LocObserver);
```

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


More information about the llvm-commits mailing list