Skip to content

Commit 73c5bc8

Browse files
PikachuHyAbcardosolopesLancern
authored
[CIR] fix getTypeSizeInBits with fp80 and fp128 (#1058)
fix #1057 --------- Co-authored-by: Bruno Cardoso Lopes <[email protected]> Co-authored-by: Sirui Mu <[email protected]>
1 parent e57cdb4 commit 73c5bc8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clang/lib/CIR/Dialect/IR/CIRTypes.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,10 @@ const llvm::fltSemantics &FP80Type::getFloatSemantics() const {
749749
llvm::TypeSize
750750
FP80Type::getTypeSizeInBits(const mlir::DataLayout &dataLayout,
751751
mlir::DataLayoutEntryListRef params) const {
752-
return llvm::TypeSize::getFixed(16);
752+
// The size of FP80Type should be 16 bytes, or 128 bits. The lower 80 bits
753+
// take part in the value representation and the higher 48 bits are just
754+
// paddings.
755+
return llvm::TypeSize::getFixed(128);
753756
}
754757

755758
uint64_t FP80Type::getABIAlignment(const mlir::DataLayout &dataLayout,
@@ -770,7 +773,7 @@ const llvm::fltSemantics &FP128Type::getFloatSemantics() const {
770773
llvm::TypeSize
771774
FP128Type::getTypeSizeInBits(const mlir::DataLayout &dataLayout,
772775
mlir::DataLayoutEntryListRef params) const {
773-
return llvm::TypeSize::getFixed(16);
776+
return llvm::TypeSize::getFixed(128);
774777
}
775778

776779
uint64_t FP128Type::getABIAlignment(const mlir::DataLayout &dataLayout,

0 commit comments

Comments
 (0)