ssa: fix bitcast for float32

This commit is contained in:
visualfc
2024-12-24 10:02:30 +08:00
parent 6dd4ec160d
commit 3741a28d94
3 changed files with 211 additions and 1 deletions

View File

@@ -126,7 +126,11 @@ func (b Builder) MakeInterface(tinter Type, x Expr) (ret Expr) {
u = llvm.CreateIntCast(b.impl, ximpl, tu.ll)
case abi.BitCast:
tu := prog.Uintptr()
u = llvm.CreateBitCast(b.impl, ximpl, tu.ll)
if b.Prog.td.TypeAllocSize(typ.ll) < b.Prog.td.TypeAllocSize(tu.ll) {
u = llvm.CreateBitCast(b.impl, ximpl, prog.Uint32().ll)
} else {
u = llvm.CreateBitCast(b.impl, ximpl, tu.ll)
}
default:
panic("todo")
}