From patchwork Fri Sep 27 14:02:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 98064 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0CDAA385DDE7 for ; Fri, 27 Sep 2024 14:03:41 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by sourceware.org (Postfix) with ESMTPS id 484E3385EC12 for ; Fri, 27 Sep 2024 14:03:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 484E3385EC12 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 484E3385EC12 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::230 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727445793; cv=none; b=MGQHWUHse9gLHJUpGFwrjxM/0gAhPsnMuuHotU1z5Ae9DjTt5jMJgSQ4eWV83nD2FJ5qi5G4fL5BG2NPgi0vJTrIgSxaW1F3AqSlodm8OQLDO5EjJmn2Q272WtbXtGzAUXGOnuSPi4eBcGQp50Mc9Fbw1FI9UE/iTAaOxc0OsGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727445793; c=relaxed/simple; bh=a45xFD2IeTuMLOm41SzQyTiQU7nNFo1/O9claacAkpI=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=YQaH/NHzQunbNdfM3IQ9/NhrlZTKodbJifbwVkbab3bDbpn5ltoVezATqvVAzXR1v0MnLo5Bm7HYZWQxSVg9c7oS8bogsRJKP9X/JWEoZspFbjSlozWW0KDDtvP/RhsD+2H0kezTFH/HKgukhWa8n910KpzXPRTpyDeESgmxr+4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2f759688444so20797721fa.1 for ; Fri, 27 Sep 2024 07:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727445787; x=1728050587; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=0J/mG/GaljovYhiAdwuPYh2vm7IvyJfVYSdm9GdvI1g=; b=lt8a8TDWBnMSE7+ctPiRp87L6DnNVrr5pzIZgzZgkR4bbVXuKTfN0S7aqoWgsozHYz N/UO3Sfsr9o/K1M7EXzBV9cI3zHGEKoeklRTMeGrriojC9pfU71oueyND0Wyo6Vp+jtm SQyk0YPAEojUy1l48eEktJOuDtMO/bt8wVl7h5elgESA9HMJKKLfPRWnRXWs3+FbNY/N PCXd8yq9AqApTZea+w/VERdbKWK0ZDVAmGQ7bh4z+FGbcb/Cs1XtYkyIrvz3f58jSWwg Ubs90Mobo+W9j8YdLxEegsMCxM15xS1TRgVtI+TdGcjynZ+zeuouDxTNmFrLXTSEOFTw xjoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727445787; x=1728050587; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=0J/mG/GaljovYhiAdwuPYh2vm7IvyJfVYSdm9GdvI1g=; b=iG2sCfkK2jzSymx8wmgGQKiOyRzUXh7OKcvmiIuWyiktCbQ7kDhlUORu13kroWWJeY 7Oihf6qS03Iyfds9KfsYyFLbJ3OS4h0xGLTpvzT8dub3FAi3opkumOMot+X2MUCJwGGo OGqrnHhknIlBxl3nz9Lgc8vOJoR9c23GU9Ji/jwsnwX8FIVqr734OBIDWEB34jOXZwmT X0gSFWYbrLVq5mUAGAh5Ovqo//LPWqq+/IBG/fQkPKoaWQI+GIWorNVuUizm83xFxYM+ G0DHxKxM9FxfzKSh32F3i7NfwgS0VY3xyEQkoNFN5l+vPHhUXSs49FYl7svGHQ1631yI d43w== X-Gm-Message-State: AOJu0YxNXcDsUg0TFhxC3Ht9LL5jBvJmwD9eWylFEIwwyDfD9yKtK6k1 Pjm6YAuPs+ooI8QOO5eEYt2h0H+tWJSVxtw1uoi6PIOYezWfA9bd6u5XvX8266GHHqC89Vm6z8Z UizwdF5HJOAndzNRUiSZ/PaLerA4wLdy6tb4= X-Google-Smtp-Source: AGHT+IHwcqQyTWl0DbI2AfgxPvFAv1bKcLA8CNB0gPuHjwowzFNWgAR+8ZvfJ0uhsv9DBqqcxeg5EOWdn2MdbF+jiNw= X-Received: by 2002:a05:651c:2229:b0:2ef:2638:48cd with SMTP id 38308e7fff4ca-2f9d417b068mr21466211fa.30.1727445785816; Fri, 27 Sep 2024 07:03:05 -0700 (PDT) MIME-Version: 1.0 From: Uros Bizjak Date: Fri, 27 Sep 2024 16:02:53 +0200 Message-ID: Subject: [committed] i386: Modernize AMD processor types To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, UPPERCASE_50_75 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Use iterative PTA definitions for members of the same AMD processor family. Also, fix a couple of related M_CPU_TYPE/M_CPU_SUBTYPE inconsistencies. No functional changes intended. gcc/ChangeLog: * config/i386/i386.h: Add PTA_BDVER1, PTA_BDVER2, PTA_BDVER3, PTA_BDVER4, PTA_BTVER1 and PTA_BTVER2. * common/config/i386/i386-common.cc (processor_alias_table) <"bdver1">: Use PTA_BDVER1. <"bdver2">: Use PTA_BDVER2. <"bdver3">: Use PTA_BDVER3. <"bdver4">: Use PTA_BDVER4. <"btver1">: Use PTA_BTVER1. Use M_CPU_TYPE (AMD_BTVER1). <"btver2">: Use PTA_BTVER2. <"shanghai>: Use M_CPU_SUBTYPE (AMDFAM10H_SHANGHAI). <"istanbul>: Use M_CPU_SUBTYPE (AMDFAM10H_ISTANBUL). Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Uros. diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc index fb744319b05..3f2fc599009 100644 --- a/gcc/common/config/i386/i386-common.cc +++ b/gcc/common/config/i386/i386-common.cc @@ -2348,34 +2348,16 @@ const pta processor_alias_table[] = | PTA_SSE3 | PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_PRFCHW | PTA_FXSR, M_CPU_SUBTYPE (AMDFAM10H_BARCELONA), P_PROC_DYNAMIC}, {"bdver1", PROCESSOR_BDVER1, CPU_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, - M_CPU_TYPE (AMDFAM15H_BDVER1), P_PROC_XOP}, + PTA_BDVER1, + M_CPU_SUBTYPE (AMDFAM15H_BDVER1), P_PROC_XOP}, {"bdver2", PROCESSOR_BDVER2, CPU_BDVER2, - 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_BMI | PTA_TBM | PTA_F16C - | PTA_FMA | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE, - M_CPU_TYPE (AMDFAM15H_BDVER2), P_PROC_FMA}, + PTA_BDVER2, + M_CPU_SUBTYPE (AMDFAM15H_BDVER2), P_PROC_FMA}, {"bdver3", PROCESSOR_BDVER3, CPU_BDVER3, - 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_BMI | PTA_TBM | PTA_F16C - | PTA_FMA | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE - | PTA_XSAVEOPT | PTA_FSGSBASE, + PTA_BDVER3, M_CPU_SUBTYPE (AMDFAM15H_BDVER3), P_PROC_FMA}, {"bdver4", PROCESSOR_BDVER4, CPU_BDVER4, - 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_AVX2 - | PTA_FMA4 | PTA_XOP | PTA_LWP | PTA_BMI | PTA_BMI2 - | PTA_TBM | PTA_F16C | PTA_FMA | PTA_PRFCHW | PTA_FXSR - | PTA_XSAVE | PTA_XSAVEOPT | PTA_FSGSBASE | PTA_RDRND - | PTA_MOVBE | PTA_MWAITX, + PTA_BDVER4, M_CPU_SUBTYPE (AMDFAM15H_BDVER4), P_PROC_AVX2}, {"znver1", PROCESSOR_ZNVER1, CPU_ZNVER1, PTA_ZNVER1, @@ -2393,16 +2375,10 @@ const pta processor_alias_table[] = PTA_ZNVER5, M_CPU_SUBTYPE (AMDFAM1AH_ZNVER5), P_PROC_AVX512F}, {"btver1", PROCESSOR_BTVER1, CPU_GENERIC, - PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 - | PTA_SSSE3 | PTA_SSE4A | PTA_ABM | PTA_CX16 | PTA_PRFCHW - | PTA_FXSR | PTA_XSAVE, - M_CPU_SUBTYPE (AMDFAM15H_BDVER1), P_PROC_SSE4_A}, + PTA_BTVER1, + M_CPU_TYPE (AMD_BTVER1), P_PROC_SSE4_A}, {"btver2", PROCESSOR_BTVER2, CPU_BTVER2, - PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 - | PTA_SSSE3 | PTA_SSE4A | PTA_ABM | PTA_CX16 | PTA_SSE4_1 - | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX - | PTA_BMI | PTA_F16C | PTA_MOVBE | PTA_PRFCHW - | PTA_FXSR | PTA_XSAVE | PTA_XSAVEOPT, + PTA_BTVER2, M_CPU_TYPE (AMD_BTVER2), P_PROC_BMI}, {"generic", PROCESSOR_GENERIC, CPU_GENERIC, @@ -2421,9 +2397,9 @@ const pta processor_alias_table[] = {"amdfam19h", PROCESSOR_GENERIC, CPU_GENERIC, 0, M_CPU_TYPE (AMDFAM19H), P_NONE}, {"shanghai", PROCESSOR_GENERIC, CPU_GENERIC, 0, - M_CPU_TYPE (AMDFAM10H_SHANGHAI), P_NONE}, + M_CPU_SUBTYPE (AMDFAM10H_SHANGHAI), P_NONE}, {"istanbul", PROCESSOR_GENERIC, CPU_GENERIC, 0, - M_CPU_TYPE (AMDFAM10H_ISTANBUL), P_NONE}, + M_CPU_SUBTYPE (AMDFAM10H_ISTANBUL), P_NONE}, }; /* NB: processor_alias_table stops at the "generic" entry. */ diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 58e6f2826bf..82177b9d383 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2429,6 +2429,18 @@ constexpr wide_int_bitmask PTA_CLEARWATERFOREST = PTA_SIERRAFOREST | PTA_AVXVNNIINT16 | PTA_SHA512 | PTA_SM3 | PTA_SM4 | PTA_USER_MSR | PTA_PREFETCHI; constexpr wide_int_bitmask PTA_PANTHERLAKE = PTA_ARROWLAKE_S | PTA_PREFETCHI; + +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; +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 + | PTA_FSGSBASE; +constexpr wide_int_bitmask PTA_BDVER4 = PTA_BDVER3 | PTA_AVX2 | PTA_BMI2 + | PTA_RDRND | PTA_MOVBE | PTA_MWAITX; + constexpr wide_int_bitmask PTA_ZNVER1 = 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_AVX2 | PTA_BMI | PTA_BMI2 @@ -2446,13 +2458,21 @@ constexpr wide_int_bitmask PTA_ZNVER4 = PTA_ZNVER3 | PTA_AVX512F | PTA_AVX512DQ | PTA_AVX512VNNI | PTA_AVX512BITALG | PTA_AVX512VPOPCNTDQ | PTA_EVEX512; constexpr wide_int_bitmask PTA_ZNVER5 = PTA_ZNVER4 | PTA_AVXVNNI | PTA_MOVDIRI | PTA_MOVDIR64B | PTA_AVX512VP2INTERSECT | PTA_PREFETCHI; -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; -constexpr wide_int_bitmask PTA_YONGFENG = PTA_LUJIAZUI | PTA_AVX | PTA_AVX2 | PTA_F16C - | PTA_FMA | PTA_SHA | PTA_LZCNT; +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; +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; + +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; +constexpr wide_int_bitmask PTA_YONGFENG = PTA_LUJIAZUI | PTA_AVX | PTA_AVX2 + | PTA_F16C | PTA_FMA | PTA_SHA | PTA_LZCNT; #ifndef GENERATOR_FILE