From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 7F64C385802E; Wed, 5 May 2021 07:25:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7F64C385802E Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14573QAe004721; Wed, 5 May 2021 03:25:11 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 38bn482k8y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 May 2021 03:25:10 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 1457MSHG013598; Wed, 5 May 2021 07:25:09 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 38bee585ac-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 May 2021 07:25:09 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1457P6QW38011320 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 May 2021 07:25:06 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B2ED313E111; Wed, 5 May 2021 07:25:06 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B6B113E110; Wed, 5 May 2021 07:25:06 +0000 (GMT) Received: from t35lp57.lnxne.boe (unknown [9.152.108.100]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 5 May 2021 07:25:06 +0000 (GMT) From: Stefan Schulze Frielinghaus To: gcc-patches@gcc.gnu.org, ebotcazou@gcc.gnu.org Subject: [PATCH] PR rtl-optimization/100263: Ensure register can change mode Date: Wed, 5 May 2021 09:20:01 +0200 Message-Id: <20210505072000.3513197-1-stefansf@linux.ibm.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: QfLOGQilieheS5d5GODwNTLGM1v5cWYH X-Proofpoint-ORIG-GUID: QfLOGQilieheS5d5GODwNTLGM1v5cWYH X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-05_02:2021-05-05, 2021-05-05 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=966 suspectscore=0 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 priorityscore=1501 clxscore=1011 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2105050050 X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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: Wed, 05 May 2021 07:25:13 -0000 For move2add_valid_value_p we also have to ask the target whether a register can be accessed in a different mode than it was set before. gcc/ChangeLog: PR rtl-optimization/100263 * postreload.c (move2add_valid_value_p): Ensure register can change mode. Bootstrapped and regtested releases/gcc-{8,9,10,11} and master on IBM Z. Ok for those branches? --- gcc/postreload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/postreload.c b/gcc/postreload.c index dc67643384d..60a622dbaf3 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -1725,7 +1725,8 @@ move2add_valid_value_p (int regno, scalar_int_mode mode) { scalar_int_mode old_mode; if (!is_a (reg_mode[regno], &old_mode) - || !MODES_OK_FOR_MOVE2ADD (mode, old_mode)) + || !MODES_OK_FOR_MOVE2ADD (mode, old_mode) + || !REG_CAN_CHANGE_MODE_P (regno, old_mode, mode)) return false; /* The value loaded into regno in reg_mode[regno] is also valid in mode after truncation only if (REG:mode regno) is the lowpart of -- 2.23.0