[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Fri Jul 18 15:24:01 PDT 2003

Changes in directory llvm/lib/Target/X86:

InstSelectSimple.cpp updated: 1.113 -> 1.114

Log message:

Please, save your applause^H^H^H^H^H^H^H^Hflames for the end...

Avoid a fall-through in the (stubby) treatment of the longjmp intrinsic
call which causes llc & lli to core-dump.

Add a sort-of treatment of cast double to ulong. I am not really sure
what a user should expect to see upon casting a negative FP value to
unsigned long long. But with what is given here, I was able to write
a program that could cast -123.456 to ulong and back and get -123.0, 
which seems like a step in the right direction.  GCC seems to give you
0. I don't know if I'd consider that useful.

These cases were coming up in GNU coreutils-5.0.

Diffs of the changes:

Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.113 llvm/lib/Target/X86/InstSelectSimple.cpp:1.114
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.113	Thu Jul 17 16:30:06 2003
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Fri Jul 18 15:23:43 2003
@@ -980,6 +980,8 @@
   case LLVMIntrinsic::longjmp:
     BuildMI(X86::CALLpcrel32, 1).addExternalSymbol("abort", true); 
+    return;
   case LLVMIntrinsic::setjmp:
     // Setjmp always returns zero...
     BuildMI(BB, X86::MOVir32, 1, getReg(CI)).addZImm(0);
@@ -1814,9 +1816,10 @@
       case cByte:  StoreTy = Type::ShortTy; StoreClass = cShort; break;
       case cShort: StoreTy = Type::IntTy;   StoreClass = cInt;   break;
       case cInt:   StoreTy = Type::LongTy;  StoreClass = cLong;  break;
-      case cLong:
-        assert(0 &&"FIXME not implemented: cast FP to unsigned long long");
-        abort();
+      // The following treatment of cLong may not be perfectly right,
+      // but it survives chains of casts of the form
+      // double->ulong->double.
+      case cLong:  StoreTy = Type::LongTy;  StoreClass = cLong;  break;
       default: assert(0 && "Unknown store class!");

More information about the llvm-commits mailing list