From patchwork Wed Nov 13 19:45:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 2010981 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=KyvNdRH9; 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 4XpYgH57MVz1xty for ; Thu, 14 Nov 2024 06:46:03 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D940B3858C78 for ; Wed, 13 Nov 2024 19:46:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D940B3858C78 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=KyvNdRH9 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 BAABB3858D26 for ; Wed, 13 Nov 2024 19:45:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BAABB3858D26 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 BAABB3858D26 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=1731527126; cv=none; b=eis4ggU9zaR8Jr8UB3Xv9TWQoQm3Ck9CXjqpPY1JRRTCr/UqqFdnOSWY97QadfS6UIeQaX8AE9YTOpCV/SN16agP8JswzRzFLNz+MrF1mHbC4qAdiEdaXidOo9YEKPLOHKzhk9RHlLSPuc+RwETbBHRSRRvrLAJ+0LKBORikD+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1731527126; c=relaxed/simple; bh=8EPS9p7KzRA/NFctwGOVnUlOZ8tIOOb341mrZ+IY8tw=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=D8iXbc0/bP79kXRaMKNy8jDxI4hzFarBhTH4YHJz9O4iR0n/q5IV2/AYcIsBqGVy7afMVhbRqG+BzgQJG8mdTtKkR0kraioraOSh9togdNJYmdro1CzSe75kpCslOQbPpEY7k9WLOy6v4R8Rm96kYimxnUzFqVPd5pPpSxmDK9M= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BAABB3858D26 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 4ADIfBak015840; Wed, 13 Nov 2024 19:45:26 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=uw+YkHs5SBA5Vv8DX4FhPIUwJqXLLE rFkuyJqYHkv0M=; b=KyvNdRH9ZCBtlAsoQh0uwY+PU1RGRcKa2didBGEYU6F8cH mai14BhqQGd1VpDgvD/uDK7E9ZSoAEy+qMvjr75Bj+IlPnjrkSeZMjDBivRirJjz H34MK9tjqEbtuIB8JlB4vwE6+E8rmi8gg9sucA75fkpTtZ771z9akEkbfADVCYS+ s4uub4fca8CJyISE1hCvItC7edWEGhd+uKxkfjw6JaIMAhX/oFSGEM4xc+4SLCU9 Swikm/flMe4cQtB+3YDeEbJyEbHFENB3fvLmQC9ST/Kzx7E6sDyHu//F4MLBZNN6 aqG55QtyNo+QRNO2qKSNTJ3/nApq5fMbMWjwlgLw== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42vyd3908j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Nov 2024 19:45:25 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4ADFA7gm017527; Wed, 13 Nov 2024 19:45:25 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 42tk2mxxkr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Nov 2024 19:45:25 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4ADJjOVv52822338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Nov 2024 19:45:24 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0406F5805E; Wed, 13 Nov 2024 19:45:24 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6EF6058058; Wed, 13 Nov 2024 19:45:23 +0000 (GMT) Received: from cowardly-lion.the-meissners.org (unknown [9.61.109.186]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTPS; Wed, 13 Nov 2024 19:45:23 +0000 (GMT) Date: Wed, 13 Nov 2024 14:45:21 -0500 From: Michael Meissner To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , Peter Bergner Subject: [PATCH V3, 03/11] Do not allow -mvsx to boost processor to 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-GUID: l4TfgtoTr103caNx7-ixDMC00puQHUiS X-Proofpoint-ORIG-GUID: l4TfgtoTr103caNx7-ixDMC00puQHUiS 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 lowpriorityscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 clxscore=1015 mlxscore=0 spamscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411130157 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 restructures the code so that -mvsx for example will not silently convert the processor to power7. The user must now use -mcpu=power7 or higher. This means if the user does -mvsx and the default processor does not have VSX support, it will be an error. 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-11-13 Michael Meissner gcc/ * config/rs6000/rs6000.cc (report_architecture_mismatch): New function. Report an error if the user used an option such as -mvsx when the default processor would not allow the option. (rs6000_option_override_internal): Move some ISA checking code into report_architecture_mismatch. --- gcc/config/rs6000/rs6000.cc | 129 ++++++++++++++++++++++-------------- 1 file changed, 79 insertions(+), 50 deletions(-) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 9cbb16ddccc..eadd55ed5bb 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -1173,6 +1173,7 @@ const int INSN_NOT_AVAILABLE = -1; static void rs6000_print_isa_options (FILE *, int, const char *, HOST_WIDE_INT, HOST_WIDE_INT); static HOST_WIDE_INT rs6000_disable_incompatible_switches (void); +static void report_architecture_mismatch (void); static enum rs6000_reg_type register_to_reg_type (rtx, bool *); static bool rs6000_secondary_reload_move (enum rs6000_reg_type, @@ -3695,7 +3696,6 @@ rs6000_option_override_internal (bool global_init_p) bool ret = true; HOST_WIDE_INT set_masks; - HOST_WIDE_INT ignore_masks; int cpu_index = -1; int tune_index; struct cl_target_option *main_target_opt @@ -3964,59 +3964,13 @@ rs6000_option_override_internal (bool global_init_p) dwarf_offset_size = POINTER_SIZE_UNITS; #endif - /* Handle explicit -mno-{altivec,vsx} and turn off all of - the options that depend on those flags. */ - ignore_masks = rs6000_disable_incompatible_switches (); - - /* For the newer switches (vsx, dfp, etc.) set some of the older options, - unless the user explicitly used the -mno-