This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Allow _mm256_clmulepi64_epi128 even for just -mvcplmulqdq -mavx (PR target/88541)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 18 Dec 2018 21:53:28 +0100
- Subject: [PATCH] Allow _mm256_clmulepi64_epi128 even for just -mvcplmulqdq -mavx (PR target/88541)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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