From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id 5C2013858437 for ; Mon, 11 Dec 2023 16:02:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C2013858437 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5C2013858437 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702310547; cv=none; b=suDvbrt/2vpfOsgZPVZwtQH9Ubar32vyMSt27tQoBdzhb+YA7upTYieFsoeTapgl+WdWdFauL8GV8B0Z6V2v5BPt7tL0UtBGlJ8pIoYxUhgCJcA5oHfW6h4MBBOjGlVvXfwPx7kFEYd5QGeUAogQ9iv8T4y7wohociy5mGHWAPs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702310547; c=relaxed/simple; bh=fv1HTLjhu1g6/2sd3wzUV7uUc/x1LgI2CcCOPWCZIlA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=WiS2lbwXzp06itkwp5us6tQOL4u87jm5W7sdNMwWGCHawEkzDt5XOqWNTNrfuFv7RrKdeTyYXXtaO7wAdBoy0vqVPhLH7XQNevUULBRRup1g1m9laaYJwZISecJJqjEBzyLACHrdg1QdbO1hoaBYlUpOqF5OfoTgRz8eCnE7p5I= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-289d988a947so3235200a91.0 for ; Mon, 11 Dec 2023 08:02:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702310545; x=1702915345; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+qhrELMn1B51iOi7RvG2ezZZ7moSZv2bXwE8dtGFpp4=; b=nFz6xa+qTLlGYJ3F0E2MwcigKtHF+TpWgbF2IyHSkA2H/Rzmf0C7Wzual4YVMK56zj yuDGAFYwkCGzkgEsuHzqvV7YWTnPbd46BCvY1O/oXbalg1OhA9hTVT5/vB5fFtljaJD/ RGA+jT8S+/ykaj5gxsgt/dhV1l6wiwjbbfHk1qiq6GTNz7Dt29i/iNZtulImD6CBS1ho sB9bYPvZRbU7/5/JZsoSyuOZhkJyW2Mt0AzXE01utR+i1YCkFpJdU+IhGWN8KpG+zPCm BqwB0tpfr1GeT3q0iZzKudGooWn5MNBIyhpMo8ieyDBKD328osSMfeo0bezs1VF7fClH 1EsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702310545; x=1702915345; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+qhrELMn1B51iOi7RvG2ezZZ7moSZv2bXwE8dtGFpp4=; b=Ko9nUXHtPiPyDn7g0rrZDSifwItTMO1LhALpHAnHQGgOeMvsH08JRUG+vfAVKJr8gS YfbiF48yp8gIRchngvewSfzGZgNi1+SiSdErLSU/q2Ib/6XNrbXPX+AJ13yHI/ZANmiJ kl0KL/d9ZvbYqDTv/JBzQCl+9/55vEDq2RmmhEheB50ot8YN+2mSIWIzjqIjmBi4EK/g 6Ma7sdKv5mq+2pevRaGxVJzCrS6lapS32Tyns8C+DazTVbwTNLZ7DtF0/T+zhNSMi/pt i77EXeIt54pcrfwGDPY87DRsPVDbMOxQizj6IODrtJN8cfFcJnOxQdmtKX3zny3NunJH Raug== X-Gm-Message-State: AOJu0YxkKCdfR1z/OU3MTIGAyGJzvCDYw/CHpoXE4Ty9n+mlcZGLFedZ esqVO/TXWCki6fjfmYgIALJEDhPXxn0= X-Google-Smtp-Source: AGHT+IF5eGoCKpWSz2J/140w2hlTn7sPHBdtHaNXb3S9Z13FXfWziqROdDB++iW/I/zV2Z74G/20FA== X-Received: by 2002:a17:90b:1950:b0:286:73b5:b388 with SMTP id nk16-20020a17090b195000b0028673b5b388mr2032386pjb.38.1702310545234; Mon, 11 Dec 2023 08:02:25 -0800 (PST) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id f5-20020a17090aec8500b00286f5f0dcb8sm7275886pjy.10.2023.12.11.08.02.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Dec 2023 08:02:23 -0800 (PST) Message-ID: Date: Mon, 11 Dec 2023 09:02:18 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] untyped calls: enable target switching [PR112334] Content-Language: en-US To: Alexandre Oliva , gcc-patches@gcc.gnu.org References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_ABUSEAT,RCVD_IN_DNSWL_NONE,RCVD_IN_XBL,SPF_HELO_NONE,SPF_PASS,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 12/1/23 08:10, Alexandre Oliva wrote: > On Dec 1, 2023, Alexandre Oliva wrote: > >> Also tested on arm-eabi, but it's *not* enough (or needed) to fix the >> PR, there's another bug lurking there, with a separate patch coming >> up. > > Here it is. > > ---- > > The computation of apply_args_size and apply_result_size is saved in a > static variable, so that the corresponding _mode arrays are > initialized only once. That is not compatible with switchable > targets, and ARM's arm_set_current_function, by saving and restoring > target globals, exercises this problem with a testcase such as that in > the PR, in which more than one function in the translation unit calls > __builtin_apply or __builtin_return, respectively. > > This patch moves the _size statics into the target_builtins array, > with a bit of ugliness over _plus_one so that zero initialization of > the struct does the right thing. > > Regstrapped on x86_64-linux-gnu, tested on arm-eabi with and without the > upthread patch. It fixes the hardcfr fails either way. As for the > ugliness, there's a follow up patch below that attempts to alleviate it > a little (also regstrapped and tested), but I'm not sure we want to go > down that path. WDYT? It's a wart, but doesn't seem too bad to me. > > > for gcc/ChangeLog > > PR target/112334 > * builtins.h (target_builtins): Add fields for apply_args_size > and apply_result_size. > * builtins.cc (apply_args_size, apply_result_size): Cache > results in fields rather than in static variables. > (get_apply_args_size, set_apply_args_size): New. > (get_apply_result_size, set_apply_result_size): New. OK. > > untyped calls: use wrapper class type for implicit plus_one > > Instead of get and set macros to apply a delta, use a single macro > that resorts to a temporary wrapper class to apply it. > > To be combined (or not) with the previous patch. I'd be OK with this as well. jeff