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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7205 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Brian Gaeke 2003-07-18 20:23:43 +00:00
parent 06dabfaed5
commit d461505efd
2 changed files with 12 additions and 6 deletions

View File

@ -980,6 +980,8 @@ void ISel::visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &CI) {
case LLVMIntrinsic::longjmp: case LLVMIntrinsic::longjmp:
BuildMI(X86::CALLpcrel32, 1).addExternalSymbol("abort", true); BuildMI(X86::CALLpcrel32, 1).addExternalSymbol("abort", true);
return;
case LLVMIntrinsic::setjmp: case LLVMIntrinsic::setjmp:
// Setjmp always returns zero... // Setjmp always returns zero...
BuildMI(BB, X86::MOVir32, 1, getReg(CI)).addZImm(0); BuildMI(BB, X86::MOVir32, 1, getReg(CI)).addZImm(0);
@ -1814,9 +1816,10 @@ void ISel::emitCastOperation(MachineBasicBlock *BB,
case cByte: StoreTy = Type::ShortTy; StoreClass = cShort; break; case cByte: StoreTy = Type::ShortTy; StoreClass = cShort; break;
case cShort: StoreTy = Type::IntTy; StoreClass = cInt; break; case cShort: StoreTy = Type::IntTy; StoreClass = cInt; break;
case cInt: StoreTy = Type::LongTy; StoreClass = cLong; break; case cInt: StoreTy = Type::LongTy; StoreClass = cLong; break;
case cLong: // The following treatment of cLong may not be perfectly right,
assert(0 &&"FIXME not implemented: cast FP to unsigned long long"); // but it survives chains of casts of the form
abort(); // double->ulong->double.
case cLong: StoreTy = Type::LongTy; StoreClass = cLong; break;
default: assert(0 && "Unknown store class!"); default: assert(0 && "Unknown store class!");
} }

View File

@ -980,6 +980,8 @@ void ISel::visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &CI) {
case LLVMIntrinsic::longjmp: case LLVMIntrinsic::longjmp:
BuildMI(X86::CALLpcrel32, 1).addExternalSymbol("abort", true); BuildMI(X86::CALLpcrel32, 1).addExternalSymbol("abort", true);
return;
case LLVMIntrinsic::setjmp: case LLVMIntrinsic::setjmp:
// Setjmp always returns zero... // Setjmp always returns zero...
BuildMI(BB, X86::MOVir32, 1, getReg(CI)).addZImm(0); BuildMI(BB, X86::MOVir32, 1, getReg(CI)).addZImm(0);
@ -1814,9 +1816,10 @@ void ISel::emitCastOperation(MachineBasicBlock *BB,
case cByte: StoreTy = Type::ShortTy; StoreClass = cShort; break; case cByte: StoreTy = Type::ShortTy; StoreClass = cShort; break;
case cShort: StoreTy = Type::IntTy; StoreClass = cInt; break; case cShort: StoreTy = Type::IntTy; StoreClass = cInt; break;
case cInt: StoreTy = Type::LongTy; StoreClass = cLong; break; case cInt: StoreTy = Type::LongTy; StoreClass = cLong; break;
case cLong: // The following treatment of cLong may not be perfectly right,
assert(0 &&"FIXME not implemented: cast FP to unsigned long long"); // but it survives chains of casts of the form
abort(); // double->ulong->double.
case cLong: StoreTy = Type::LongTy; StoreClass = cLong; break;
default: assert(0 && "Unknown store class!"); default: assert(0 && "Unknown store class!");
} }