From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id BF21B3857437 for ; Tue, 9 May 2023 16:01:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BF21B3857437 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-64115e652eeso43674595b3a.0 for ; Tue, 09 May 2023 09:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1683648108; x=1686240108; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+QX/OnsxP5UogujbRvS8zOrjn5UHk9fKtuZT0dvU3pI=; b=ibUIHntOnn2fH4CW9qrBMaxgqawxCmoKKCsqyHUtN3+0ucu7TBHuTzee0s+QCE227H hC3n8CsDrUj5rHfp5hvcPtDXbJxtgtia+QuV/r3E6Dt71rXeVuUyAMQk59dkMHmbIolW 2LUevkdm9LirDVs+bJo4eid901nl8Fe1p4r1FfD3XYDYbwhQk0NMxiYrro/rUauNoVUy vSNhpM9h5rJW9PXyUiMYyfutyZUV8uiTkpfRIvCYbhfRtJnxaSLanJ+xhJP+yFKrujrl MVc1vqY87kt1M1+kwgJthZFBivwljusb7gX9YyArpatee7k7Stp4kFMHpVyBYUDU1JL0 ikYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683648108; x=1686240108; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+QX/OnsxP5UogujbRvS8zOrjn5UHk9fKtuZT0dvU3pI=; b=L9LuLQBy+9w5XIn7mRAL/LY6oXA7gy0kG9DPIzV8ZAIEZxvMiSlm1sIByAfin0BbvU QF9L87xemD2RQxD9y9jjMhX6vbWd2MIj+xAfBzY6dIVKwr20iYUVn0VpkzRraeVgk2qM 4EsvoL//aejmobONxTjGpo6ET5BzL6KjWzMj5UiH8Rw2+KtKlMmlCrVmEBD660M3GQKR WnnlHkS8wm9o+9+5+8r/vYNT4yJA1Pv6BUjx1QyaUrDPOB5SpgknZsPUogPd4TYf4K2b 1Sim7Qt5huXzV/KCrp3qyhtbotmxJHIqlPB0cqTaZBXVF1b5fhBHoZgalvSDQV6X8PTJ uOTQ== X-Gm-Message-State: AC+VfDzZnU67js7vHZNEH1qgQWksFERbDyPgpqwboo5O2/kQZx4VUC8z ByotVhHJIuR3e6Yh7blozgnMawmZZGTb5CLyW7B/dA== X-Google-Smtp-Source: ACHHUZ5SAw3wSk1kIrIOo15lqy5NKZLWWACtxZh8ol93e+6hft75hA/DFnoElekcrHhIyaLFOxFLDg== X-Received: by 2002:a17:903:338e:b0:1a1:cb18:7f99 with SMTP id kb14-20020a170903338e00b001a1cb187f99mr12319999plb.30.1683648107711; Tue, 09 May 2023 09:01:47 -0700 (PDT) Received: from [10.0.17.156] ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id r15-20020a170903020f00b001a1a8e98e93sm1757031plh.287.2023.05.09.09.01.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 May 2023 09:01:47 -0700 (PDT) Message-ID: Date: Tue, 9 May 2023 09:01:45 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [gcc13 backport] RISCV: Inline subword atomic ops To: gcc-patches@gcc.gnu.org, Jeff Law Cc: palmer@rivosinc.com, richard.guenther@gmail.com, kito.cheng@gmail.com, david.abd@gmail.com, schwab@linux-m68k.org, schwab@suse.de, gnu-toolchain@rivosinc.com References: <20230503171922.1120098-1-patrick@rivosinc.com> Content-Language: en-US From: Patrick O'Neill In-Reply-To: <20230503171922.1120098-1-patrick@rivosinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,KAM_LOTSOFHASH,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: Ping. On 5/3/23 10:19, Patrick O'Neill wrote: > RISC-V has no support for subword atomic operations; code currently > generates libatomic library calls. > > This patch changes the default behavior to inline subword atomic calls > (using the same logic as the existing library call). > Behavior can be specified using the -minline-atomics and > -mno-inline-atomics command line flags. > > gcc/libgcc/config/riscv/atomic.c has the same logic implemented in asm. > This will need to stay for backwards compatibility and the > -mno-inline-atomics flag. > > 2023-05-03 Patrick O'Neill > > gcc/ChangeLog: > PR target/104338 > * config/riscv/riscv-protos.h: Add helper function stubs. > * config/riscv/riscv.cc: Add helper functions for subword masking. > * config/riscv/riscv.opt: Add command-line flags > -minline-atomics and -mno-inline-atomics. > * config/riscv/sync.md: Add masking logic and inline asm for > fetch_and_op, fetch_and_nand, CAS, and exchange ops. > * doc/invoke.texi: Add blurb regarding new command-line flags > -minline-atomics and -mno-inline-atomics. > > libgcc/ChangeLog: > PR target/104338 > * config/riscv/atomic.c: Add reference to duplicate logic. > > gcc/testsuite/ChangeLog: > PR target/104338 > * gcc.target/riscv/inline-atomics-1.c: New test. > * gcc.target/riscv/inline-atomics-2.c: New test. > * gcc.target/riscv/inline-atomics-3.c: New test. > * gcc.target/riscv/inline-atomics-4.c: New test. > * gcc.target/riscv/inline-atomics-5.c: New test. > * gcc.target/riscv/inline-atomics-6.c: New test. > * gcc.target/riscv/inline-atomics-7.c: New test. > * gcc.target/riscv/inline-atomics-8.c: New test. > > Signed-off-by: Patrick O'Neill > Signed-off-by: Palmer Dabbelt > --- > This backport includes all the subsequent fixes. > Squashed GCC-14 commits: > https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f797260adaf52bee0ec0e16190bbefbe1bfc3692 > https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=2a26872984c109a98d0ad733b0c68c3e1648ec86 > > Fixed ChangeLog: > https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=9cfdd5af3efd4a7e52ae7f97f55effc436c0cf45 > --- > The GCC-14 build error[1] was caused by the subsequent A.6 mappings > change[2], not the inline atomics change (this backport). > [1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=4bd434fbfc7865961a8e10d7e9601b28765ce7be > [2] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=bff7c77386447936dd614ebc7086b826c99c6642 > --- > There is a related follow-on GCC-14 patch to config/riscv/linux: > https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=203f3060dd363361b172f7295f42bb6bf5ac0b3b > > The changes from that patch are not included in this backport. > ---