From patchwork Fri Aug 2 06:16:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 1968166 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=naqoCz89; 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 4WZwbD43xTz1yYq for ; Fri, 2 Aug 2024 16:16:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C67AE385E45D for ; Fri, 2 Aug 2024 06:16:54 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 043603858428 for ; Fri, 2 Aug 2024 06:16:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 043603858428 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 043603858428 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722579386; cv=none; b=iLkX9cAgS0BddYpq7o8BIinW5BSexnJCBjIlOksvz4aeQO4ZAYaTd/3pPy5HE3oDhYvKMHedhlUGfbxr3JVm7m2TBEVL65vlXLCIeoU6oLxkE/h4uMsdIL+Bax/9jsc0F30wvD/9lTBLu95YRW1pcmUdUv7DmV83XniWS3miSnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722579386; c=relaxed/simple; bh=iWN318ZzJzWtJ++MMku0b5z8tJ+PqGFKuJlHr659LqM=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=SKPR2gGQF7Qf7uj1xI8h3j2IcyescFGdKZGfkGNWAVuz3DJlnNftzSXlpo733ziVzqNPntUAI8XTx3MNR+g+YlYHmlYsdTCK75lue0+/mdDipoV6DFaAqFqspydBri6Csos0tlkZ78esi3eJ8ho1l1zgy/WNYQUsUBe7Uft/eUU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4722wmiJ030338; Fri, 2 Aug 2024 06:16:23 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=DHqfM6b7ke8PY/SN8UAf582qjhWcuYRR+vyxU8TF TRs=; b=naqoCz89SIoqfsBuqEcHNtvhLoGVKiFgattUPWc2zal+lmKU1yv00QwU g1NUYoU68um4rHvSLrBy0XfnVjcbJ76vlh2uqh3VadNCPcmD2Y/pH3KfB1vzJX01 bSyORVPMDn7btKEzoe4FZ8iFD0CnAmq+xKeZIyCLWgr+D1WESVu5v1q3Lk4LDI3K /a5ObCgWkBjHXZHOo8VsPNYxi//vkW2zpo5I//K8X9go+QFj+yXOlgNLi4OrePEN MqstEF2UCJp6ymMgdA533IMfcB+qszL7+l0yJ1Ce9FTWVVVfpDzFv5+a6jx7X3+c j9LHooHPA4AxkK7lTpNRjGWuc+4BlQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40rq5089sm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Aug 2024 06:16:22 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4726GMQd026399; Fri, 2 Aug 2024 06:16:22 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40rq5089sh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Aug 2024 06:16:22 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4723PDYk011170; Fri, 2 Aug 2024 06:16:21 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([172.16.1.70]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 40ncqn5qw7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Aug 2024 06:16:21 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4726GIxB62456234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 2 Aug 2024 06:16:20 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3FD9B58062; Fri, 2 Aug 2024 06:16:18 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C67B058057; Fri, 2 Aug 2024 06:16:17 +0000 (GMT) Received: from cowardly-lion.the-meissners.org (unknown [9.61.67.12]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTPS; Fri, 2 Aug 2024 06:16:17 +0000 (GMT) Date: Fri, 2 Aug 2024 02:16:14 -0400 From: Michael Meissner To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner Subject: [PATCH 6/9] Change TARGET_CMPB to TARGET_POWER6 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: pft1LVVtBJjO67MDLNyFLAvkEtUgWutI X-Proofpoint-ORIG-GUID: oQlqhF2K6OHokmlk8kJ9JExSgvk12qdQ 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 bulkscore=0 clxscore=1015 malwarescore=0 impostorscore=0 suspectscore=0 mlxlogscore=764 adultscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408020039 X-Spam-Status: No, score=-10.7 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_FPRND to TARGET_POWER6. The CMPB instruction was added in power6 (ISA 2.05). 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_POWER6 instead of TARGET_CMPB. * config/rs6000/rs6000.h (TARGET_FCFID): Merge tests for popcntb, cmpb, and popcntd into a single test for TARGET_POWER5. (TARGET_LFIWAX): Use TARGET_POWER6 instead of TARGET_CMPB. * config/rs6000/rs6000.md (enabled attribute): Likewise. (parity2_cmp): Likewise. (cmpb): Likewise. (copysign3): Likewise. (copysign3_fcpsgn): Likewise. (cmpstrnsi): Likewise. (cmpstrsi): Likewise. --- gcc/config/rs6000/rs6000-builtin.cc | 4 ++-- gcc/config/rs6000/rs6000.h | 6 ++---- gcc/config/rs6000/rs6000.md | 16 ++++++++-------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc index ba2eba15378..ddf744cd988 100644 --- a/gcc/config/rs6000/rs6000-builtin.cc +++ b/gcc/config/rs6000/rs6000-builtin.cc @@ -157,9 +157,9 @@ rs6000_builtin_is_supported (enum rs6000_gen_builtins fncode) case ENB_P5: return TARGET_POWER5; case ENB_P6: - return TARGET_CMPB; + return TARGET_POWER6; case ENB_P6_64: - return TARGET_CMPB && TARGET_POWERPC64; + return TARGET_POWER6 && TARGET_POWERPC64; case ENB_P7: return TARGET_POPCNTD; case ENB_P7_64: diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 4ad0fca1d60..924ca682172 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -448,13 +448,11 @@ extern int rs6000_vector_align[]; Enable 32-bit fcfid's on any of the switches for newer ISA machines. */ #define TARGET_FCFID (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 and above */ \ #define TARGET_FCTIDZ TARGET_FCFID #define TARGET_STFIWX TARGET_PPC_GFXOPT -#define TARGET_LFIWAX TARGET_CMPB +#define TARGET_LFIWAX TARGET_POWER6 #define TARGET_LFIWZX TARGET_POPCNTD #define TARGET_FCFIDS TARGET_POPCNTD #define TARGET_FCFIDU TARGET_POPCNTD diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 6555b50dc98..dd3bfcc6a3a 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -369,7 +369,7 @@ (define_attr "enabled" "" (const_int 1) (and (eq_attr "isa" "p6") - (match_test "TARGET_CMPB")) + (match_test "TARGET_POWER6")) (const_int 1) (and (eq_attr "isa" "p7") @@ -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_POWER6" "prty %0,%1" [(set_attr "type" "popcnt")]) @@ -2562,7 +2562,7 @@ (define_insn "cmpb3" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r") (match_operand:GPR 2 "gpc_reg_operand" "r")] UNSPEC_CMPB))] - "TARGET_CMPB" + "TARGET_POWER6" "cmpb %0,%1,%2" [(set_attr "type" "cmp")]) @@ -5366,7 +5366,7 @@ (define_expand "copysign3" && ((TARGET_PPC_GFXOPT && !HONOR_NANS (mode) && !HONOR_SIGNED_ZEROS (mode)) - || TARGET_CMPB + || TARGET_POWER6 || VECTOR_UNIT_VSX_P (mode))" { /* Middle-end canonicalizes -fabs (x) to copysign (x, -1), @@ -5387,7 +5387,7 @@ (define_expand "copysign3" if (!gpc_reg_operand (operands[2], mode)) operands[2] = copy_to_mode_reg (mode, operands[2]); - if (TARGET_CMPB || VECTOR_UNIT_VSX_P (mode)) + if (TARGET_POWER6 || VECTOR_UNIT_VSX_P (mode)) { emit_insn (gen_copysign3_fcpsgn (operands[0], operands[1], operands[2])); @@ -5403,7 +5403,7 @@ (define_insn "copysign3_fcpsgn" [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,wa") (copysign:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "d,wa") (match_operand:SFDF 2 "gpc_reg_operand" "d,wa")))] - "TARGET_HARD_FLOAT && (TARGET_CMPB || VECTOR_UNIT_VSX_P (mode))" + "TARGET_HARD_FLOAT && (TARGET_POWER6 || VECTOR_UNIT_VSX_P (mode))" "@ fcpsgn %0,%2,%1 xscpsgndp %x0,%x2,%x1" @@ -10087,7 +10087,7 @@ (define_expand "cmpstrnsi" (match_operand:BLK 2))) (use (match_operand:SI 3)) (use (match_operand:SI 4))])] - "TARGET_CMPB && (BYTES_BIG_ENDIAN || TARGET_LDBRX)" + "TARGET_POWER6 && (BYTES_BIG_ENDIAN || TARGET_LDBRX)" { if (optimize_insn_for_size_p ()) FAIL; @@ -10109,7 +10109,7 @@ (define_expand "cmpstrsi" (compare:SI (match_operand:BLK 1) (match_operand:BLK 2))) (use (match_operand:SI 3))])] - "TARGET_CMPB && (BYTES_BIG_ENDIAN || TARGET_LDBRX)" + "TARGET_POWER6 && (BYTES_BIG_ENDIAN || TARGET_LDBRX)" { if (optimize_insn_for_size_p ()) FAIL;