[llvm-commits] PATCH: Teach constant folding about SSE[2] conversion intrinsics

Frits van Bommel fvbommel at gmail.com
Mon Jan 10 02:29:11 PST 2011


On Mon, Jan 10, 2011 at 10:18 AM, Chandler Carruth <chandlerc at google.com> wrote:
> This resolves the majority of what I've been able to spot actually happening
> due to my last README entry. I've been able to think of at least one more
> really trivial fold that we could do: (cvtsd2si (sitofp x)) -> x. However, I
> don't yet have any benchmark that shows this is useful.

If anyone does want to implement that, remember to be careful with
rounding if the full precision of the integer doesn't fit in the
float. (i.e. it's not *completely* trivial)
You could probably use APFloat to return a "rounded" x though.

> One question, where is the best place to test this? I couldn't find a direct
> test for ConstantFolding.

test/Transforms/ConstProp/, either in call.ll or a new target-specific
call-<target>.ll file for target-specific intrinsics.



More information about the llvm-commits mailing list