From patchwork Sat Nov 16 08:06:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 2012301 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=pVFnsw5u; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xr61m5m82z1xxN for ; Sat, 16 Nov 2024 19:07:24 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC7FB3857BB3 for ; Sat, 16 Nov 2024 08:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC7FB3857BB3 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=pVFnsw5u X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 6F6233857C68 for ; Sat, 16 Nov 2024 08:06:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F6233857C68 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6F6233857C68 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1731744407; cv=none; b=S+xVPFyh3/O79O0Ed0W5Yv7deabg4JMVou9uZnyhZ1I6epQsYfUEYSiSZeipZDsnLW1f+MpUbIKmyb/CJVZrjQy8Ds1RAcSbqKa5SIHwQg15Ii0eRcQUYCJcne3dtUS767x2vG1wRkKImTefv92kwaF3CJ8xt+92b9096YC5DZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1731744407; c=relaxed/simple; bh=fri0y2xPP7pW89ky9Zc59Hw6qh1ZB02ds1fUII838+Q=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=rtiSqt4zkBZNbhCfGoe6FHvs17ZHWtvV2/NUzV1iwxam6cYCg32EO4ilZZWECEa6xyIUHM6FZY7oZjm3JQkF9hi6c8cdnoA7GbsWf9w0Pk3FoBF0ZNhsoicpAhiDB3BBBM3hoDWbSVo1Vgw4Mdb9xc3ZhxI5oQAYQ+W366DDujU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F6233857C68 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AG5axG7000742; Sat, 16 Nov 2024 08:06:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=pp1; bh=4LtDojMXxxEc5c/vLam6rLjr0eWvzi x66kPdQBMS/Ug=; b=pVFnsw5uKxzqdY8r2n4en6uWS8mGdrgO+xax1vN6csAGI/ ActznYYd96pis/Of5DcH5FKcX9B/Nq3AJLCDg2SMWBbNlIN6ZFur0kUY7mNyHS84 cs2qqYZ2BwGu+VVhZ9JE+i7AIjkw2spDwZHWoRkG26ip/qtXqUGlMQecBKVHI7VY 6NIH5xf95avtmMKwddLh+dCFqkJs3mj0NyRJ5HpnbalRLCLkwfGrOT6R+xgm5cdh Zdll3JBA/j+gW/5D2rp3l3VGBpoEgJ6Hg2dk6ciciP59UGd5aTuqAZ3nDhZnSVt+ CAGODfvm2a9QJ7e+IBosy3BZpXCnv0r9lOMR39+Q== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42xk490p67-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 16 Nov 2024 08:06:46 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4AG68AqH008243; Sat, 16 Nov 2024 08:06:45 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 42tjf0tq4e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 16 Nov 2024 08:06:45 +0000 Received: from smtpav02.dal12v.mail.ibm.com (smtpav02.dal12v.mail.ibm.com [10.241.53.101]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4AG86h5n26477168 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 16 Nov 2024 08:06:44 GMT Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B255058051; Sat, 16 Nov 2024 08:06:43 +0000 (GMT) Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 51F185805A; Sat, 16 Nov 2024 08:06:43 +0000 (GMT) Received: from cowardly-lion.the-meissners.org (unknown [9.61.98.188]) by smtpav02.dal12v.mail.ibm.com (Postfix) with ESMTPS; Sat, 16 Nov 2024 08:06:43 +0000 (GMT) Date: Sat, 16 Nov 2024 03:06:41 -0500 From: Michael Meissner To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , Peter Bergner Subject: [PATCH V4 4/5] Change TARGET_POPCNTD to TARGET_POWER7. Message-ID: Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , Peter Bergner References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 3iGtGA3S0s_QmwNa9-IcOmMB4308WiLZ X-Proofpoint-GUID: 3iGtGA3S0s_QmwNa9-IcOmMB4308WiLZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 phishscore=0 malwarescore=0 clxscore=1015 bulkscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411160066 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~incoming=patchwork.ozlabs.org@gcc.gnu.org This patch changes TARGET_POPCNTD to TARGET_POWER7. The -mpopcntd switch is not being changed, just the name of the macros used to determine if the PowerPC processor supports ISA 2.6 (Power7). I have built GCC on both big and little endian systems and there were no regressions. Can I check this patch into GCC 15? 2024-11-16 Michael Meissner gcc/ * gcc/config/rs6000/dfp.md (cmp_internal1): Change TARGET_POPCNTD to TARGET_POWER7. * gcc/config/rs6000/rs6000-builtin.cc (rs6000_builtin_is_supported): Likewise. * gcc/config/rs6000/rs6000-string.cc (expand_block_compare): Likewise. * gcc/config/rs6000/rs6000.cc (rs6000_hard_regno_mode_ok_uncached): Likewise. (rs6000_option_override_internal): Likewise. (rs6000_rtx_costs): Likewise. * gcc/config/rs6000/rs6000.h (TARGET_LDBRX): Likewise. (TARGET_FCFID): Likewise. (TARGET_LFIWZX): Likewise. (TARGET_FCFIDS): Likewise. (TARGET_FCFIDU): Likewise. (TARGET_FCFIDUS): Likewise. (TARGET_FCTIDUZ): Likewise. (TARGET_FCTIWUZ): Likewise. (TARGET_FCTIDUZ): Likewise. (TARGET_POWER7): New macro. (TARGET_EXTRA_BUILTINS): Change TARGET_POPCNTD to TARGET_POWER7. (CTZ_DEFINED_VALUE_AT_ZERO): Likewise. * gcc/config/rs6000/rs6000.md (enabled attribute): Likewise. (lrintsi2): Likewise. (lrintsi): Likewise. (lrintsi_di): Likewise. (cmpmemsi): Likewise. (bpermd_): Likewise. (addg6s): Likewise. (cdtbcd): Likewise. (cbcdtd): Likewise. (div_): Likewise. --- gcc/config/rs6000/dfp.md | 2 +- gcc/config/rs6000/rs6000-builtin.cc | 4 ++-- gcc/config/rs6000/rs6000-string.cc | 2 +- gcc/config/rs6000/rs6000.cc | 8 ++++---- gcc/config/rs6000/rs6000.h | 21 +++++++++++---------- gcc/config/rs6000/rs6000.md | 20 ++++++++++---------- 6 files changed, 29 insertions(+), 28 deletions(-) diff --git a/gcc/config/rs6000/dfp.md b/gcc/config/rs6000/dfp.md index fa9d7dd45dd..b8189390d41 100644 --- a/gcc/config/rs6000/dfp.md +++ b/gcc/config/rs6000/dfp.md @@ -214,7 +214,7 @@ (define_insn "*cmp_internal1" (define_insn "floatdidd2" [(set (match_operand:DD 0 "gpc_reg_operand" "=d") (float:DD (match_operand:DI 1 "gpc_reg_operand" "d")))] - "TARGET_DFP && TARGET_POPCNTD" + "TARGET_DFP && TARGET_POWER7" "dcffix %0,%1" [(set_attr "type" "dfp")]) diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc index 76421bd1de0..dae43b672ea 100644 --- a/gcc/config/rs6000/rs6000-builtin.cc +++ b/gcc/config/rs6000/rs6000-builtin.cc @@ -161,9 +161,9 @@ rs6000_builtin_is_supported (enum rs6000_gen_builtins fncode) case ENB_P6_64: return TARGET_POWER6 && TARGET_POWERPC64; case ENB_P7: - return TARGET_POPCNTD; + return TARGET_POWER7; case ENB_P7_64: - return TARGET_POPCNTD && TARGET_POWERPC64; + return TARGET_POWER7 && TARGET_POWERPC64; case ENB_P8: return TARGET_POWER8; case ENB_P8V: diff --git a/gcc/config/rs6000/rs6000-string.cc b/gcc/config/rs6000/rs6000-string.cc index de618da9b5d..b633d80110d 100644 --- a/gcc/config/rs6000/rs6000-string.cc +++ b/gcc/config/rs6000/rs6000-string.cc @@ -1949,7 +1949,7 @@ bool expand_block_compare (rtx operands[]) { /* TARGET_POPCNTD is already guarded at expand cmpmemsi. */ - gcc_assert (TARGET_POPCNTD); + gcc_assert (TARGET_POWER7); /* For P8, this case is complicated to handle because the subtract with carry instructions do not generate the 64-bit carry and so diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index ca5d66beb37..2683fff80cf 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -1922,7 +1922,7 @@ rs6000_hard_regno_mode_ok_uncached (int regno, machine_mode mode) if(GET_MODE_SIZE (mode) == UNITS_PER_FP_WORD) return 1; - if (TARGET_POPCNTD && mode == SImode) + if (TARGET_POWER7 && mode == SImode) return 1; if (TARGET_P9_VECTOR && (mode == QImode || mode == HImode)) @@ -3916,7 +3916,7 @@ rs6000_option_override_internal (bool global_init_p) rs6000_isa_flags |= (ISA_2_7_MASKS_SERVER & ~ignore_masks); else if (TARGET_VSX) rs6000_isa_flags |= (ISA_2_6_MASKS_SERVER & ~ignore_masks); - else if (TARGET_POPCNTD) + else if (TARGET_POWER7) rs6000_isa_flags |= (ISA_2_6_MASKS_EMBEDDED & ~ignore_masks); else if (TARGET_DFP) rs6000_isa_flags |= (ISA_2_5_MASKS_SERVER & ~ignore_masks); @@ -4129,7 +4129,7 @@ rs6000_option_override_internal (bool global_init_p) else if (TARGET_LONG_DOUBLE_128) { if (global_options.x_rs6000_ieeequad - && (!TARGET_POPCNTD || !TARGET_VSX)) + && (!TARGET_POWER7 || !TARGET_VSX)) error ("%qs requires full ISA 2.06 support", "-mabi=ieeelongdouble"); if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT) @@ -22431,7 +22431,7 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code, return false; case POPCOUNT: - *total = COSTS_N_INSNS (TARGET_POPCNTD ? 1 : 6); + *total = COSTS_N_INSNS (TARGET_POWER7 ? 1 : 6); return false; case PARITY: diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 1b10802a87f..94853e11fc8 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -442,7 +442,7 @@ extern int rs6000_vector_align[]; #define TARGET_LONG_DOUBLE_128 (rs6000_long_double_type_size > 64) #define TARGET_IEEEQUAD rs6000_ieeequad #define TARGET_ALTIVEC_ABI rs6000_altivec_abi -#define TARGET_LDBRX (TARGET_POPCNTD || rs6000_cpu == PROCESSOR_CELL) +#define TARGET_LDBRX (TARGET_POWER7 || rs6000_cpu == PROCESSOR_CELL) /* ISA 2.01 allowed FCFID to be done in 32-bit, previously it was 64-bit only. Enable 32-bit fcfid's on any of the switches for newer ISA machines. */ @@ -450,17 +450,17 @@ extern int rs6000_vector_align[]; || TARGET_PPC_GPOPT /* 970/power4 */ \ || TARGET_POWER5 /* ISA 2.02 */ \ || TARGET_POWER6 /* ISA 2.05 */ \ - || TARGET_POPCNTD) /* ISA 2.06 */ + || TARGET_POWER7) /* ISA 2.06 */ #define TARGET_FCTIDZ TARGET_FCFID #define TARGET_STFIWX TARGET_PPC_GFXOPT #define TARGET_LFIWAX TARGET_POWER6 -#define TARGET_LFIWZX TARGET_POPCNTD -#define TARGET_FCFIDS TARGET_POPCNTD -#define TARGET_FCFIDU TARGET_POPCNTD -#define TARGET_FCFIDUS TARGET_POPCNTD -#define TARGET_FCTIDUZ TARGET_POPCNTD -#define TARGET_FCTIWUZ TARGET_POPCNTD +#define TARGET_LFIWZX TARGET_POWER7 +#define TARGET_FCFIDS TARGET_POWER7 +#define TARGET_FCFIDU TARGET_POWER7 +#define TARGET_FCFIDUS TARGET_POWER7 +#define TARGET_FCTIDUZ TARGET_POWER7 +#define TARGET_FCTIWUZ TARGET_POWER7 /* Only powerpc64 and powerpc476 support fctid. */ #define TARGET_FCTID (TARGET_POWERPC64 || rs6000_cpu == PROCESSOR_PPC476) #define TARGET_CTZ TARGET_MODULO @@ -505,6 +505,7 @@ extern int rs6000_vector_align[]; #define TARGET_POWER5 TARGET_POPCNTB #define TARGET_POWER5X TARGET_FPRND #define TARGET_POWER6 TARGET_CMPB +#define TARGET_POWER7 TARGET_POPCNTD /* In switching from using target_flags to using rs6000_isa_flags, the options machinery creates OPTION_MASK_ instead of MASK_. The MASK_ @@ -534,7 +535,7 @@ extern int rs6000_vector_align[]; || TARGET_PPC_GPOPT /* 970/power4 */ \ || TARGET_POWER5 /* ISA 2.02 */ \ || TARGET_POWER6 /* ISA 2.05 */ \ - || TARGET_POPCNTD /* ISA 2.06 */ \ + || TARGET_POWER7 /* ISA 2.06 */ \ || TARGET_ALTIVEC \ || TARGET_VSX \ || TARGET_HARD_FLOAT) @@ -1743,7 +1744,7 @@ typedef struct rs6000_args zero. The hardware instructions added in Power9 and the sequences using popcount return 32 or 64. */ #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \ - (TARGET_CTZ || TARGET_POPCNTD \ + (TARGET_CTZ || TARGET_POWER7 \ ? ((VALUE) = GET_MODE_BITSIZE (MODE), 2) \ : ((VALUE) = -1, 2)) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 07eae9ca0c5..b88254bb6ae 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -387,7 +387,7 @@ (define_attr "enabled" "" (const_int 1) (and (eq_attr "isa" "p7") - (match_test "TARGET_POPCNTD")) + (match_test "TARGET_POWER7")) (const_int 1) (and (eq_attr "isa" "p7v") @@ -6784,7 +6784,7 @@ (define_expand "lrintsi2" /* For those old archs in which SImode can't be hold in float registers, call lrintsi_di to put the result in DImode then convert it via stack. */ - if (!TARGET_POPCNTD) + if (!TARGET_POWER7) { rtx tmp = gen_reg_rtx (DImode); emit_insn (gen_lrintsi_di (tmp, operands[1])); @@ -6799,7 +6799,7 @@ (define_insn "*lrintsi" [(set (match_operand:SI 0 "gpc_reg_operand" "=d") (unspec:SI [(match_operand:SFDF 1 "gpc_reg_operand" "")] UNSPEC_FCTIW))] - "TARGET_HARD_FLOAT && TARGET_POPCNTD" + "TARGET_HARD_FLOAT && TARGET_POWER7" "fctiw %0,%1" [(set_attr "type" "fp")]) @@ -6807,7 +6807,7 @@ (define_insn "lrintsi_di" [(set (match_operand:DI 0 "gpc_reg_operand" "=d") (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "")] UNSPEC_FCTIW))] - "TARGET_HARD_FLOAT && !TARGET_POPCNTD" + "TARGET_HARD_FLOAT && !TARGET_POWER7" "fctiw %0,%1" [(set_attr "type" "fp")]) @@ -10168,7 +10168,7 @@ (define_expand "cmpmemsi" (match_operand:BLK 2))) (use (match_operand:SI 3)) (use (match_operand:SI 4))])] - "TARGET_POPCNTD" + "TARGET_POWER7" { if (optimize_insn_for_size_p ()) FAIL; @@ -14435,7 +14435,7 @@ (define_insn "bpermd_" [(set (match_operand:P 0 "gpc_reg_operand" "=r") (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r") (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))] - "TARGET_POPCNTD" + "TARGET_POWER7" "bpermd %0,%1,%2" [(set_attr "type" "popcnt")]) @@ -14813,7 +14813,7 @@ (define_insn "addg6s" (unspec:SI [(match_operand:SI 1 "register_operand" "r") (match_operand:SI 2 "register_operand" "r")] UNSPEC_ADDG6S))] - "TARGET_POPCNTD" + "TARGET_POWER7" "addg6s %0,%1,%2" [(set_attr "type" "integer")]) @@ -14821,7 +14821,7 @@ (define_insn "cdtbcd" [(set (match_operand:SI 0 "register_operand" "=r") (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_CDTBCD))] - "TARGET_POPCNTD" + "TARGET_POWER7" "cdtbcd %0,%1" [(set_attr "type" "integer")]) @@ -14829,7 +14829,7 @@ (define_insn "cbcdtd" [(set (match_operand:SI 0 "register_operand" "=r") (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_CBCDTD))] - "TARGET_POPCNTD" + "TARGET_POWER7" "cbcdtd %0,%1" [(set_attr "type" "integer")]) @@ -14844,7 +14844,7 @@ (define_insn "div_" (unspec:GPR [(match_operand:GPR 1 "register_operand" "r") (match_operand:GPR 2 "register_operand" "r")] UNSPEC_DIV_EXTEND))] - "TARGET_POPCNTD" + "TARGET_POWER7" "div %0,%1,%2" [(set_attr "type" "div") (set_attr "size" "")])