I am trying to use llvmcall
and want to map a return value of LLVM type i1
to a Julia Bool
value.
using Base
function isodd(a)
Base.llvmcall("""%mod = srem i64 %0, 2\n%cmp = icmp eq i64 %mod, 1\nret i1 %cmp""", Bool, Tuple{Int64,}, a)
end
print(isodd(13))
The following error is thrown when executing the program:
ERROR: LoadError: Failed to parse LLVM assembly:
llvmcall:5:5: error: value doesn't match function result type 'i8'
ret i1 %cmp
Could anyone help? Is there an alternative type I can use instead of Bool
to match to i1
?