Created attachment 43235 [details] testcase The attached testcase fails on ppc64le with -O2 -mcpu=power8, and passes when -mno-optimize-swaps is used.
Created attachment 43236 [details] proposed patch patch under test
Thanks for chasing this down, Alan! The fix looks good to me.
Author: amodra Date: Thu Jan 25 23:57:18 2018 New Revision: 257070 URL: https://gcc.gnu.org/viewcvs?rev=257070&root=gcc&view=rev Log: PR84033, powerpc64le -moptimize-swaps bad code with vec_vbpermq vbpermq produces its output in bits 48..63 of the target vector reg, so the output cannot be lane swapped. gcc/ PR target/84033 * config/rs6000/rs6000-p8swap.c (rtx_is_swappable_p): Exclude UNSPEC_VBPERMQ. Sort other unspecs. gcc/testsuite/ PR target/84033 * gcc.target/powerpc/swaps-p8-46.c: New. Added: trunk/gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/rs6000/rs6000-p8swap.c trunk/gcc/testsuite/ChangeLog
Author: amodra Date: Mon Jan 29 04:23:00 2018 New Revision: 257135 URL: https://gcc.gnu.org/viewcvs?rev=257135&root=gcc&view=rev Log: PR84033, powerpc64le -moptimize-swaps bad code with vec_vbpermq vbpermq produces its output in bits 48..63 of the target vector reg, so the output cannot be lane swapped. gcc/ PR target/84033 * config/rs6000/rs6000.c (rtx_is_swappable_p): Exclude UNSPEC_VBPERMQ. gcc/testsuite/ PR target/84033 * gcc.target/powerpc/swaps-p8-46.c: New. Backport svn r257070 Added: branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/config/rs6000/rs6000.c branches/gcc-7-branch/gcc/testsuite/ChangeLog
Author: amodra Date: Mon Jan 29 04:31:18 2018 New Revision: 257137 URL: https://gcc.gnu.org/viewcvs?rev=257137&root=gcc&view=rev Log: [PATCH] PR84033, powerpc64le -moptimize-swaps bad code with vec_vbpermq vbpermq produces its output in bits 48..63 of the target vector reg, so the output cannot be lane swapped. gcc/ PR target/84033 * config/rs6000/rs6000.c (rtx_is_swappable_p): Exclude UNSPEC_VBPERMQ. gcc/testsuite/ PR target/84033 * gcc.target/powerpc/swaps-p8-46.c: New. Backport svn r257070 Added: branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/config/rs6000/rs6000.c branches/gcc-6-branch/gcc/testsuite/ChangeLog
Fixed all active branches
Hi Alan, I was not able to read the changelog and understand what are the exact versions that this bug is fixed. How can I read and get this information? I am asking this question because mongodb was hitting this issue[1], and the workaround was disabling optimization[2] during mongodb compilation. That said, we would like to re-enable the optimized compilation for mongodb[3], but we need this GCC fix on the distros first, so, I need to know which GCC version contains this fix and migrating to it prior to the re-enablement of the Mongodb optimization. I understand that this fix didn't make the GCC 8 first release, thus, there was a minor version update on GCC 6, 7 and 8 that contains this fix. Is my understanding correct? Thank you, Breno [1] https://jira.mongodb.org/browse/SERVER-33395 [2] https://bugs.launchpad.net/ubuntu/+source/mongodb/+bug/1758116 [3] https://bugs.launchpad.net/ubuntu/+source/mongodb/+bug/1758118
Hi Breno, the first gcc-8 has not yet been released (current aim is for a release mid April), nor has there been a release from the gcc-7 or gcc-6 branches containing this bug fix. I missed out on gcc-7.3 by a few days. Incidentally, https://gcc.gnu.org/develop.html#timeline is a useful page giving history of gcc releases.