From patchwork Fri Aug 2 06:14:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 1968164 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=p3ZwMkxS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4WZwXW4kWbz1yZl for ; Fri, 2 Aug 2024 16:14:35 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E5531385C6D1 for ; Fri, 2 Aug 2024 06:14:33 +0000 (GMT) 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 2B8EA3858D26 for ; Fri, 2 Aug 2024 06:14:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2B8EA3858D26 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 2B8EA3858D26 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=1722579256; cv=none; b=psijHYyPpwSnva6+m9Y4Oh6OsBIlY43erLlmF+FvPgepLL4FLU96ZuckZ/lvu270NgAnc9fdulGkDHTRcTerJIPaJs/6/qCkBGQjQFu84754JtSx8JX4OFoXa7l8docIwv18BTwT1dKz5sHPTtY1GJKXnIFExcvJCIPP/62ILAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722579256; c=relaxed/simple; bh=zHE7J1Nr0nF45sF0qUokLx7PlINyy8WzRGMaR2pkVKQ=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=i/G3ezXKLh5FwR0R2wdSSGibpPoDeW1cmZIw06khwa4oLsA5eUGbzZcTswyER0mzmx9t+1Ri/XtAEJrP3kmOnthoyEcTf0Q9qJ6CCdTZrUHJj6niBq1UEu5ZNpXbiNKJCHOypHVgwGtY55CALNg3/IexzDe4KKaz/WE8ZrsbYCo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4725w3iF012337; Fri, 2 Aug 2024 06:14:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=pp1; bh=2TGQY+A9f29x721ZfLoBaSFdofxuMQq6Pr5orhPp Mpg=; b=p3ZwMkxSF6Ggt20NzfEAgnotLBZRjZWX20Bb9gNOr5Jgk1r/ccHvoPku K1zxW6T9YRtFOiHNJnHd1zrpXy/cbm5szda8S7QU7WCbAoiUPFlrS2ZcXel+HKCg l1riUFBuJ3swsOIzZ+8I+TtdQLR9k4mS/0BauscNXNJmUqM89r7PnrJryom8CDZj T95Vb9JodI25t4ocI09MR9CCmET5Gz38AQRqKxEjqDxGDV0vG5UkYZwKHIWkf+WD bAFC9Y/Bn9SUXrjTqy6tVRgj+p4dOqmnVbk9HjlUD3eCnaKSzhZ1HdWgWcGpzN+j ty6Pta7Ewf8hCziXWuUqHV+6OVu5ug== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40rsba826a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Aug 2024 06:14:12 +0000 (GMT) Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4726ECP6007765; Fri, 2 Aug 2024 06:14:12 GMT 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 40rsba8267-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Aug 2024 06:14:12 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 47266Bc1029111; Fri, 2 Aug 2024 06:14:11 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 40nbm15xy2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Aug 2024 06:14:11 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4726E8gY25100942 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 2 Aug 2024 06:14:10 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 06C4D58060; Fri, 2 Aug 2024 06:14:08 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8E6BE58056; Fri, 2 Aug 2024 06:14:07 +0000 (GMT) Received: from cowardly-lion.the-meissners.org (unknown [9.61.67.12]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTPS; Fri, 2 Aug 2024 06:14:07 +0000 (GMT) Date: Fri, 2 Aug 2024 02:14:06 -0400 From: Michael Meissner To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner Subject: [PATCH 4/9] Change TARGET_POPCNTB to TARGET_POWER5 Message-ID: Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 7H0-XybyFGoRLz7wC9HVUmrrxiGS7a7S X-Proofpoint-ORIG-GUID: GPC0rNMq49YcXk88H6C0mykhbW-jhSh8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-02_02,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 mlxscore=0 suspectscore=0 phishscore=0 impostorscore=0 spamscore=0 mlxlogscore=757 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408020039 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP 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~incoming=patchwork.ozlabs.org@gcc.gnu.org As part of the architecture flags patches, this patch changes the use of TARGET_POPCNTB to TARGET_POWER5. The POPCNTB instruction was added in ISA 2.02 (power5). I have built both big endian and little endian bootstrap compilers and there were no regressions. In addition, I constructed a test case that used every archiecture define (like _ARCH_PWR4, etc.) and I also looked at the .machine directive generated. I ran this test for all supported combinations of -mcpu, big/little endian, and 32/64 bit support. Every single instance generated exactly the same code with the patches installed compared to the compiler before installing the patches. Can I install this patch on the GCC 15 trunk? 2024-08-01 Michael Meissner * config/rs6000/rs6000-builtin.cc (rs6000_builtin_is_supported): Use TARGET_POWER5 instead of TARGET_POPCNTB. * config/rs6000/rs6000.h (TARGET_EXTRA_BUILTINS): Use TARGET_POWER5 instead of TARGET_POPCNTB. Eliminate TARGET_CMPB and TARGET_POPCNTD tests since TARGET_POWER5 will always be true for those tests. (TARGET_FRE): Use TARGET_POWER5 instead of TARGET_POPCNTB. (TARGET_FRSQRTES): Likewise. * config/rs6000/rs6000.md (enabled attribute): Likewise. (popcount): Use TARGET_POWER5 instead of TARGET_POPCNTB. Drop test for TARGET_POPCNTD (i.e power7), since TARGET_POPCNTB will always be set if TARGET_POPCNTD is set. (popcntb2): Use TARGET_POWER5 instead of TARGET_POPCNTB. (parity2): Likewise. (parity2_cmpb): Remove TARGET_POPCNTB test, since it will always be true when TARGET_CMPB (i.e. power6) is set. --- gcc/config/rs6000/rs6000-builtin.cc | 2 +- gcc/config/rs6000/rs6000.h | 8 +++----- gcc/config/rs6000/rs6000.md | 10 +++++----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc index 099cbc82245..ba2eba15378 100644 --- a/gcc/config/rs6000/rs6000-builtin.cc +++ b/gcc/config/rs6000/rs6000-builtin.cc @@ -155,7 +155,7 @@ rs6000_builtin_is_supported (enum rs6000_gen_builtins fncode) case ENB_ALWAYS: return true; case ENB_P5: - return TARGET_POPCNTB; + return TARGET_POWER5; case ENB_P6: return TARGET_CMPB; case ENB_P6_64: diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 292b2ca164d..4ad0fca1d60 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -547,9 +547,7 @@ extern int rs6000_vector_align[]; #define TARGET_EXTRA_BUILTINS (TARGET_POWERPC64 \ || TARGET_PPC_GPOPT /* 970/power4 */ \ - || TARGET_POPCNTB /* ISA 2.02 */ \ - || TARGET_CMPB /* ISA 2.05 */ \ - || TARGET_POPCNTD /* ISA 2.06 */ \ + || TARGET_POWER5 /* ISA 2.02 & above */ \ || TARGET_ALTIVEC \ || TARGET_VSX \ || TARGET_HARD_FLOAT) @@ -563,9 +561,9 @@ extern int rs6000_vector_align[]; #define TARGET_FRES (TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT) #define TARGET_FRE (TARGET_HARD_FLOAT \ - && (TARGET_POPCNTB || VECTOR_UNIT_VSX_P (DFmode))) + && (TARGET_POWER5 || VECTOR_UNIT_VSX_P (DFmode))) -#define TARGET_FRSQRTES (TARGET_HARD_FLOAT && TARGET_POPCNTB \ +#define TARGET_FRSQRTES (TARGET_HARD_FLOAT && TARGET_POWER5 \ && TARGET_PPC_GFXOPT) #define TARGET_FRSQRTE (TARGET_HARD_FLOAT \ diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index d352a1431ad..4e5a3e1b345 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -365,7 +365,7 @@ (define_attr "enabled" "" (const_int 1) (and (eq_attr "isa" "p5") - (match_test "TARGET_POPCNTB")) + (match_test "TARGET_POWER5")) (const_int 1) (and (eq_attr "isa" "p6") @@ -2475,7 +2475,7 @@ (define_expand "ffs2" (define_expand "popcount2" [(set (match_operand:GPR 0 "gpc_reg_operand") (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand")))] - "TARGET_POPCNTB || TARGET_POPCNTD" + "TARGET_POWER5" { rs6000_emit_popcount (operands[0], operands[1]); DONE; @@ -2485,7 +2485,7 @@ (define_insn "popcntb2" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_POPCNTB))] - "TARGET_POPCNTB" + "TARGET_POWER5" "popcntb %0,%1" [(set_attr "type" "popcnt")]) @@ -2500,7 +2500,7 @@ (define_insn "popcntd2" (define_expand "parity2" [(set (match_operand:GPR 0 "gpc_reg_operand") (parity:GPR (match_operand:GPR 1 "gpc_reg_operand")))] - "TARGET_POPCNTB" + "TARGET_POWER5" { rs6000_emit_parity (operands[0], operands[1]); DONE; @@ -2509,7 +2509,7 @@ (define_expand "parity2" (define_insn "parity2_cmpb" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))] - "TARGET_CMPB && TARGET_POPCNTB" + "TARGET_CMPB" "prty %0,%1" [(set_attr "type" "popcnt")])