public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: hongtao Liu <liuhongt@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3109] Enable avx512 embedde broadcast for vpternlog. Date: Tue, 24 Aug 2021 10:34:01 +0000 (GMT) [thread overview] Message-ID: <20210824103401.ECE2E3858C2C@sourceware.org> (raw) https://gcc.gnu.org/g:8da9b4f73c2c878b48f45fa2ed47d8a9edd31262 commit r12-3109-g8da9b4f73c2c878b48f45fa2ed47d8a9edd31262 Author: liuhongt <hongtao.liu@intel.com> Date: Tue Aug 24 18:09:33 2021 +0800 Enable avx512 embedde broadcast for vpternlog. gcc/ChangeLog: PR target/101989 * config/i386/sse.md (<avx512>_vternlog<mode><sd_maskz_name>): Enable avx512 embedded broadcast. (*<avx512>_vternlog<mode>_all): Ditto. (<avx512>_vternlog<mode>_mask): Ditto. gcc/testsuite/ChangeLog: PR target/101989 * gcc.target/i386/pr101989-broadcast-1.c: New test. Diff: --- gcc/config/i386/sse.md | 6 ++--- .../gcc.target/i386/pr101989-broadcast-1.c | 31 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 25ca9a5c29c..03fc2df1fb0 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -10034,7 +10034,7 @@ (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "0") (match_operand:VI48_AVX512VL 2 "register_operand" "v") - (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm") + (match_operand:VI48_AVX512VL 3 "bcst_vector_operand" "vmBr") (match_operand:SI 4 "const_0_to_255_operand")] UNSPEC_VTERNLOG))] "TARGET_AVX512F" @@ -10048,7 +10048,7 @@ (unspec:V [(match_operand:V 1 "register_operand" "0") (match_operand:V 2 "register_operand" "v") - (match_operand:V 3 "nonimmediate_operand" "vm") + (match_operand:V 3 "bcst_vector_operand" "vmBr") (match_operand:SI 4 "const_0_to_255_operand")] UNSPEC_VTERNLOG))] "TARGET_AVX512F" @@ -10281,7 +10281,7 @@ (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "0") (match_operand:VI48_AVX512VL 2 "register_operand" "v") - (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm") + (match_operand:VI48_AVX512VL 3 "bcst_vector_operand" "vmBr") (match_operand:SI 4 "const_0_to_255_operand")] UNSPEC_VTERNLOG) (match_dup 1) diff --git a/gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c b/gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c new file mode 100644 index 00000000000..d03d192915f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr101989-broadcast-1.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx512vl" } */ +/* { dg-final { scan-assembler-times "vpternlog" 4 } } */ +/* { dg-final { scan-assembler-times "\\\{1to4\\\}" 4 } } */ +#include<immintrin.h> +extern long long C; +__m256d +copysign2_pd(__m256d from, __m256d to) { + __m256i a = _mm256_castpd_si256(from); + __m256d avx_signbit = _mm256_castsi256_pd(_mm256_slli_epi64(_mm256_cmpeq_epi64(a, a), 63)); + /* (avx_signbit & from) | (~avx_signbit & to) */ + return _mm256_or_pd(_mm256_and_pd(avx_signbit, from), _mm256_andnot_pd(avx_signbit, to)); +} + +__m256i +mask_pternlog (__m256i A, __m256i B, __mmask8 U) +{ + return _mm256_mask_ternarylogic_epi64 (A, U, B, _mm256_set1_epi64x (C) ,202); +} + +__m256i +maskz_pternlog (__m256i A, __m256i B, __mmask8 U) +{ + return _mm256_maskz_ternarylogic_epi64 (U, A, B, _mm256_set1_epi64x (C) ,202); +} + +__m256i +none_pternlog (__m256i A, __m256i B) +{ + return _mm256_ternarylogic_epi64 (A, B, _mm256_set1_epi64x (C) ,202); +}
reply other threads:[~2021-08-24 10:34 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210824103401.ECE2E3858C2C@sourceware.org \ --to=liuhongt@gcc.gnu.org \ --cc=gcc-cvs@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).