Pruning DAG patterns to facilitate expression folding involving SUB instructions
during addressing mode based complex pattern matching.
Fixes Bug 37939 - Missed pattern B+(-C)*A
Alive Link:
https://rise4fun.com/Alive/OcH
Differential D49966
[X86] Performing DAG pruning before selection of LEA instructions. jbhateja on Jul 29 2018, 10:46 AM. Authored by
Details
Pruning DAG patterns to facilitate expression folding involving SUB instructions Fixes Bug 37939 - Missed pattern B+(-C)*A Alive Link:
Diff Detail
Event Timeline
This comment was removed by xbolva00.
Comment Actions Also we should avoid cases like and use add instruction like gcc: Comment Actions Does this handle also e.g. int foo(int i,int c) { c *= 2*i+1; return c; } ? We miss lea here.. Comment Actions Do you have a god bolt link? I’m seeing an lea for that except on Intel CPUs that have a slow 3 src lea instruction. On those CPUs we issue an LEA, ADD, IMUL Comment Actions That behavior is intentional. The X86FixupLEAs.cpp pass changed from the gcc/icc code to LEA+ADD because "lea eax, [rdi+1+rdi]" is a 3 cycle instruction with 1 cycle reciprocal throughput on all Intel Core CPUs from Sandy Bridge to present. "lea eax, [rdi+rdi]" is 1 cycle latency with 0.5 reciprocal throughput. And "add eax, 1" is 1 cycle with a reciprocal throughput of 0.33 or 0.25. So the 2 instructions should be better performing than the single LEA. Though it is bad that -Os doesn't disable this optimization. |
I suspect this comment should be at the call site.
The comment *here* should ideally explain what the *function* does, more specifically.