From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 9E5D9385DC14 for ; Sat, 8 Jan 2022 16:35:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9E5D9385DC14 Received: by mail-pl1-x62e.google.com with SMTP id n16so7938838plc.2 for ; Sat, 08 Jan 2022 08:35:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=AbhM/cgW4fEPRgkfOtLdR2pW7uhnynryihnMPWuuDPo=; b=eOjuM/uONd/1c/wrK7Xe8Nvsav5um0SOXmkWZHLEtXiiSMQCHUMF7EFcGbqjbbxAlu yhK60tQD2gFYMePry66NXWxZ9k2vKLgG/ucwNmozrjUAI0lC1oL6vUJFwRaSnQqCHwlh F916T/KwR3ZCUJ6/KETiDN36ew3JKM11dBMIPjQnUdAbb7/32OGMpsd4pYsvuNDHbRJq QG/cbfvN9IXVPsBKEAUC3z54xc/F38AvjpeJF8HyPZby03tfVQQXSJ+v8cz3uKjLlCyx UEZndRtIChKtKEslsHOelPCez5yIyYpbbu3L5zv2XSyMb0AKKCSO5khR2miocMayIp2r RwQw== X-Gm-Message-State: AOAM5326pZS/ObuZAFbRCUqaRPE/cklaNo6699OHmbZWbBbTKxS2xRLV M5UNrwz1aMADIYdywGD282S/goVh0RM= X-Google-Smtp-Source: ABdhPJxSyIJrE05SEMIVQY2Gt2NNU64gPVO3Kpcg1VQxVtXXRVFN5ZEHbNB2DL1kIU7z9DnLa9je0g== X-Received: by 2002:a17:90b:380e:: with SMTP id mq14mr21445609pjb.240.1641659753680; Sat, 08 Jan 2022 08:35:53 -0800 (PST) Received: from [192.168.1.15] (65-130-85-11.slkc.qwest.net. [65.130.85.11]) by smtp.gmail.com with ESMTPSA id s12sm2646491pfg.148.2022.01.08.08.35.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Jan 2022 08:35:53 -0800 (PST) Message-ID: <6238c748-c7f3-159b-0464-2175eb6d1b0a@gmail.com> Date: Sat, 8 Jan 2022 09:35:52 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: Help with an ABI peculiarity Content-Language: en-US To: Paul Koning , Iain Sandoe Cc: GCC Development References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jan 2022 16:35:55 -0000 On 1/7/2022 2:55 PM, Paul Koning via Gcc wrote: > >> On Jan 7, 2022, at 4:06 PM, Iain Sandoe wrote: >> >> Hi Folks, >> >> In the aarch64 Darwin ABI we have an unusual (OK, several unusual) feature of the calling convention. >> >> When an argument is passed *in a register* and it is integral and less than SI it is promoted (with appropriate signedness) to SI. This applies when the function parm is named only. >> >> When the same argument would be placed on the stack (i.e. we ran out of registers) - it occupies its natural size, and is naturally aligned (so, for instance, 3 QI values could be passed as 3 registers - promoted to SI .. or packed into three adjacent bytes on the stack).. >> >> The key is that we need to know that the argument will be placed in a register before we decide whether to promote it. >> (similarly, the promotion is not done in the callee for the in-register case). >> >> I am trying to figure out where to implement this. > I don't remember the MIPS machinery well enough, but is that a similar case? It too has register arguments (4 or 8 of them) along with stack arguments (for the rest). Most targets these days use registers for parameter passing and obviously we can run out of registers on all of them.  The key property is the size/alignment of the argument differs depending on if it's pass in a register (get promoted) or passed in memory (not promoted).  I'm not immediately aware of another ABI with that feature.  Though I haven't really gone looking. jeff