[LLVMdev] Complex constant expressions?

Neil Booth neil at daikokuya.co.uk
Tue Jan 22 13:51:22 PST 2008


Talin wrote:-

> On the other hand, writing an interpreter means duplicating a lot of
> the functionality that's already in LLVM. For example, consider just
> the problem of float to int conversions:
> 
>    char B[ (int)3.0 ];
> 
> Generating code for this is relatively simple; Converting
> arbitrary-sized APFloats to arbitrary-sized APInts isn't quite as
> easy.

APFloat::convertToInteger does just this.  Why can't you use it?
 
> Similarly, the mathematical operators directly supported by APFloat
> are only a subset of the math operators supported by the LLVM
> instructions.

Yes, arbitrary math ops are hard if you want to get correctly
rounded results for any rounding mode, which was a goal for APFloat.
But all IEEE754 ops represented.

Neil.



More information about the llvm-dev mailing list