Testing on a Power9 simulator revealed an error in the code emitted for the *altivec_vpermr_<mode>_internal define_insn pattern. Two of the operands of the vpermr operand had been emitted in wrong order. This patch corrects the error.
Testing of this patch on a Power9 simulator demonstrates that this patch corrects all of the following tests, which had been failing on the simulator prior to this patch: g++ tests > PASS: c-c++-common/torture/vector-subscript-1.c -O1 execution test > > PASS: c-c++-common/torture/vector-subscript-1.c -O2 execution test > > PASS: c-c++-common/torture/vector-subscript-1.c -Os execution test > > PASS: c-c++-common/torture/vector-subscript-1.c -O2 -flto > -fno-use-linker-plugin -flto-partition=none execution test > PASS: c-c++-common/torture/vector-subscript-1.c -O2 -flto > -fuse-linker-plugin -fno-fat-lto-objects execution test > PASS: c-c++-common/torture/vector-subscript-2.c -O1 execution test > > PASS: c-c++-common/torture/vector-subscript-2.c -O2 execution test > > PASS: c-c++-common/torture/vector-subscript-2.c -O3 -fomit-frame-pointer > -funroll-loops -fpeel-loops -ftracer -finline-functions execution test > PASS: c-c++-common/torture/vector-subscript-2.c -O3 -g execution test > > PASS: c-c++-common/torture/vector-subscript-2.c -Os execution test > > PASS: c-c++-common/torture/vector-subscript-2.c -O2 -flto > -fno-use-linker-plugin -flto-partition=none execution test > > PASS: c-c++-common/torture/vector-subscript-2.c -O2 -flto > -fuse-linker-plugin -fno-fat-lto-objects execution test > > PASS: g++.dg/torture/vshuf-v16qi.C -O0 execution test > > PASS: g++.dg/torture/vshuf-v16qi.C -O1 execution test > PASS: g++.dg/torture/vshuf-v16qi.C -O2 execution test > PASS: g++.dg/torture/vshuf-v16qi.C -Os execution test > PASS: g++.dg/torture/vshuf-v16qi.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none execution test > PASS: g++.dg/torture/vshuf-v16qi.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects execution test > PASS: g++.dg/torture/vshuf-v2di.C -O0 execution test > PASS: g++.dg/torture/vshuf-v2di.C -O1 execution test > PASS: g++.dg/torture/vshuf-v2di.C -O2 execution test > PASS: g++.dg/torture/vshuf-v2di.C -Os execution test > PASS: g++.dg/torture/vshuf-v2di.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none execution test > PASS: g++.dg/torture/vshuf-v2di.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects execution test > PASS: g++.dg/torture/vshuf-v4si.C -O0 execution test > PASS: g++.dg/torture/vshuf-v4si.C -O1 execution test > PASS: g++.dg/torture/vshuf-v4si.C -O2 execution test > PASS: g++.dg/torture/vshuf-v4si.C -Os execution test > PASS: g++.dg/torture/vshuf-v4si.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none execution test > PASS: g++.dg/torture/vshuf-v4si.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects execution test > PASS: g++.dg/torture/vshuf-v8hi.C -O0 execution test > PASS: g++.dg/torture/vshuf-v8hi.C -O1 execution test > PASS: g++.dg/torture/vshuf-v8hi.C -O2 execution test > PASS: g++.dg/torture/vshuf-v8hi.C -Os execution test > PASS: g++.dg/torture/vshuf-v8hi.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none execution test > PASS: g++.dg/torture/vshuf-v8hi.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects execution test > PASS: g++.old-deja/g++.other/sizeof4.C -std=c++14 (test for errors, line 34) > PASS: g++.old-deja/g++.other/sizeof4.C -std=c++14 (test for excess errors) gcc tests: > PASS: gcc.c-torture/execute/scal-to-vec1.c -O0 execution test > PASS: gcc.c-torture/execute/scal-to-vec1.c -O1 execution test > PASS: gcc.c-torture/execute/scal-to-vec1.c -O2 execution test > PASS: gcc.c-torture/execute/scal-to-vec1.c -O3 -fomit-frame-pointer > -funroll-loops -fpeel-loops -ftracer -finline-functions execution test > PASS: gcc.c-torture/execute/scal-to-vec1.c -O3 -g execution test > PASS: gcc.c-torture/execute/scal-to-vec1.c -Os execution test > PASS: gcc.c-torture/execute/scal-to-vec1.c -O2 -flto -fno-use-linker-plugin > -flto-partition=none execution test > PASS: gcc.c-torture/execute/scal-to-vec1.c -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects execution test > PASS: c-c++-common/torture/vector-subscript-1.c -O1 execution test > PASS: c-c++-common/torture/vector-subscript-1.c -O2 execution test > PASS: c-c++-common/torture/vector-subscript-1.c -Os execution test > PASS: c-c++-common/torture/vector-subscript-1.c -O2 -flto > -fno-use-linker-plugin -flto-partition=none execution test > PASS: c-c++-common/torture/vector-subscript-1.c -O2 -flto > -fuse-linker-plugin -fno-fat-lto-objects execution test > PASS: c-c++-common/torture/vector-subscript-2.c -O1 execution test > PASS: c-c++-common/torture/vector-subscript-2.c -O2 execution test > PASS: c-c++-common/torture/vector-subscript-2.c -O3 -fomit-frame-pointer > -funroll-loops -fpeel-loops -ftracer -finline-functions execution test > PASS: c-c++-common/torture/vector-subscript-2.c -O3 -g execution test > PASS: c-c++-common/torture/vector-subscript-2.c -Os execution test > PASS: c-c++-common/torture/vector-subscript-2.c -O2 -flto > -fno-use-linker-plugin -flto-partition=none execution test > PASS: c-c++-common/torture/vector-subscript-2.c -O2 -flto > -fuse-linker-plugin -fno-fat-lto-objects execution test The patch has bootstrapped and regression tested on powerpc64le-unknown-linux with no regressions. Is this ok for the trunk and for backporting to GCC6 after burn-in on the trunk? Thanks. gcc/ChangeLog: 2016-06-29 Kelvin Nilsen <kel...@gcc.gnu.org> * config/rs6000/altivec.md (*altivec_vpermr_<mode>_internal): Exchange the order of the second and third operands in the vpermr instruction tmeplate. Index: gcc/config/rs6000/altivec.md =================================================================== --- gcc/config/rs6000/altivec.md (revision 237799) +++ gcc/config/rs6000/altivec.md (working copy) @@ -2072,7 +2072,7 @@ UNSPEC_VPERMR))] "TARGET_P9_VECTOR" "@ - vpermr %0,%1,%2,%3 + vpermr %0,%2,%1,%3 xxpermr %x0,%x2,%x3" [(set_attr "type" "vecperm") (set_attr "length" "4")])