Skip to content

Commit

Permalink
Support lifting x87 80-bit float constants (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
tetsuo-cpp authored Sep 26, 2023
1 parent 875fcd5 commit c3f8be4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Lifters/ValueLifter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,13 @@ ValueLifterImpl::Lift(llvm::ArrayRef<uint8_t> data, llvm::Type *type,
return llvm::ConstantFP::get(type, val.bitsToDouble());
}

case llvm::Type::X86_FP80TyID: {
const auto size = static_cast<uint64_t>(dl.getTypeStoreSize(type));
auto val = ConsumeBytesAsInt(data, size);
const llvm::APFloat float_val(llvm::APFloat::x87DoubleExtended(), val);
return llvm::ConstantFP::get(type, float_val);
}

default:
LOG(FATAL) << "Cannot initialize constant of unhandled LLVM type "
<< remill::LLVMThingToString(type) << " at " << std::hex
Expand Down

0 comments on commit c3f8be4

Please sign in to comment.