public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/104188] gcc omitting AVX-512 broadcast instruction Date: Sat, 22 Jan 2022 18:50:05 +0000 [thread overview] Message-ID: <bug-104188-4-LAXoG8iJNU@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104188-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104188 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I came up with: #include <x86intrin.h> union U { float m[4][4]; __m128 r[4]; __m512 s; }; __attribute__((noipa)) void foo (union U *x, union U *a, union U *b) { __m512 c = _mm512_loadu_ps (&a->s); __m512 d = _mm512_broadcast_f32x4 (b->r[0]); __m512 e = _mm512_broadcast_f32x4 (b->r[1]); __m512 f = _mm512_broadcast_f32x4 (b->r[2]); __m512 g = _mm512_broadcast_f32x4 (b->r[3]); __m512 h = _mm512_mul_ps (_mm512_permute_ps (c, 0x00), d); h = _mm512_fmadd_ps (_mm512_permute_ps (c, 0x55), e, h); h = _mm512_fmadd_ps (_mm512_permute_ps (c, 0xaa), f, h); h = _mm512_fmadd_ps (_mm512_permute_ps (c, 0xff), g, h); _mm512_storeu_ps (&x->s, h); } int main () { union U a = { .m = { { 1.0f, 2.0f, 3.0f, 4.0f }, { 5.0f, 6.0f, 7.0f, 8.0f }, { 9.0f, 10.0f, 11.0f, 12.0f }, { 13.0f, 14.0f, 15.0f, 16.0f } } }; union U b = { .m = { { 17.0f, 18.0f, 19.0f, 20.0f }, { 21.0f, 22.0f, 23.0f, 24.0f }, { 25.0f, 26.0f, 27.0f, 28.0f }, { 29.0f, 30.0f, 31.0f, 32.0f } } }; union U c; foo (&c, &a, &b); if (c.m[0][0] != 250.0f || c.m[0][1] != 260.0f || c.m[0][2] != 270.0f || c.m[0][3] != 280.0f) __builtin_abort (); if (c.m[1][0] != 618.0f || c.m[1][1] != 644.0f || c.m[1][2] != 670.0f || c.m[1][3] != 696.0f) __builtin_abort (); if (c.m[2][0] != 986.0f || c.m[2][1] != 1028.0f || c.m[2][2] != 1070.0f || c.m[2][3] != 1112.0f) __builtin_abort (); if (c.m[3][0] != 1354.0f || c.m[3][1] != 1412.0f || c.m[3][2] != 1470.0f || c.m[3][3] != 1528.0f) __builtin_abort (); return 0; }
next prev parent reply other threads:[~2022-01-22 18:50 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-22 17:03 [Bug target/104188] New: " kvr000 at gmail dot com 2022-01-22 17:40 ` [Bug target/104188] " pinskia at gcc dot gnu.org 2022-01-22 17:49 ` kvr000 at gmail dot com 2022-01-22 17:55 ` jakub at gcc dot gnu.org 2022-01-22 18:36 ` kvr000 at gmail dot com 2022-01-22 18:50 ` jakub at gcc dot gnu.org [this message] 2022-01-22 19:00 ` [Bug target/104188] [11/12 Regression] " jakub at gcc dot gnu.org 2022-01-22 19:23 ` hjl.tools at gmail dot com 2022-01-22 19:51 ` hjl.tools at gmail dot com 2022-01-22 22:25 ` hjl.tools at gmail dot com 2022-01-22 23:29 ` kvr000 at gmail dot com 2022-01-23 18:37 ` hjl.tools at gmail dot com 2022-01-24 0:43 ` cvs-commit at gcc dot gnu.org 2022-01-24 0:47 ` cvs-commit at gcc dot gnu.org 2022-01-24 0:48 ` hjl.tools at gmail dot com 2022-01-26 11:00 ` cvs-commit at gcc dot gnu.org 2022-01-26 11:07 ` cvs-commit at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-104188-4-LAXoG8iJNU@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).