[llvm-commits] Patch: Floating point optimizations for SimplifyInstruction

Michael Ilseman milseman at apple.com
Tue Dec 11 16:20:28 PST 2012


Since I've addressed the main issues, and there's other work that could make use of this (e.g. Shuxin's InstCombine work), I'll commit this and continue with post-commit review.


On Dec 10, 2012, at 3:57 PM, Michael Ilseman <milseman at apple.com> wrote:

> Ok, here's a new slew of revised patches:
> 
> <0001-Remove-FIXMEs-surrounding-Constant-Data-Vectors-inst.patch>
> <0002-Pattern-matchers-for-floating-point-values.patch>
> <0003-Added-a-slew-of-SimplifyInstruction-floating-point-o.patch>
> <0004-Remove-redunant-optimizations-from-InstCombine-inste.patch>
> <0005-Have-SimplifyBinOp-call-the-new-FAdd-FSub-FMul-helpe.patch>
> 
> On Dec 9, 2012, at 12:53 AM, Duncan Sands <baldrick at free.fr> wrote:
> 
>> 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