[LLVMdev] Floating-Point Constants in TableGen?

Justin Holewinski justin.holewinski at gmail.com
Wed Sep 28 18:58:38 PDT 2011

Is it possible to represent floating-point constants in TableGen

Let's say I have the following pattern:

def : Pat<(i1 (trunc RegI16:$a)),      (SETPGTu16ri RegI16:$a, 0)>;

Note the zero constant in the result.  Is there a way to represent
floating-point literals in the same way?  Something like...

def : Pat<(i1 (uint_to_fp RegF32:$a)),      (SETPGTf32ri RegF32:$a, (f32

This unfortunately does not work.  Right now I'm getting around this by
using alternate instructions to first convert from an integer immediate,
something like:

def : Pat<(i1 (uint_to_fp RegF32:$a)),      (SETPGTf32ri RegF32:$a,
(MOVf32i32 0))>;

Since my back-end supports floating-point literals in the instructions, I'd
rather not introduce additional instructions needlessly.



Justin Holewinski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110928/4d07952c/attachment.html>

More information about the llvm-dev mailing list