[LLVMdev] Instruction Implementation
Tim Northover
t.p.northover at gmail.com
Tue Apr 2 05:53:03 PDT 2013
Hi,
> i ve uploaded .ll file
Is that the C file that's at the end of your message? To produce a .ll
file, you give clang the "-emit-llvm" option (and probably "-S").
Anyway, what I see in the C you posted is that Clang is using constant
folding to avoid doing any of the operations you've requested. A
better C file test would be:
float foo(float d) {
return d - ceilf(d);
}
For me LLVM does use the FCEIL node in that case (it doesn't know what
d is so can't optimise your operations away). I'm still a little
worried that ceilf isn't declared, but LLVM seems to do the "right"
thing anyway.
I'm also a little worried that your pattern has fadd, but your C
source has a subtraction.
> how can i include this attribute "readonly" so i can see if changes the
> generated assembly?
The best documentation is probably the "Function Attributes" section
in http://llvm.org/docs/LangRef.html, but it doesn't look like you've
been using LLVM IR so that may not be immediately useful.
Cheers.
Tim.
More information about the llvm-dev
mailing list