[llvm] [SDAG] Honor signed arguments in floating point libcalls (PR #109134)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 00:27:40 PDT 2024


================
@@ -2205,7 +2205,24 @@ void SelectionDAGLegalize::ExpandFPLibCall(SDNode* Node,
     Results.push_back(Tmp.first);
     Results.push_back(Tmp.second);
   } else {
-    SDValue Tmp = ExpandLibCall(LC, Node, false).first;
+    bool IsSignedArgument = false;
+    switch (LC) {
+    case RTLIB::LDEXP_F32:
+    case RTLIB::LDEXP_F64:
+    case RTLIB::LDEXP_F80:
+    case RTLIB::LDEXP_F128:
+    case RTLIB::LDEXP_PPCF128:
+      IsSignedArgument = true;
+      break;
+    case RTLIB::FREXP_F32:
+    case RTLIB::FREXP_F64:
+    case RTLIB::FREXP_F80:
+    case RTLIB::FREXP_F128:
+    case RTLIB::FREXP_PPCF128:
+      IsSignedArgument = true;
+      break;
----------------
nikic wrote:

There's a test for it in llvm/test/CodeGen/PowerPC/negintfplibcall.ll. Though now that I look at it more closely, why do we need to handle frexp here? It only has a floating-point arg, not an integer arg like ldexp.

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


More information about the llvm-commits mailing list