[llvm-commits] Patch: Floating point optimizations for SimplifyInstruction
Duncan Sands
baldrick at free.fr
Sun Dec 9 00:53:56 PST 2012
Hi Michael,
>>> Let's enumerate the outcomes, where e.g. the (o, i) pattern means the sign
of the outer and inner zero constants. The resulting sign should be the same as
x's for the transformation to be valid:
>>> x | (o, i) | Result
>>> + | (+, +) | +
>>> - | (+, +) | + <--- bad!
>>> + | (+, -) | +
>>> - | (+, -) | + <--- bad!
>>> + | (-, +) | - <--- bad!
>>> - | (-, +) | -
>>> + | (-, -) | +
>>> - | (-, -) | -
>>>
>>> So, from this it seems that the below is the correct pattern:
>>> fsub(anyZero, fsub(negZero, X)) ==> X
>>
>> Does GCC do the transform in exactly these cases too?
>>
>
> No idea. I can look into it, but I don't have any experience with GCC.
I can try to write a C testcase and see what the GCC optimizers do with it.
Ciao, Duncan.
More information about the llvm-commits
mailing list