public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Allow _mm256_clmulepi64_epi128 even for just -mvcplmulqdq -mavx (PR target/88541)
Date: Tue, 18 Dec 2018 20:53:00 -0000	[thread overview]
Message-ID: <20181218205328.GU23305@tucnak> (raw)

Hi!

As mentioned in the PR, there is a VEX encoded vpclmulqdq instruction
with ymm arguments that needs VPCLMULQDQ ISA, and then EVEX encoded
vpclmulqdq with zmm arguments that needs VPCLMULQDQ + AVX512F ISAs and
vpclmulqdq with xmm or ymm arguments that needs VPCLMULQDQ + AVX512VL ISAs.

So, _mm256_clmulepi64_epi128 can be done just with AVX (so that VEX encoded
instructions are handled) + VPCLMULQDQ ISAs.
The corresponding builtin matches this:
BDESC (OPTION_MASK_ISA_VPCLMULQDQ | OPTION_MASK_ISA_AVX, CODE_FOR_vpclmulqdq_v4di, "__builtin_ia32_vpclmulqdq_v4di", IX86_BUILTIN_VPCLMULQDQ4, UNKNOWN, (int) V4DI_FTYPE_V4DI_V4DI_INT)

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2018-12-18  Jakub Jelinek  <jakub@redhat.com>

	PR target/88541
	* config/i386/vpclmulqdqintrin.h (_mm256_clmulepi64_epi128): Enable
	for -mavx -mvpclmulqdq rather than just for -mavx512vl -mvpclmulqdq.

	* gcc.target/i386/avx-vpclmulqdq-1.c: New test.

--- gcc/config/i386/vpclmulqdqintrin.h.jj	2018-06-13 10:05:54.775128332 +0200
+++ gcc/config/i386/vpclmulqdqintrin.h	2018-12-18 20:09:37.693666571 +0100
@@ -53,9 +53,9 @@ _mm512_clmulepi64_epi128 (__m512i __A, _
 #pragma GCC pop_options
 #endif /* __DISABLE_VPCLMULQDQF__ */
 
-#if !defined(__VPCLMULQDQ__) || !defined(__AVX512VL__)
+#if !defined(__VPCLMULQDQ__) || !defined(__AVX__)
 #pragma GCC push_options
-#pragma GCC target("vpclmulqdq,avx512vl")
+#pragma GCC target("vpclmulqdq,avx")
 #define __DISABLE_VPCLMULQDQ__
 #endif /* __VPCLMULQDQ__ */
 
@@ -78,6 +78,4 @@ _mm256_clmulepi64_epi128 (__m256i __A, _
 #pragma GCC pop_options
 #endif /* __DISABLE_VPCLMULQDQ__ */
 
-
 #endif /* _VPCLMULQDQINTRIN_H_INCLUDED */
-
--- gcc/testsuite/gcc.target/i386/avx-vpclmulqdq-1.c.jj	2018-12-18 20:13:28.683960294 +0100
+++ gcc/testsuite/gcc.target/i386/avx-vpclmulqdq-1.c	2018-12-18 20:12:41.140723131 +0100
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx -mvpclmulqdq" } */
+
+#include <x86intrin.h>
+
+__m256i
+foo (__m256i x, __m256i y)
+{
+  return _mm256_clmulepi64_epi128 (x, y, 0);
+}

	Jakub

             reply	other threads:[~2018-12-18 20:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 20:53 Jakub Jelinek [this message]
2018-12-19  8:23 ` Uros Bizjak

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=20181218205328.GU23305@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ubizjak@gmail.com \
    /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: link
Be 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).