https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92819
Bug ID: 92819 Summary: [10 Regression] Worse code generated on avx2 due to simplify_vector_constructor Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org CC: asolokha at gmx dot com, jakub at gcc dot gnu.org, marxin at gcc dot gnu.org, rguenth at gcc dot gnu.org Depends on: 92803 Target Milestone: --- Host: x86_64-linux-gnu +++ This bug was initially created as a clone of Bug #92803 +++ For /* { dg-do compile } */ /* { dg-options "-O2 -mavx2" } */ typedef double v4df __attribute__((vector_size (32))); typedef double v2df __attribute__((vector_size (16))); typedef short v16hi __attribute__((vector_size (32))); typedef short v8hi __attribute__((vector_size (16))); v2df foo (v4df x, double *p) { return (v2df) { x[1], *p }; } v2df bar (v4df x, double *p) { return (v2df) { x[0], *p }; } v2df baz (v2df x, double *p) { return (v2df) { x[1], *p }; } v2df qux (v2df x, double *p) { return (v2df) { x[0], *p }; } v2df corge (v4df x, double *p, v2df y) { return (v2df) { x[3], *p }; } generated code differences of gcc 9 and current trunk are: @@ -6,8 +6,9 @@ foo: .LFB0: .cfi_startproc - vunpckhpd %xmm0, %xmm0, %xmm0 - vmovhpd (%rdi), %xmm0, %xmm0 + vbroadcastsd (%rdi), %ymm1 + vinsertf128 $1, %xmm1, %ymm0, %ymm0 + vpermpd $77, %ymm0, %ymm0 ret .cfi_endproc .LFE0: @@ -18,7 +19,9 @@ foo: bar: .LFB1: .cfi_startproc - vmovhpd (%rdi), %xmm0, %xmm0 + vbroadcastsd (%rdi), %ymm1 + vinsertf128 $1, %xmm1, %ymm0, %ymm0 + vpermpd $76, %ymm0, %ymm0 ret .cfi_endproc .LFE1: @@ -29,8 +32,8 @@ bar: baz: .LFB2: .cfi_startproc - vunpckhpd %xmm0, %xmm0, %xmm0 - vmovhpd (%rdi), %xmm0, %xmm0 + vmovddup (%rdi), %xmm1 + vunpckhpd %xmm1, %xmm0, %xmm0 ret .cfi_endproc .LFE2: @@ -41,7 +44,9 @@ baz: qux: .LFB3: .cfi_startproc - vmovhpd (%rdi), %xmm0, %xmm0 + vmovapd %xmm0, %xmm1 + vmovddup (%rdi), %xmm0 + vmovsd %xmm1, %xmm0, %xmm0 ret .cfi_endproc .LFE3: @@ -52,12 +57,13 @@ qux: corge: .LFB4: .cfi_startproc - vextractf128 $0x1, %ymm0, %xmm0 - vunpckhpd %xmm0, %xmm0, %xmm0 - vmovhpd (%rdi), %xmm0, %xmm0 + vbroadcastsd (%rdi), %ymm2 + vpermpd $78, %ymm0, %ymm1 + vperm2f128 $2, %ymm2, %ymm0, %ymm0 + vshufpd $11, %ymm0, %ymm1, %ymm0 ret .cfi_endproc .LFE4: .size corge, .-corge - .ident "GCC: (GNU) 9.2.1 20191121" + .ident "GCC: (GNU) 10.0.0 20191205 (experimental)" .section .note.GNU-stack,"",@progbits None of it is shorter, only baz is the same size as before. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92803 [Bug 92803] [10 Regression] error: type mismatch in 'vec_perm_expr' since r278764