Bitcast all the bits of a floating point value, not just one. The zero
authorReid Spencer <rspencer@reidspencer.com>
Fri, 4 May 2007 03:37:38 +0000 (03:37 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Fri, 4 May 2007 03:37:38 +0000 (03:37 +0000)
extension is needed because the constructor for the Destination value
causes the APInt to have a bit width of 1.
Patch by Guoling Han.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36733 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/Interpreter/Execution.cpp

index ddfaffd87da578ab5b007a66522830234f26fe77..4d6c0db10540412be066eade101fb29a0ff17402 100644 (file)
@@ -1087,8 +1087,10 @@ GenericValue Interpreter::executeBitCastInst(Value *SrcVal, const Type *DstTy,
     Dest.PointerVal = Src.PointerVal;
   } else if (DstTy->isInteger()) {
     if (SrcTy == Type::FloatTy) {
+      Dest.IntVal.zext(sizeof(Src.FloatVal) * 8);
       Dest.IntVal.floatToBits(Src.FloatVal);
     } else if (SrcTy == Type::DoubleTy) {
+      Dest.IntVal.zext(sizeof(Src.DoubleVal) * 8);
       Dest.IntVal.doubleToBits(Src.DoubleVal);
     } else if (SrcTy->isInteger()) {
       Dest.IntVal = Src.IntVal;