[Bug target/116574] GCC generates redundant moves in simple vector addition

2024-09-02 Thread bernardo at bernardosulzbach dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116574 --- Comment #11 from Bernardo Sulzbach --- (In reply to Andrew Pinski from comment #2) > -Os does not vectorize the code. > But that might be on purpose ... Then one last question: is that because -Os makes GCC not even consider it, even if in

[Bug target/116574] GCC generates redundant moves in simple vector addition

2024-09-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116574 --- Comment #10 from Andrew Pinski --- Also on many processors a move is free.

[Bug target/116574] GCC generates redundant moves in simple vector addition

2024-09-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116574 --- Comment #9 from Andrew Pinski --- (In reply to Bernardo Sulzbach from comment #8) > But that this happens even in simple cases such as this one is known and > already tracked? Kinda of but since it is only shown up so far in micro-benchmark

[Bug target/116574] GCC generates redundant moves in simple vector addition

2024-09-02 Thread bernardo at bernardosulzbach dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116574 --- Comment #8 from Bernardo Sulzbach --- (In reply to Andrew Pinski from comment #7) > >with -O2/-O3. Is there a reason for `addps xmm1, xmm0` and moving instead of > >`addps xmm0, xmm1`? > > Register allocation is not always the best when it

[Bug target/116574] GCC generates redundant moves in simple vector addition

2024-09-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116574 --- Comment #7 from Andrew Pinski --- >with -O2/-O3. Is there a reason for `addps xmm1, xmm0` and moving instead of >`addps xmm0, xmm1`? Register allocation is not always the best when it comes to argument and returns. Also the trunk with -O2

[Bug target/116574] GCC generates redundant moves in simple vector addition

2024-09-02 Thread bernardo at bernardosulzbach dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116574 --- Comment #6 from Bernardo Sulzbach --- (In reply to Bernardo Sulzbach from comment #5) > (In reply to Andrew Pinski from comment #1) > > -fno-trapping-math removes the zeroing of the top half of the registers. > > I see. I tried passing that

[Bug target/116574] GCC generates redundant moves in simple vector addition

2024-09-02 Thread bernardo at bernardosulzbach dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116574 --- Comment #5 from Bernardo Sulzbach --- (In reply to Andrew Pinski from comment #1) > -fno-trapping-math removes the zeroing of the top half of the registers. I see. I tried passing that and got add(std::array, std::array): movap

[Bug target/116574] GCC generates redundant moves in simple vector addition

2024-09-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116574 --- Comment #4 from Andrew Pinski --- Note clang's code generation with -ftrapping-math is so much worse than GCCs: movaps %xmm1, %xmm2 addss %xmm0, %xmm2 shufps $85, %xmm0, %xmm0 shufps $85, %xmm1, %xmm1

[Bug target/116574] GCC generates redundant moves in simple vector addition

2024-09-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116574 Andrew Pinski changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED

[Bug target/116574] GCC generates redundant moves in simple vector addition

2024-09-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116574 Andrew Pinski changed: What|Removed |Added Resolution|INVALID |--- Status|RESOLVED

[Bug target/116574] GCC generates redundant moves in simple vector addition

2024-09-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116574 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---