[PATCH] Fix makeLibCall arguments for SoftenFloatRes_FRINT function

Strahinja Petrovic strahinja.petrovic at rt-rk.com
Fri Feb 20 08:18:19 PST 2015


Hi t.p.northover, petarj,

The isSigned argument of makeLibCall function was hard-coded to false (unsigned). This caused zero extension on MIPS64 soft float for optimization levels -O1 and more. MIPS64 requires soft float arguments to be sign extended. This should not affect other architectures. As the result "MultiSource/Applications/oggenc/" test is fixed.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7791

Files:
  lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
  test/CodeGen/Mips/mips64rintfsf.ll

Index: lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
+++ lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
@@ -497,7 +497,7 @@
                                            RTLIB::RINT_F80,
                                            RTLIB::RINT_F128,
                                            RTLIB::RINT_PPCF128),
-                         NVT, &Op, 1, false, SDLoc(N)).first;
+                         NVT, &Op, 1, true, SDLoc(N)).first;
 }
 
 SDValue DAGTypeLegalizer::SoftenFloatRes_FROUND(SDNode *N) {
Index: test/CodeGen/Mips/mips64rintfsf.ll
===================================================================
--- test/CodeGen/Mips/mips64rintfsf.ll
+++ test/CodeGen/Mips/mips64rintfsf.ll
@@ -0,0 +1,23 @@
+; RUN: llc -march=mips64 -mcpu=mips64r2 -soft-float -O2 < %s | FileCheck %s
+
+
+define void @foo() #0 {
+entry:
+  %in = alloca float, align 4
+  %out = alloca float, align 4
+  store volatile float 0xBFD59E1380000000, float* %in, align 4
+  %in.0.in.0. = load volatile float* %in, align 4
+  %rintf = tail call float @rintf(float %in.0.in.0.) #1
+  store volatile float %rintf, float* %out, align 4
+  ret void
+
+; CHECK:            rintf
+; CHECK-NOT:        dsll
+; CHECK-NOT:        dsrl
+}
+
+declare float @rintf(float)
+
+attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" }
+attributes #1 = { nounwind readnone "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" }
+

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7791.20406.patch
Type: text/x-patch
Size: 1827 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150220/048bda7b/attachment.bin>


More information about the llvm-commits mailing list