From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from einhorn-mail-out.in-berlin.de (einhorn-mail-out.in-berlin.de [217.197.80.21]) by sourceware.org (Postfix) with ESMTPS id 0FC6B388E835 for ; Mon, 1 Mar 2021 08:17:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0FC6B388E835 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ubuntu.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=doko@ubuntu.com X-Envelope-From: doko@ubuntu.com Received: from authenticated.user (localhost [127.0.0.1]) by einhorn.in-berlin.de with ESMTPSA id 1218HMOn002908 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 1 Mar 2021 09:17:23 +0100 Subject: Re: [PATCH] RISC-V: Implment __builtin_thread_pointer To: Jim Wilson , Kito Cheng Cc: GCC Patches , Kito Cheng References: <20200707095214.65476-1-kito.cheng@sifive.com> From: Matthias Klose Message-ID: Date: Mon, 1 Mar 2021 09:17:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Mar 2021 08:17:26 -0000 On 7/8/20 9:59 PM, Jim Wilson wrote: > On Tue, Jul 7, 2020 at 2:52 AM Kito Cheng wrote: >> gcc/ChangeLog: >> * gcc/config/riscv/riscv.md (): New. >> (TP_REGNUM): Ditto. >> * doc/extend.texi (Target Builtins): Add RISC-V built-in section. >> Document __builtin_thread_pointer. >> gcc/testsuite/ChangeLog: >> * gcc.target/riscv/read-thread-pointer.c: New. > > It looks OK to me in general. > > You added builtin_thread_pointer but not builtin_set_thread_pointer. > Maybe we should implement both as long as we are implementing one? If > clang only implements one, maybe it should implement the other also? > This doesn't have to be part of this patch. This could be a separate > issue. > > The builtin_thread_pointer docs looks out-of-date. It is documented > for alpha and SH, but it is implemented in gcc/builtins.c not in the > backends. A scan of md files show that quite a few targets support it > but don't document it. I think it should be documented in the generic > builtins section not in the target dependent builtins sections with > some language that says not all targets support it. This doesn't have > to be part of this patch. This could be a separate issue. > > We have two existing undocumented builtins. __builtin_riscv_fsflags > and __builtin_riscv_frflags for setting or reading the FP flags. I > don't know if anyone uses them though. newlib and glbic both use > extended asms for these operations. This doesn't have to be part of > this patch. This could be a separate issue. > > There is a document https://github.com/riscv/riscv-c-api-doc for > coordinating gcc and llvm work that has an empty list of builtin > functions. I'm not sure if this document is still useful. If this is > a RISC-V specific builtin then it should be listed here, but I don't > think it should be considered a RISC-V specific builtin. There is an > unresolved pull request for the frflags and fsflags builtins. I guess > I forgot about that. > > Jim LLVM 12 now uses __builtin_thread_pointer, and fails to build with GCC 10 (but builds with GCC 11). Could you consider backporting this one to GCC 10? Thanks, Matthias