public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "luoxhu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/106069] [12/13 Regression] wrong code with -O -fno-tree-forwprop -maltivec on ppc64le Date: Thu, 30 Jun 2022 08:13:48 +0000 [thread overview] Message-ID: <bug-106069-4-2mu9O0a9CW@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106069-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106069 --- Comment #4 from luoxhu at gcc dot gnu.org --- Reduced to: #include <stdio.h> extern "C" void *memcpy(void *, const void *, unsigned long); typedef __attribute__((altivec(vector__))) unsigned native_simd_type; union { native_simd_type V; int R[4]; } store_le_vec; struct S { S() = default; S(unsigned B0) { native_simd_type val{B0}; m_simd = val; } void store_le(unsigned char out[]) { store_le_vec.V = m_simd; unsigned int x0 = store_le_vec.R[0]; memcpy(out, &x0, 1); } static void transpose(S &B0, S B1, S B2, S B3) { native_simd_type T0 = __builtin_vec_mergeh(B0.m_simd, B2.m_simd); native_simd_type T1 = __builtin_vec_mergeh(B1.m_simd, B3.m_simd); native_simd_type T2 = __builtin_vec_mergel(B0.m_simd, B2.m_simd); native_simd_type T3 = __builtin_vec_mergel(B1.m_simd, B3.m_simd); B0 = __builtin_vec_mergeh(T0, T1); B3 = __builtin_vec_mergel(T2, T3); printf ("B0: %x, %x,%x,%x\n", B0.m_simd[0], B0.m_simd[1], B0.m_simd[2], B0.m_simd[3]); } S(native_simd_type x) : m_simd(x) {} native_simd_type m_simd; }; void foo (unsigned char output[], unsigned state[], native_simd_type R0, native_simd_type R1, native_simd_type R2, native_simd_type R3) { S R00; R00.m_simd = R0; S R01; R01.m_simd = R1; S R02; R02.m_simd = R2; S R03; R03.m_simd = R3; S::transpose(R00, R01, R02, R03); R00.store_le(output); } unsigned char res[1]; unsigned main_state[]{1634760805, 60878, 2036477234, 6, 0, 825562964, 1471091955, 1346092787, 506976774, 4197066702, 518848283, 118491664, 0, 0, 0, 0}; int main () { native_simd_type R0 = native_simd_type {0x41fcef98, 0,0,0}; native_simd_type R1 = native_simd_type {0x91648e8b, 0,0,0}; native_simd_type R2 = native_simd_type {0x7dca18c6, 0,0,0}; native_simd_type R3 = native_simd_type {0x61707865, 0,0,0}; foo (res, main_state, R0, R1, R2, R3); if (res[0] != 152) __builtin_abort(); }
next prev parent reply other threads:[~2022-06-30 8:13 UTC|newest] Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-23 23:13 [Bug target/106069] New: " mpolacek at gcc dot gnu.org 2022-06-23 23:15 ` [Bug target/106069] [12/13 Regression] " mpolacek at gcc dot gnu.org 2022-06-23 23:18 ` mpolacek at gcc dot gnu.org 2022-06-24 3:25 ` luoxhu at gcc dot gnu.org 2022-06-24 13:03 ` mpolacek at gcc dot gnu.org 2022-06-30 8:13 ` luoxhu at gcc dot gnu.org [this message] 2022-06-30 8:15 ` luoxhu at gcc dot gnu.org 2022-06-30 17:32 ` segher at gcc dot gnu.org 2022-06-30 17:34 ` segher at gcc dot gnu.org 2022-07-01 1:52 ` luoxhu at gcc dot gnu.org 2022-07-25 15:54 ` rguenth at gcc dot gnu.org 2022-07-25 20:16 ` segher at gcc dot gnu.org 2022-07-25 20:18 ` segher at gcc dot gnu.org 2022-07-26 3:34 ` luoxhu at gcc dot gnu.org 2022-07-26 3:34 ` luoxhu at gcc dot gnu.org 2022-07-26 3:35 ` luoxhu at gcc dot gnu.org 2022-07-26 3:53 ` luoxhu at gcc dot gnu.org 2022-07-26 6:28 ` luoxhu at gcc dot gnu.org 2022-07-29 11:10 ` rguenth at gcc dot gnu.org 2022-07-29 11:21 ` rguenth at gcc dot gnu.org 2022-08-03 6:10 ` yinyuefengyi at gmail dot com 2022-08-03 6:38 ` yinyuefengyi at gmail dot com 2022-08-03 8:06 ` linkw at gcc dot gnu.org 2022-08-03 8:24 ` rguenther at suse dot de 2022-08-03 8:50 ` linkw at gcc dot gnu.org 2022-08-03 8:59 ` rguenth at gcc dot gnu.org 2022-08-03 9:20 ` rsandifo at gcc dot gnu.org 2022-08-03 9:25 ` rsandifo at gcc dot gnu.org 2022-08-03 18:01 ` segher at gcc dot gnu.org 2022-08-03 18:06 ` segher at gcc dot gnu.org 2022-08-04 9:17 ` rsandifo at gcc dot gnu.org 2022-08-04 9:21 ` rearnsha at gcc dot gnu.org 2022-08-04 9:59 ` yinyuefengyi at gmail dot com 2022-08-04 10:01 ` yinyuefengyi at gmail dot com 2023-01-16 18:00 ` jakub at gcc dot gnu.org 2023-03-24 16:16 ` jakub at gcc dot gnu.org 2023-03-24 17:01 ` bergner at gcc dot gnu.org 2023-03-31 2:57 ` yinyuefengyi at gmail dot com 2023-05-08 12:24 ` [Bug target/106069] [12/13/14 " rguenth 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-106069-4-2mu9O0a9CW@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).