Open
Description
simple reproducer:
from llvmlite import ir
fp = ir.DoubleType()
#fp = ir.FloatType()
#fp = ir.HalfType()
fnty = ir.FunctionType(fp, ())
module = ir.Module(name=__file__)
func = ir.Function(module, fnty, name="fpadd")
block = func.append_basic_block(name="entry")
builder = ir.IRBuilder(block)
x = fp("Inf")
builder.ret(x)
print(module)
The above only works with DoubleType. Both FloatType and HalfType produce the following error:
return struct.unpack('f', struct.pack('f', value))[0]
struct.error: required argument is not a float
Using float("Inf")
instead of just "Inf"
works around the problem:
target triple = "unknown-unknown-unknown"
target datalayout = ""
define float @"fpadd"()
{
entry:
ret float 0x7ff0000000000000
}
Activity