From patchwork Mon Mar 18 18:40:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1913270 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GOxRPt3l; 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 4Tz3bj1qY9z1yWn for ; Tue, 19 Mar 2024 05:41:37 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A0A58385840E for ; Mon, 18 Mar 2024 18:41:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E9ECB3858CD1 for ; Mon, 18 Mar 2024 18:41:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E9ECB3858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E9ECB3858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710787277; cv=none; b=P6uiWG8ZEkQKcIhEVqk/z96xS+rPaoIZ1IhwwysoqH3OmqoIe9ScrxM9H2nJZ2RB46dTX3OMPYNQzUff7PxTAC9afSbvjER5eyZWGRfu9y3Zwtdh0IE3x2kSPbxR1z8rUO5PjxQCE4RwybvNw1TM/kENsu5c/xUWRAN/XDWO0yc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710787277; c=relaxed/simple; bh=p8LNkwveeShJkd54oUON2Jt3Tqx+nyDW+9VjfcPrtIM=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=B8r9+u6xfCxI39UdcghY/xoZruUUz973YS27rjSkY9GiTV5Y9rjRoJUzdQwmmgcch2rZUs3zZgU4A/a/h8PrtBi4YMOz356jhdpGb+t/V0X5whCkN0t2KvCS6JEvZ+jYOzw52bGOcalnBOlEVyqBl1SIxPOFWS+FMTKTU/StgRw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710787274; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=aiTCLOv0JbZKMq0uGmh+vNBrLypzm71iHsItFEeiTeM=; b=GOxRPt3li+hmFIHqU4bwBEEDtmGexePzcnNN8tH87EZZrloGGM6kuiDzw2bDpGSzyZsHkc i9u/TPGZIZNzLkexlJ71DmCIDG9VxpYxuvYPM0JinqFeo1qlPhPJVwcnwJZzn6TNkxoXXp UU3jTDEANYGL7TCohVep8t4HgPwNte4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-314-hhZplLARMzGpFNQl8AXJUg-1; Mon, 18 Mar 2024 14:41:13 -0400 X-MC-Unique: hhZplLARMzGpFNQl8AXJUg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BAF151C2CDE2; Mon, 18 Mar 2024 18:41:12 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E6F53C20; Mon, 18 Mar 2024 18:41:12 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 42IIenm41997213 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 18 Mar 2024 19:40:50 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 42IIen9E1997212; Mon, 18 Mar 2024 19:40:49 +0100 Date: Mon, 18 Mar 2024 19:40:49 +0100 From: Jakub Jelinek To: Uros Bizjak , Richard Henderson Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] alpha: Fix alpha_setup_incoming_varargs [PR114175] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! Like in the r14-9503 change on x86-64, I think Alpha also needs to function_arg_advance after the hidden return pointer argument if any. At least, the following patch changes the assembly of s1-s6 functions on the https://gcc.gnu.org/pipermail/gcc-patches/2024-March/647956.html c23-stdarg-9.c testcase, and eyeballing the assembly for int f8 (...) the ... args are passed in 16..21 registers and then on the stack, while for struct S s8 (...) have hidden return pointer passed in 16 register and ... args in 17..21 registers and then on the stack, and seems without this patch the incoming varargs setup does the wrong thing (but I can't test on alpha easily). Many targets seem to be unaffected, e.g. aarch64, arm, s390*, so I'm not trying to change all targets together because such a change clearly isn't needed e.g. for targets which use special register for the hidden return pointer. Ok for trunk? 2024-03-18 Jakub Jelinek PR target/114175 * config/alpha/alpha.cc (alpha_setup_incoming_varargs): Only skip function_arg_advance for TYPE_NO_NAMED_ARGS_STDARG_P functions if arg.type is NULL. Jakub --- gcc/config/alpha/alpha.cc.jj 2024-01-05 15:22:21.762686175 +0100 +++ gcc/config/alpha/alpha.cc 2024-03-18 16:12:14.594761619 +0100 @@ -6090,7 +6090,8 @@ alpha_setup_incoming_varargs (cumulative { CUMULATIVE_ARGS cum = *get_cumulative_args (pcum); - if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl))) + if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl)) + || arg.type != NULL_TREE) /* Skip the current argument. */ targetm.calls.function_arg_advance (pack_cumulative_args (&cum), arg);