https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102868
Bug ID: 102868 Summary: Missed optimization with __builtin_shuffle and zero vector on ppc Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: luoxhu at gcc dot gnu.org Target Milestone: --- Similar to PR94680 and PR100165, PPC currently generates inefficient instructions for below case: typedef float V __attribute__((vector_size(16))); typedef int VI __attribute__((vector_size(16))); V foo (V x) { return __builtin_shuffle (x, (V) { 0, 0, 0, 0 }, (VI) {0, 1, 4, 5}); } foo: .LFB0: .cfi_startproc .LCF0: 0: addis 2,12,.TOC.-.LCF0@ha addi 2,2,.TOC.-.LCF0@l .localentry foo,.-foo addis %r9,%r2,.LC0@toc@ha xxspltib %vs32,0 addi %r9,%r9,.LC0@toc@l lxv %vs33,0(%r9) xxperm %vs34,%vs32,%vs33 blr It will be better to produce: foo: .LFB0: .cfi_startproc vspltisw %v0,0 xxpermdi %vs34,%vs32,%vs34,3