Skip to content

Commit 0a2cdd4

Browse files
committed
[i686 Linux] Support Float80
Darwin and Linux use different size and alignments for “long double” on 32-bit x86. Instead of hardcoding it, we should just ask LLVM about it.
1 parent 073905b commit 0a2cdd4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/IRGen/GenType.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,8 +1557,12 @@ convertPrimitiveBuiltin(IRGenModule &IGM, CanType canTy) {
15571557
return RetTy{ llvm::Type::getFloatTy(ctx), Size(4), Alignment(4) };
15581558
case BuiltinFloatType::IEEE64:
15591559
return RetTy{ llvm::Type::getDoubleTy(ctx), Size(8), Alignment(8) };
1560-
case BuiltinFloatType::IEEE80:
1561-
return RetTy{ llvm::Type::getX86_FP80Ty(ctx), Size(16), Alignment(16) };
1560+
case BuiltinFloatType::IEEE80: {
1561+
llvm::Type *floatTy = llvm::Type::getX86_FP80Ty(ctx);
1562+
uint64_t ByteSize = IGM.DataLayout.getTypeAllocSize(floatTy);
1563+
unsigned align = IGM.DataLayout.getABITypeAlignment(floatTy);
1564+
return RetTy{ floatTy, Size(ByteSize), Alignment(align) };
1565+
}
15621566
case BuiltinFloatType::IEEE128:
15631567
return RetTy{ llvm::Type::getFP128Ty(ctx), Size(16), Alignment(16) };
15641568
case BuiltinFloatType::PPC128:

0 commit comments

Comments
 (0)