From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 96505385E00B for ; Sat, 28 Mar 2020 01:32:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 96505385E00B Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02S1W4ZY084772; Fri, 27 Mar 2020 21:32:05 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywbtmw9cq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Mar 2020 21:32:05 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 02S1W4sa084767; Fri, 27 Mar 2020 21:32:04 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywbtmw970-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Mar 2020 21:32:04 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 02S1VnGj017687; Sat, 28 Mar 2020 01:31:50 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma04dal.us.ibm.com with ESMTP id 2ywawgv6ew-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 28 Mar 2020 01:31:50 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02S1VmDk35717586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 28 Mar 2020 01:31:48 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BE6767805C; Sat, 28 Mar 2020 01:31:48 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 40CE77805E; Sat, 28 Mar 2020 01:31:48 +0000 (GMT) Received: from ibm-tinman.the-meissners.org (unknown [9.80.207.254]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTPS; Sat, 28 Mar 2020 01:31:48 +0000 (GMT) Date: Fri, 27 Mar 2020 21:31:46 -0400 From: Michael Meissner To: gcc-patches@gcc.gnu.org, Segher Boessenkool , David Edelsohn , Michael Meissner Subject: [PATCH], Make PowerPC -mcpu=future enable -mpcrel on linux ELFv2 Message-ID: <20200328013146.GA26011@ibm-tinman.the-meissners.org> Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , David Edelsohn MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.645 definitions=2020-03-27_09:2020-03-27, 2020-03-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 phishscore=0 impostorscore=0 priorityscore=1501 spamscore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 clxscore=1015 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003280008 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Mar 2020 01:32:08 -0000 This is a revised version of the patch I posted on March 23rd. The changes are to update the comments and improve the ChangeLog. There were no regressions when I did the bootstrap and make check steps. I verified that -mcpu=future does turn on -mprecl if you are targeting a Linux ELF v2 system and use the medium code model. Can I check this into the master branch? 2020-03-27 Michael Meissner * config/rs6000/linux64.h (PCREL_SUPPORTED_BY_OS): New macro. * config/rs6000/rs6000-cpus.def (ISA_FUTURE_MASKS_SERVER): Do not set -mprefixed here. * config/rs6000/rs6000.c (PCREL_SUPPORTED_BY_OS): New macro. (rs6000_option_override_internal): Set the -mprefixed and -mpcrel options for -mcpu=future if these options can be used. --- /tmp/JVBhAf_linux64.h 2020-03-27 16:27:05.478619500 -0400 +++ gcc/config/rs6000/linux64.h 2020-03-27 16:21:56.268876616 -0400 @@ -640,3 +640,11 @@ extern int dot_symbols; enabling the __float128 keyword. */ #undef TARGET_FLOAT128_ENABLE_TYPE #define TARGET_FLOAT128_ENABLE_TYPE 1 + +/* Enable default support for PC-relative addressing on the 'future' system if + we can use the PC-relative instructions. Currently this support only exits + for the ELF v2 object file format using the medium code model. */ +#undef PCREL_SUPPORTED_BY_OS +#define PCREL_SUPPORTED_BY_OS (TARGET_FUTURE && TARGET_PREFIXED \ + && ELFv2_ABI_CHECK \ + && (TARGET_CMODEL == CMODEL_MEDIUM)) --- /tmp/KyQOUN_rs6000-cpus.def 2020-03-27 16:27:05.488619427 -0400 +++ gcc/config/rs6000/rs6000-cpus.def 2020-03-27 16:23:51.780030238 -0400 @@ -75,11 +75,11 @@ | OPTION_MASK_P8_VECTOR \ | OPTION_MASK_P9_VECTOR) -/* Support for a future processor's features. Do not enable -mpcrel until it - is fully functional. */ +/* Support for a future processor's features. We do not set -mpcrel or + -mprefixed here. These bits are set in rs6000_option_override if the system + supports those options. */ #define ISA_FUTURE_MASKS_SERVER (ISA_3_0_MASKS_SERVER \ - | OPTION_MASK_FUTURE \ - | OPTION_MASK_PREFIXED) + | OPTION_MASK_FUTURE) /* Flags that need to be turned off if -mno-future. */ #define OTHER_FUTURE_MASKS (OPTION_MASK_PCREL \ --- /tmp/z4Mwhm_rs6000.c 2020-03-27 16:27:05.500619340 -0400 +++ gcc/config/rs6000/rs6000.c 2020-03-27 16:20:13.066641659 -0400 @@ -98,6 +98,12 @@ #endif #endif +/* Set up the defaults for whether PC-relative addressing is supported by the + target system. */ +#ifndef PCREL_SUPPORTED_BY_OS +#define PCREL_SUPPORTED_BY_OS 0 +#endif + /* Support targetm.vectorize.builtin_mask_for_load. */ tree altivec_builtin_mask_for_load; @@ -4014,6 +4020,11 @@ rs6000_option_override_internal (bool gl rs6000_isa_flags &= ~OPTION_MASK_FLOAT128_HW; } + /* Enable -mprefixed by default on 64-bit 'future' systems. */ + if (TARGET_FUTURE && TARGET_POWERPC64 + && (rs6000_isa_flags_explicit & OPTION_MASK_PREFIXED) == 0) + rs6000_isa_flags |= OPTION_MASK_PREFIXED; + /* -mprefixed (and hence -mpcrel) requires -mcpu=future. */ if (TARGET_PREFIXED && !TARGET_FUTURE) { @@ -4175,6 +4186,11 @@ rs6000_option_override_internal (bool gl rs6000_isa_flags &= ~OPTION_MASK_PCREL; } + /* If the OS has support for PC-relative relocations, enable it now. */ + if (PCREL_SUPPORTED_BY_OS + && (rs6000_isa_flags_explicit & OPTION_MASK_PCREL) == 0) + rs6000_isa_flags |= OPTION_MASK_PCREL; + if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) rs6000_print_isa_options (stderr, 0, "after subtarget", rs6000_isa_flags); -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meissner@linux.ibm.com, phone: +1 (978) 899-4797