[Bug middle-end/115551] [missed optimization] "c1 << (a + c2)" not optimized into "(c1 << c2) << a"

2024-06-20 Thread burnus at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115551 --- Comment #6 from Tobias Burnus --- Crossref: New Bug 11 is for the range analysis to deduce from 'x << a' that 'a' must be nonnegative.

[Bug middle-end/115551] [missed optimization] "c1 << (a + c2)" not optimized into "(c1 << c2) << a"

2024-06-20 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115551 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #5

[Bug middle-end/115551] [missed optimization] "c1 << (a + c2)" not optimized into "(c1 << c2) << a"

2024-06-20 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115551 --- Comment #4 from Richard Biener --- all same for right-shifts (both logical and arithmetic). Note that 1 << (a + 5) might be cheaper than (1<<5) << a due to constraints on immediates but for GIMPLE the latter is definitely more canonical.

[Bug middle-end/115551] [missed optimization] "c1 << (a + c2)" not optimized into "(c1 << c2) << a"

2024-06-20 Thread burnus at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115551 --- Comment #3 from Tobias Burnus --- As we want to have a >= 0, I tried to convey it differently for the example in comment 0: (a) __attribute__((assume(ch >= 0))); (b) 'unsigned ch' (instead of 'int ch') but it didn't help. Thus, it looks a

[Bug middle-end/115551] [missed optimization] "c1 << (a + c2)" not optimized into "(c1 << c2) << a"

2024-06-19 Thread burnus at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115551 --- Comment #2 from Tobias Burnus --- > Thus we need some range info to do this optimization. Good point. It seems as if for c1 << (c2 * a + c3), C requires a >= -c3/c2 (read as float division; c2 ≠ 0) And the suggested optimization requires

[Bug middle-end/115551] [missed optimization] "c1 << (a + c2)" not optimized into "(c1 << c2) << a"

2024-06-19 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115551 Xi Ruoyao changed: What|Removed |Added CC||xry111 at gcc dot gnu.org --- Comment #1 fr