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 5A7CC3858D32 for ; Mon, 8 Apr 2024 11:43:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A7CC3858D32 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 5A7CC3858D32 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=1712576601; cv=none; b=GFd9xoyoVwYe3X6qA/ePdN21VUn49c2VkoIJgLB9g/xDzc2TootZaEPC591cseyssyks8LDHY2eX+yNvUDoaKmOUsC/YE1vTOyiusXs7xYCeH56PQpc/nI2yVt5EifXFPCiUpAhhTciOic6haD3RyO9VZmopVbb0WsaQnYR1Ius= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712576601; c=relaxed/simple; bh=0Gb1kJ/OT7p/ykEgmtXCPRtMee9LqzUQmwMQN3GAvKM=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=cnkDVrIk5uJnlQniesNANaoxputpEWTVe4EbwjHoCsAaeIzz3OnmoONy0kZ8rKZcPt5EHMgC3uwU+immvdPxquhKyw+jFK3wJ46XW2sGv6UptA9eNquIOaq/hlj+FlPJscmUWhvnbUx3e2LLlVV3slOQatznQJvXtr1/QgqjwxQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 438BVPsb018282 for ; Mon, 8 Apr 2024 11:43:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=pp1; bh=drhAaafkcAJMv1LJ46xhyDyQ3ietmNQdbnqzXxyO7+M=; b=HKCnmENklV88nF6l2sRjebopu06U6QKSCVvXNs14pE23GQGyFrXXn63Xa/MVGFznnuaa 5K6ydrTSVFrvjpXtPgBaa8ivOZftuEDdVr6H3LaPn91zu+wlu+eCo0ZQBx044SW05vda NpxK7oRGtccwdSBnFemXewAPNAsygfqY41Di02xO5VlR+LNHKCL37uP7GM+JwBTxIDLK 1rwSTzWBicPMfNXbhPLsQSpBHOOD8SIZ24yHZymw64GTFUl2L8PDnQT0M1539CTwYE8M cEvi6PE68rH0kwJ3ku7tOIfY+Z2olBdAGTyYBAnff7XP0fYckZsuHAE3AXMIhl3f6gwp Vg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xceu8g3w8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 08 Apr 2024 11:43:17 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 438BhH2u006088 for ; Mon, 8 Apr 2024 11:43:17 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 3xceu8g3w5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Apr 2024 11:43:17 +0000 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 4388oNKg029894; Mon, 8 Apr 2024 11:43:16 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3xbj7kyqpm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Apr 2024 11:43:15 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 438BhA0E54722864 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Apr 2024 11:43:12 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 19C012004E; Mon, 8 Apr 2024 11:43:10 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F3CF820049; Mon, 8 Apr 2024 11:43:09 +0000 (GMT) Received: from [9.155.200.166] (unknown [9.155.200.166]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Apr 2024 11:43:09 +0000 (GMT) Message-ID: Subject: Re: [PATCH] s390: Fix s390_const_int_pool_entry_p and movdi peephole2 [PR114605] From: Ilya Leoshkevich To: Jakub Jelinek , Andreas Krebbel Cc: gcc-patches@gcc.gnu.org Date: Mon, 08 Apr 2024 13:43:09 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (3.50.4-1.fc39) MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: mrx_A6eVW-voMH01QK8u8E0I-dRhhQVk X-Proofpoint-ORIG-GUID: r57gs4AeTJFjjHzKLCZ7Z3jFw9HYSeVg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-08_10,2024-04-05_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 mlxlogscore=952 bulkscore=0 phishscore=0 adultscore=0 impostorscore=0 priorityscore=1501 spamscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404080090 X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H4,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 List-Id: On Sat, 2024-04-06 at 18:58 +0200, Jakub Jelinek wrote: > Hi! >=20 > The following testcase is miscompiled, because we have initially > a movti which loads the 0x3f8000003f800000ULL TImode constant > from constant pool.=C2=A0 Later on we split it into a pair of DImode > loads.=C2=A0 Now, for the first load (why just that?, though not stage4 > material) we trigger the peephole2 which uses > s390_const_int_pool_entry_p. > That function doesn't check at all the constant pool mode though, > sees > the constant pool at that address has a CONST_INT value and just > assumes > that is the value to return, which is especially wrong for big- > endian, > if it is a DImode load from offset 0, it should be loading 0 rather > than > 0x3f8000003f800000ULL. > The following patch adds checks if we are extracing a MODE_INT mode, > if the constant pool has MODE_INT mode as well, punts if constant > pool > has smaller mode size than the extraction one (then it would be UB), > if it has the same mode as before keeps using what it did before, > if constant pool has a larger mode than the one being extracted, uses > simplify_subreg.=C2=A0 I'd have used avoid_constant_pool_reference > instead which can handle also offsets into the constant pool > constants, > but it can't handle UNSPEC_LTREF. >=20 > Another thing is that once that is fixed, we ICE when we extract > constant > like 0, ior insn predicate require non-0 constant.=C2=A0 So, the patch > also > fixes the peephole2 so that if either 32-bit half is zero, it uses a > mere > load of the constant into register rather than a pair of such load > and ior. >=20 > Bootstrapped/regtested on s390x-linux, ok for trunk? Hi Jakub, thanks for the patch, it looks good to me. Since I'm not a maintainer, we need to wait for Andreas' opinion. >=20 > 2024-04-06=C2=A0 Jakub Jelinek=C2=A0 >=20 > PR target/114605 > * config/s390/s390.cc (s390_const_int_pool_entry_p): Punt > if mem doesn't have MODE_INT mode, or pool constant doesn't > have MODE_INT mode, or if pool constant mode is smaller than > mem mode.=C2=A0 If mem mode is different from pool constant mode, > try to simplify subreg.=C2=A0 If that doesn't work, punt, if it > does, use the simplified constant instead of the constant > pool > constant. > * config/s390/s390.md (movdi from const pool peephole): If > either low or high 32-bit part is zero, just emit move insn > instead of move + ior. >=20 > * gcc.dg/pr114605.c: New test.