This patch adds the missing PTA_POPCNT and PTA_LZCNT with the PTA_ABM
bitmask definition for the bdver1, btver1, and lujiazui architectures
in the i386 architecture configuration file.

Although these two features were not present in the original definition,
their absence does not affect the functionality of these architectures
because the POPCNT and LZCNT bits are set when ABM is enabled in the
ix86_option_override_internal function. However, including them in these
definitions improves consistency and clarity. This issue was discovered
while writing a script to extract these bitmasks from the i386.h file
referenced in [1].

Additionally, the PTA_YONGFENG bitmask appears incorrect as it includes
PTA_LZCNT while already inheriting PTA_ABM from PTA_LUJIAZUI. This seems
to be a typo and should be corrected.

[1] https://github.com/cyyself/x86-pta

gcc/ChangeLog:

        * config/i386/i386.h: Add missing PTA_POPCNT, PTA_LZCNT with PTA_ABM

Signed-off-by: Yangyu Chen <c...@cyyself.name>
---
Changes in v3:
- Added PTA_LZCNT to PTA_BTVER1 and PTA_LUJIAZUI definitions as well.
- Remove PTA_LZCNT from PTA_YONGFENG definition since it is already included 
via PTA_LUJIAZUI.

v2: 
https://patchwork.sourceware.org/project/gcc/patch/tencent_15d739eae1aec5d486f43736f23909466...@qq.com/

Changes in v2:
- Added PTA_LZCNT to the patch as well.

v1: 
https://patchwork.sourceware.org/project/gcc/patch/tencent_f08f827bda658e18b8e0319021b88d6d7...@qq.com/
---
 gcc/config/i386/i386.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 791f3b9e133..8d1d1f5add3 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2479,7 +2479,8 @@ constexpr wide_int_bitmask PTA_DIAMONDRAPIDS = 
PTA_GRANITERAPIDS_D
 constexpr wide_int_bitmask PTA_BDVER1 = PTA_64BIT | PTA_MMX | PTA_SSE
   | PTA_SSE2 | PTA_SSE3 | PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3
   | PTA_SSE4_1 | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_FMA4
-  | PTA_XOP | PTA_LWP | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE;
+  | PTA_XOP | PTA_LWP | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE | PTA_LZCNT
+  | PTA_POPCNT;
 constexpr wide_int_bitmask PTA_BDVER2 = PTA_BDVER1 | PTA_BMI | PTA_TBM
   | PTA_F16C | PTA_FMA;
 constexpr wide_int_bitmask PTA_BDVER3 = PTA_BDVER2 | PTA_XSAVEOPT
@@ -2507,7 +2508,7 @@ constexpr wide_int_bitmask PTA_ZNVER5 = PTA_ZNVER4 | 
PTA_AVXVNNI
 
 constexpr wide_int_bitmask PTA_BTVER1 = PTA_64BIT | PTA_MMX | PTA_SSE
   | PTA_SSE2 | PTA_SSE3 | PTA_SSSE3 | PTA_SSE4A | PTA_ABM | PTA_CX16
-  | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE;
+  | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE | PTA_LZCNT | PTA_POPCNT;
 constexpr wide_int_bitmask PTA_BTVER2 = PTA_BTVER1 | PTA_SSE4_1 | PTA_SSE4_2
   | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_BMI | PTA_F16C | PTA_MOVBE
   | PTA_XSAVEOPT;
@@ -2516,9 +2517,9 @@ constexpr wide_int_bitmask PTA_LUJIAZUI = PTA_64BIT | 
PTA_MMX | PTA_SSE
   | PTA_SSE2 | PTA_SSE3 | PTA_CX16 | PTA_ABM | PTA_SSSE3 | PTA_SSE4_1
   | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_BMI | PTA_BMI2 | PTA_PRFCHW
   | PTA_FXSR | PTA_XSAVE | PTA_XSAVEOPT | PTA_FSGSBASE | PTA_RDRND | PTA_MOVBE
-  | PTA_ADX | PTA_RDSEED | PTA_POPCNT;
+  | PTA_ADX | PTA_RDSEED | PTA_LZCNT | PTA_POPCNT;
 constexpr wide_int_bitmask PTA_YONGFENG = PTA_LUJIAZUI | PTA_AVX | PTA_AVX2
-  | PTA_F16C | PTA_FMA | PTA_SHA | PTA_LZCNT;
+  | PTA_F16C | PTA_FMA | PTA_SHA;
 
 #ifndef GENERATOR_FILE
 
-- 
2.49.0

Reply via email to