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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 13:43:28 PDT 2024


================
@@ -0,0 +1,37 @@
+; RUN: llc -O1 -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s
+; REQUIRES: powerpc-registered-target
+
+; Test that a negative parameter smaller than 64 bits (e.g., int)
+; is correctly implemented with sign-extension when passed to
+; a floating point libcall.
+
+define double @ldexp_test(ptr %a, ptr %b) {
+; CHECK-LABEL: ldexp_test: # @ldexp_test
+; CHECK: # %bb.0:
+; CHECK: lfd 1, 0(3)
+; CHECK-NEXT: lwa 4, 0(4)
+; CHECK-NEXT: bl ldexp
+; CHECK-NEXT: nop
+	%base = load double, ptr %a
+	%exp = load i32, ptr %b
+	%call = call double @llvm.ldexp.f64.i32(double %base, i32 signext %exp)
+	ret double %call
----------------
nikic wrote:

Replace the tab indentation here with two spaces.

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


More information about the llvm-commits mailing list