Skip to content

[CIR] fix getTypeSizeInBits with fp80 and fp128 #1058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions clang/lib/CIR/Dialect/IR/CIRTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,10 @@ const llvm::fltSemantics &FP80Type::getFloatSemantics() const {
llvm::TypeSize
FP80Type::getTypeSizeInBits(const mlir::DataLayout &dataLayout,
mlir::DataLayoutEntryListRef params) const {
return llvm::TypeSize::getFixed(16);
// The size of FP80Type should be 16 bytes, or 128 bits. The lower 80 bits
// take part in the value representation and the higher 48 bits are just
// paddings.
return llvm::TypeSize::getFixed(128);
}

uint64_t FP80Type::getABIAlignment(const mlir::DataLayout &dataLayout,
Expand All @@ -770,7 +773,7 @@ const llvm::fltSemantics &FP128Type::getFloatSemantics() const {
llvm::TypeSize
FP128Type::getTypeSizeInBits(const mlir::DataLayout &dataLayout,
mlir::DataLayoutEntryListRef params) const {
return llvm::TypeSize::getFixed(16);
return llvm::TypeSize::getFixed(128);
}

uint64_t FP128Type::getABIAlignment(const mlir::DataLayout &dataLayout,
Expand Down