[llvm-commits] [llvm] r162728 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/Mips/uitofp.ll

Akira Hatanaka ahatanaka at mips.com
Mon Aug 27 19:12:42 PDT 2012


Author: ahatanak
Date: Mon Aug 27 21:12:42 2012
New Revision: 162728

URL: http://llvm.org/viewvc/llvm-project?rev=162728&view=rev
Log:
Fix bug 13532.

In SelectionDAGLegalize::ExpandLegalINT_TO_FP, expand INT_TO_FP nodes without
using any f64 operations if f64 is not a legal type.

Patch by Stefan Kristiansson. 

Added:
    llvm/trunk/test/CodeGen/Mips/uitofp.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=162728&r1=162727&r2=162728&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Aug 27 21:12:42 2012
@@ -2042,7 +2042,7 @@
                                                    SDValue Op0,
                                                    EVT DestVT,
                                                    DebugLoc dl) {
-  if (Op0.getValueType() == MVT::i32) {
+  if (Op0.getValueType() == MVT::i32 && TLI.isTypeLegal(MVT::f64)) {
     // simple 32-bit [signed|unsigned] integer to float/double expansion
 
     // Get the stack frame index of a 8 byte buffer.

Added: llvm/trunk/test/CodeGen/Mips/uitofp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/uitofp.ll?rev=162728&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/uitofp.ll (added)
+++ llvm/trunk/test/CodeGen/Mips/uitofp.ll Mon Aug 27 21:12:42 2012
@@ -0,0 +1,12 @@
+; RUN: llc -march=mips -mattr=+single-float < %s
+
+define void @f0() nounwind {
+entry:
+  %b = alloca i32, align 4
+  %a = alloca float, align 4
+  store volatile i32 1, i32* %b, align 4
+  %0 = load volatile i32* %b, align 4
+  %conv = uitofp i32 %0 to float
+  store float %conv, float* %a, align 4
+  ret void
+}





More information about the llvm-commits mailing list