public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111333] New: Runtime failure for fcmulcph instrinsic Date: Fri, 08 Sep 2023 02:10:15 +0000 [thread overview] Message-ID: <bug-111333-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111333 Bug ID: 111333 Summary: Runtime failure for fcmulcph instrinsic Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: crazylht at gmail dot com Target Milestone: --- cat main.cpp #include <immintrin.h> #include <cstdio> __attribute__((optimize("O0"))) auto func0(_Float16 *a, _Float16 *b, int n, _Float16 *c) { __m512h rA = _mm512_loadu_ph(a); for (int i = 0; i < n; i += 32) { __m512h rB = _mm512_loadu_ph(b + i); _mm512_storeu_ph(c + i, _mm512_fcmul_pch(rB, rA)); } } __attribute__((optimize("O2"))) auto func1(_Float16 *a, _Float16 *b, int n, _Float16 *c) { __m512h rA = _mm512_loadu_ph(a); for (int i = 0; i < n; i += 32) { __m512h rB = _mm512_loadu_ph(b + i); _mm512_storeu_ph(c + i, _mm512_fcmul_pch(rB, rA)); } } int main() { int n = 32; _Float16 a[n], b[n], c[n]; for (int i = 1; i <= n; i++) { a[i - 1] = i & 1 ? -i : i; b[i - 1] = i; } printf("a = %f + %fi \n", (float)a[0], (float)a[1]); printf("b = %f + %fi \n", (float)b[0], (float)b[1]); printf("b * conj(a) = %f + %fi \n\n", (float)(a[0]*b[0] + a[1]*b[1]), (float)(a[0]*b[1] - a[1]*b[0])); func0(a, b, n, c); for (int i = 0; i < n / 32 * 2; i++) { printf("%f ", (float)c[i]); } printf("\n"); func1(a, b, n, c); for (int i = 0; i < n / 32 * 2; i++) { printf("%f ", (float)c[i]); } printf("\n"); return 0; } g++ -march=sapphirerapids main.cpp -o test sde -spr-- ./test a = -1.000000 + 2.000000i b = 1.000000 + 2.000000i b * conj(a) = 3.000000 + -4.000000i 3.000000 -4.000000 3.000000 4.000000
next reply other threads:[~2023-09-08 2:10 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-08 2:10 crazylht at gmail dot com [this message] 2023-09-08 2:12 ` [Bug target/111333] " crazylht at gmail dot com 2023-09-08 2:14 ` crazylht at gmail dot com 2023-09-08 2:17 ` pinskia at gcc dot gnu.org 2023-09-08 2:18 ` pinskia 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-111333-4@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).