mirrored from git://gcc.gnu.org/git/gcc.git
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable AVX-512 VPOPCNTD/VPOPCNTQ instructions.
gcc/ * common/config/i386/i386-common.c (OPTION_MASK_ISA_AVX512VPOPCNTDQ_SET, OPTION_MASK_ISA_AVX512VPOPCNTDQ_UNSET): New. * config.gcc: Add avx512vpopcntdqintrin.h. * config/i386/avx512vpopcntdqintrin.h: New. * config/i386/cpuid.h (bit_AVX512VPOPCNTDQ): New. * config/i386/i386-builtin-types.def: Add new types. * config/i386/i386-builtin.def (__builtin_ia32_vpopcountd_v16si, __builtin_ia32_vpopcountd_v16si_mask, __builtin_ia32_vpopcountq_v8di, __builtin_ia32_vpopcountq_v8di_mask): New. * config/i386/i386-c.c (ix86_target_macros_internal): Define __AVX512VPOPCNTDQ__. * config/i386/i386.c (ix86_target_string): Add -mavx512vpopcntdq. (PTA_AVX512VPOPCNTDQ): Define. * config/i386/i386.h (TARGET_AVX512VPOPCNTDQ, TARGET_AVX512VPOPCNTDQ_P): Define. * config/i386/i386.opt: Add mavx512vpopcntdq. * config/i386/immintrin.h: Include avx512vpopcntdqintrin.h. * config/i386/sse.md (define_insn "vpopcount<mode><mask_name>"): New. libgcc/ * config/i386/cpuinfo.h (processor_features): Add FEATURE_AVX512VPOPCNTDQ. * config/i386/cpuinfo.c (get_available_features): Habdle new feature. gcc/testsuite/ * g++.dg/other/i386-2.C: Add -mavx512vpopcntdq. * g++.dg/other/i386-3.C: Ditto. * gcc.target/i386/sse-12.c: Ditto. * gcc.target/i386/sse-13.c: Ditto. * gcc.target/i386/sse-22.c: Ditto. * gcc.target/i386/sse-23.c: Ditto. * gcc.target/i386/builtin_target.c: Handle new option. * gcc.target/i386/funcspec-56.inc: Test new attributes. * gcc.target/i386/avx512vpopcntdq-vpopcntd.c: New test. * gcc.target/i386/avx512vpopcntdq-vpopcntq.c: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244263 138bc75d-0d04-0410-961f-82ee72b054a4
- Loading branch information
kyukhin
committed
Jan 10, 2017
1 parent
d813c3c
commit e0aa57d
Showing
27 changed files
with
257 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
2017-01-10 Andrew Senkevich <[email protected]> | ||
|
||
* common/config/i386/i386-common.c (OPTION_MASK_ISA_AVX512VPOPCNTDQ_SET, | ||
OPTION_MASK_ISA_AVX512VPOPCNTDQ_UNSET): New. | ||
* config.gcc: Add avx512vpopcntdqintrin.h. | ||
* config/i386/avx512vpopcntdqintrin.h: New. | ||
* config/i386/cpuid.h (bit_AVX512VPOPCNTDQ): New. | ||
* config/i386/i386-builtin-types.def: Add new types. | ||
* config/i386/i386-builtin.def (__builtin_ia32_vpopcountd_v16si, | ||
__builtin_ia32_vpopcountd_v16si_mask, __builtin_ia32_vpopcountq_v8di, | ||
__builtin_ia32_vpopcountq_v8di_mask): New. | ||
* config/i386/i386-c.c (ix86_target_macros_internal): Define | ||
__AVX512VPOPCNTDQ__. | ||
* config/i386/i386.c (ix86_target_string): Add -mavx512vpopcntdq. | ||
(PTA_AVX512VPOPCNTDQ): Define. | ||
* config/i386/i386.h (TARGET_AVX512VPOPCNTDQ, | ||
TARGET_AVX512VPOPCNTDQ_P): Define. | ||
* config/i386/i386.opt: Add mavx512vpopcntdq. | ||
* config/i386/immintrin.h: Include avx512vpopcntdqintrin.h. | ||
* config/i386/sse.md (define_insn "vpopcount<mode><mask_name>"): New. | ||
|
||
2017-01-01 Jan Hubicka <[email protected]> | ||
|
||
PR middle-end/77484 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* Copyright (C) 2017 Free Software Foundation, Inc. | ||
This file is part of GCC. | ||
GCC is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3, or (at your option) | ||
any later version. | ||
GCC is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
Under Section 7 of GPL version 3, you are granted additional | ||
permissions described in the GCC Runtime Library Exception, version | ||
3.1, as published by the Free Software Foundation. | ||
You should have received a copy of the GNU General Public License and | ||
a copy of the GCC Runtime Library Exception along with this program; | ||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | ||
<http://www.gnu.org/licenses/>. */ | ||
|
||
#if !defined _IMMINTRIN_H_INCLUDED | ||
# error "Never use <avx512vpopcntdqintrin.h> directly; include <x86intrin.h> instead." | ||
#endif | ||
|
||
#ifndef _AVX512VPOPCNTDQINTRIN_H_INCLUDED | ||
#define _AVX512VPOPCNTDQINTRIN_H_INCLUDED | ||
|
||
#ifndef __AVX512VPOPCNTDQ__ | ||
#pragma GCC push_options | ||
#pragma GCC target("avx512vpopcntdq") | ||
#define __DISABLE_AVX512VPOPCNTDQ__ | ||
#endif /* __AVX512VPOPCNTDQ__ */ | ||
|
||
extern __inline __m512i | ||
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
_mm512_popcnt_epi32 (__m512i __A) | ||
{ | ||
return (__m512i) __builtin_ia32_vpopcountd_v16si ((__v16si) __A); | ||
} | ||
|
||
extern __inline __m512i | ||
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
_mm512_mask_popcnt_epi32 (__m512i __A, __mmask16 __U, __m512i __B) | ||
{ | ||
return (__m512i) __builtin_ia32_vpopcountd_v16si_mask ((__v16si) __A, | ||
(__v16si) __B, | ||
(__mmask16) __U); | ||
} | ||
|
||
extern __inline __m512i | ||
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
_mm512_maskz_popcnt_epi32 (__mmask16 __U, __m512i __A) | ||
{ | ||
return (__m512i) __builtin_ia32_vpopcountd_v16si_mask ((__v16si) __A, | ||
(__v16si) | ||
_mm512_setzero_si512 (), | ||
(__mmask16) __U); | ||
} | ||
|
||
extern __inline __m512i | ||
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
_mm512_popcnt_epi64 (__m512i __A) | ||
{ | ||
return (__m512i) __builtin_ia32_vpopcountq_v8di ((__v8di) __A); | ||
} | ||
|
||
extern __inline __m512i | ||
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
_mm512_mask_popcnt_epi64 (__m512i __A, __mmask8 __U, __m512i __B) | ||
{ | ||
return (__m512i) __builtin_ia32_vpopcountq_v8di_mask ((__v8di) __A, | ||
(__v8di) __B, | ||
(__mmask8) __U); | ||
} | ||
|
||
extern __inline __m512i | ||
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) | ||
_mm512_maskz_popcnt_epi64 (__mmask8 __U, __m512i __A) | ||
{ | ||
return (__m512i) __builtin_ia32_vpopcountq_v8di_mask ((__v8di) __A, | ||
(__v8di) | ||
_mm512_setzero_si512 (), | ||
(__mmask8) __U); | ||
} | ||
|
||
#ifdef __DISABLE_AVX512VPOPCNTDQ__ | ||
#undef __DISABLE_AVX512VPOPCNTDQ__ | ||
#pragma GCC pop_options | ||
#endif /* __DISABLE_AVX512VPOPCNTDQ__ */ | ||
|
||
#endif /* _AVX512VPOPCNTDQINTRIN_H_INCLUDED */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
2017-01-10 Andrew Senkevich <[email protected]> | ||
|
||
* g++.dg/other/i386-2.C: Add -mavx512vpopcntdq. | ||
* g++.dg/other/i386-3.C: Ditto. | ||
* gcc.target/i386/sse-12.c: Ditto. | ||
* gcc.target/i386/sse-13.c: Ditto. | ||
* gcc.target/i386/sse-22.c: Ditto. | ||
* gcc.target/i386/sse-23.c: Ditto. | ||
* gcc.target/i386/builtin_target.c: Handle new option. | ||
* gcc.target/i386/funcspec-56.inc: Test new attributes. | ||
* gcc.target/i386/avx512vpopcntdq-vpopcntd.c: New test. | ||
* gcc.target/i386/avx512vpopcntdq-vpopcntq.c: Ditto. | ||
|
||
2017-01-09 Martin Sebor <[email protected]> | ||
|
||
PR testsuite/79036 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ | ||
/* { dg-options "-O -fkeep-inline-functions -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx5124fmaps -mavx5124vnniw -mclwb -mmwaitx -mclzero -mpku" } */ | ||
/* { dg-options "-O -fkeep-inline-functions -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku" } */ | ||
|
||
/* Test that {,x,e,p,t,s,w,a,b,i}mmintrin.h, mm3dnow.h, fma4intrin.h, | ||
xopintrin.h, abmintrin.h, bmiintrin.h, tbmintrin.h, lwpintrin.h, | ||
popcntintrin.h, fmaintrin.h, pkuintrin.h, avx5124fmapsintrin.h, | ||
avx5124vnniwintrin.h and mm_malloc.h are usable with | ||
-O -fkeep-inline-functions. */ | ||
avx5124vnniwintrin.h, avx512vpopcntdqintrin.h and mm_malloc.h are | ||
usable with -O -fkeep-inline-functions. */ | ||
|
||
#include <x86intrin.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* { dg-do compile } */ | ||
/* { dg-options "-O2 -mavx512vpopcntdq" } */ | ||
/* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ | ||
/* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ | ||
/* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ | ||
|
||
#include <x86intrin.h> | ||
|
||
extern __m512i z, z1; | ||
|
||
int foo () | ||
{ | ||
__mmask16 msk; | ||
__m512i c = _mm512_popcnt_epi32 (z); | ||
asm volatile ("" : "+v" (c)); | ||
c = _mm512_mask_popcnt_epi32 (z, msk, z1); | ||
asm volatile ("" : "+v" (c)); | ||
c = _mm512_maskz_popcnt_epi32 (msk, z); | ||
asm volatile ("" : "+v" (c)); | ||
} |
Oops, something went wrong.