Merge pull request #136 from visualfc/vkfloat

ssa: bitcast float => iface.data
This commit is contained in:
xushiwei
2024-05-09 17:45:57 +08:00
committed by GitHub
7 changed files with 292 additions and 8 deletions

View File

@@ -290,6 +290,10 @@ func (p *context) funcOf(fn *ssa.Function) (ret llssa.Function, ftype int) {
ftype = llgoAllocaCStr
case "unreachable":
ftype = llgoUnreachable
case "bitCastTo64F":
ftype = llgoBitCastTo64F
case "bitCastTo32F":
ftype = llgoBitCastTo32F
default:
panic("unknown llgo instruction: " + name)
}
@@ -523,6 +527,10 @@ func (p *context) compileInstrOrValue(b llssa.Builder, iv instrOrValue, asValue
ret = p.allocaCStr(b, args)
case llgoUnreachable: // func unreachable()
b.Unreachable()
case llgoBitCastTo32F:
ret = b.BitCast(p.compileValue(b, args[0]), b.Prog.Type(types.Typ[types.Float32], llssa.InGo))
case llgoBitCastTo64F:
ret = b.BitCast(p.compileValue(b, args[0]), b.Prog.Float64())
default:
panic("todo")
}