From patchwork Tue Jan 10 09:04:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 41368 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2636489wrt; Tue, 10 Jan 2023 01:05:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXujgEiLNPWrhon8i0o1qta0GJWfCLRr0GkAi23Fw2bW92UA+c8fuRjNFaA4NZyrU9A3qXh+ X-Received: by 2002:aa7:c6c2:0:b0:46b:aedf:f328 with SMTP id b2-20020aa7c6c2000000b0046baedff328mr56789780eds.20.1673341516211; Tue, 10 Jan 2023 01:05:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673341516; cv=none; d=google.com; s=arc-20160816; b=Lv880TVGxCgN+2kcC34S+XVPb/VVq2TZntIDwebVbqdMn2NAFIqdATpHdXbwNLXcre WOnGB2iI0NQH6Fzl982IPPOHVvQrimPLi0LsB6fNsaVD8d8Dl80+ip3XFil/BVnwc6at VPIMHOZG+oIsRNd8wHODdt4NcV2ww6LaUy4WkPy3sb29A7+mVxlL0QzAlzMnons0DQCj xrX9PC9pVEZvwFs58ELrHaemRq9gMjlFPKFW0KTGxZSJkGQ+pbBdQUVyeD3DZ6Mg58tN pe/W4FfojX3OmjCJ13XffxYVKFSEZPqtKOi7YodOXM2hpp8d74uvH4aiH8uKUh8mduTw CnzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=FvkNfyF14aqODlSdcDVGl4JyyXE0JKb6iZksMB9FtBs=; b=pryuiSVQWUi6jSck10mzy5eYQRmIyL4oqRp+B+XR2u5q6zE1jS80HDEh8ewx7evOCo DrTQl24KLayUZVtiK26l1fAB+vECJU/JRnQdC8Y0wPDqpIzq4HQzj5uOHNBsVko5sc5c /qK5ft6Z75Eskzvbn0gz6OxUQjgSulYsVqDMGD/Qyu9ZsrJVyPpl5ZZfeTC/DUVgVBbs OzFCEeJPweNdLtLkYi/lJi8s3pTiWqfnjii7mE+F1TMbu73XAoYos07wWZWr81OadcnP MaDBtC0ivyFHBhLRgQpyVTFybIN+eUgBrB4RUv2DENTo2UFj6cyAVutuGLkl3Tp2bHp0 uCWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=VlvLstuU; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id dd22-20020a1709069b9600b007c16fdf87c1si12033675ejc.746.2023.01.10.01.05.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 01:05:16 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=VlvLstuU; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 45C9E3858C20 for ; Tue, 10 Jan 2023 09:05:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 45C9E3858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673341515; bh=FvkNfyF14aqODlSdcDVGl4JyyXE0JKb6iZksMB9FtBs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=VlvLstuUdOA2Zynk4gCpf9EFiSFGDodeQE6QxW7UUvb/GXCy9TZEdqkXMACi9bz5Y aHnPiyKunhgHd2F61K7sn06O7AGAZdX/yvnjDBRiV5CNwH4sBHbYaGlvIyVNX2qVfD rOPlBM482ec7MzwlXpTO0okJOkzZ8U7XiTVqRf24= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 97D6C3858C78 for ; Tue, 10 Jan 2023 09:04:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 97D6C3858C78 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30A8vqQS003479 for ; Tue, 10 Jan 2023 09:04:32 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3n0swwq7ps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 10 Jan 2023 09:04:32 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 309NjEXT012419 for ; Tue, 10 Jan 2023 09:04:29 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma01fra.de.ibm.com (PPS) with ESMTPS id 3my0c6b7nc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 10 Jan 2023 09:04:29 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30A94REW46989702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 10 Jan 2023 09:04:27 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CD2520049 for ; Tue, 10 Jan 2023 09:04:27 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1A2AB2004D for ; Tue, 10 Jan 2023 09:04:27 +0000 (GMT) Received: from li-ecc9ffcc-3485-11b2-a85c-e633c5126265.ibm.com (unknown [9.179.3.190]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP for ; Tue, 10 Jan 2023 09:04:27 +0000 (GMT) To: gcc-patches@gcc.gnu.org Subject: [Committed] IBM zSystems: Make -fcall-saved-... work. Date: Tue, 10 Jan 2023 10:04:26 +0100 Message-Id: <20230110090426.11475-1-krebbel@linux.ibm.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: AFmMcVCdAiyMlsJ7rSYCTg-Sbnnzng02 X-Proofpoint-GUID: AFmMcVCdAiyMlsJ7rSYCTg-Sbnnzng02 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-10_02,2023-01-09_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 malwarescore=0 mlxlogscore=884 bulkscore=0 impostorscore=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301100054 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andreas Krebbel via Gcc-patches From: Andreas Krebbel Reply-To: Andreas Krebbel Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754625753374840425?= X-GMAIL-MSGID: =?utf-8?q?1754625753374840425?= Committed to mainline. Bootstrap and regression tests are clean. gcc/ChangeLog: * config/s390/s390.cc (s390_register_info): Check call_used_regs instead of hard-coding the register numbers for call saved registers. (s390_optimize_register_info): Likewise. gcc/testsuite/ChangeLog: * gcc.target/s390/fcall-saved.c: New test. --- gcc/config/s390/s390.cc | 10 ++++------ gcc/testsuite/gcc.target/s390/fcall-saved.c | 11 +++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/fcall-saved.c diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc index 42177c204f6..a9bb610385b 100644 --- a/gcc/config/s390/s390.cc +++ b/gcc/config/s390/s390.cc @@ -10075,8 +10075,8 @@ s390_register_info () memset (cfun_frame_layout.gpr_save_slots, SAVE_SLOT_NONE, 16); - for (i = 6; i < 16; i++) - if (clobbered_regs[i]) + for (i = 0; i < 16; i++) + if (clobbered_regs[i] && !call_used_regs[i]) cfun_gpr_save_slot (i) = SAVE_SLOT_STACK; s390_register_info_stdarg_fpr (); @@ -10136,10 +10136,8 @@ s390_optimize_register_info () || cfun_frame_layout.save_return_addr_p || crtl->calls_eh_return); - memset (cfun_frame_layout.gpr_save_slots, SAVE_SLOT_NONE, 6); - - for (i = 6; i < 16; i++) - if (!clobbered_regs[i]) + for (i = 0; i < 16; i++) + if (!clobbered_regs[i] || call_used_regs[i]) cfun_gpr_save_slot (i) = SAVE_SLOT_NONE; s390_register_info_set_ranges (); diff --git a/gcc/testsuite/gcc.target/s390/fcall-saved.c b/gcc/testsuite/gcc.target/s390/fcall-saved.c new file mode 100644 index 00000000000..a08155372f9 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/fcall-saved.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -fcall-saved-r4" } */ + +void test(void) { + asm volatile("nop" ::: "r4"); +} + +/* { dg-final { scan-assembler-times "\tstg\t" 1 { target { lp64 } } } } */ +/* { dg-final { scan-assembler-times "\tlg\t" 1 { target { lp64 } } } } */ +/* { dg-final { scan-assembler-times "\tst\t" 1 { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler-times "\tl\t" 1 { target { ! lp64 } } } } */