From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 613B33858D39 for ; Fri, 1 Mar 2024 14:16:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 613B33858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 613B33858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709302582; cv=none; b=Szn3U/vY6AhzReLG10nRlSdlqXjrCchMQ+WZCaddYo+PDInSk5ieZS00Ov+2c8fyU1OQ7kXGpnu11LkpowLl8PSjBUYQE91EfzmW4EnOK/w5ZGKdYSQkxVEEGcKVRKBsSN2fzsShuiGIBp98BYpCI/aSoMIC4ioHph50PonOZ04= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709302582; c=relaxed/simple; bh=QZnDx6p7GXSEEg28nHNPWH5Ixmn5R4kq45emsMcRPmQ=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=CHOzpEHCS50/NrjyxArDKK3S3WqdYpJm0cPU0ol6zei+CWlLhk8bjAcjBmlfra+QooGIW1f4pfCFDqoUuCYENwfm7tuI6YWTXHQfva0DFwbU0+yugRqwsPLNSJQbGaM07kP4jallBPYkXxnS4oGHNEhDcN8Ss844NqpIwwU5bFk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 423F71FB; Fri, 1 Mar 2024 06:16:59 -0800 (PST) Received: from [10.2.78.54] (e120077-lin.cambridge.arm.com [10.2.78.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 00E593F73F; Fri, 1 Mar 2024 06:16:19 -0800 (PST) Message-ID: <88391f53-7299-4c69-846a-629f746e03ba@arm.com> Date: Fri, 1 Mar 2024 14:16:18 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] calls: Further fixes for TYPE_NO_NAMED_ARGS_STDARG_P handling [PR107453] Content-Language: en-GB To: Jakub Jelinek , "Joseph S. Myers" , Richard Biener , Jeff Law Cc: gcc-patches@gcc.gnu.org, =?UTF-8?Q?Torbj=C3=B6rn_SVENSSON?= , oliva@adacore.com References: <45ac2d54-21df-486c-a085-0a6c1f37a323@arm.com> <23c7c873-1954-43b2-80b8-714455eaaf2b@arm.com> From: "Richard Earnshaw (lists)" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3491.6 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no 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 29/02/2024 15:55, Jakub Jelinek wrote: > On Thu, Feb 29, 2024 at 02:14:05PM +0000, Richard Earnshaw wrote: >>> I tried the above on arm, aarch64 and x86_64 and that seems fine, >>> including the new testcase you added. >>> >> >> I should mention though, that INIT_CUMULATIVE_ARGS on arm ignores >> n_named_args entirely, it doesn't need it (I don't think it even existed >> when the AAPCS code was added). > > So far I've just checked that the new testcase passes not just on > x86_64/i686-linux, but also on {powerpc64le,s390x,aarch64}-linux > with vanilla trunk. > Haven't posted this patch in patch form, plus while I'm not really sure > whether setting n_named_args to 0 or not changing in the > !pretend_outgoing_varargs_named is right, the setting to 0 feels more > correct to me. If structure_value_addr_parm is 1, the function effectively > has a single named argument and then ... args and if the target wants > n_named_args to be number of named arguments except the last, then that > should be 0 rather than 1. > > Thus, is the following patch ok for trunk then? > > 2024-02-29 Jakub Jelinek > > PR target/107453 PR 114136 Would be more appropriate for this, I think. Otherwise, OK. R. > * calls.cc (expand_call): For TYPE_NO_NAMED_ARGS_STDARG_P set > n_named_args initially before INIT_CUMULATIVE_ARGS to > structure_value_addr_parm rather than 0, after it don't modify > it if strict_argument_naming and clear only if > !pretend_outgoing_varargs_named. > > --- gcc/calls.cc.jj 2024-01-22 11:48:08.045847508 +0100 > +++ gcc/calls.cc 2024-02-29 16:24:47.799855912 +0100 > @@ -2938,7 +2938,7 @@ expand_call (tree exp, rtx target, int i > /* Count the struct value address, if it is passed as a parm. */ > + structure_value_addr_parm); > else if (TYPE_NO_NAMED_ARGS_STDARG_P (funtype)) > - n_named_args = 0; > + n_named_args = structure_value_addr_parm; > else > /* If we know nothing, treat all args as named. */ > n_named_args = num_actuals; > @@ -2970,14 +2970,15 @@ expand_call (tree exp, rtx target, int i > we do not have any reliable way to pass unnamed args in > registers, so we must force them into memory. */ > > - if (type_arg_types != 0 > + if ((type_arg_types != 0 || TYPE_NO_NAMED_ARGS_STDARG_P (funtype)) > && targetm.calls.strict_argument_naming (args_so_far)) > ; > else if (type_arg_types != 0 > && ! targetm.calls.pretend_outgoing_varargs_named (args_so_far)) > /* Don't include the last named arg. */ > --n_named_args; > - else if (TYPE_NO_NAMED_ARGS_STDARG_P (funtype)) > + else if (TYPE_NO_NAMED_ARGS_STDARG_P (funtype) > + && ! targetm.calls.pretend_outgoing_varargs_named (args_so_far)) > n_named_args = 0; > else > /* Treat all args as named. */ > > Jakub >