Message ID | 20240205145606.93835-1-iain@sandoe.co.uk |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp926320dyb; Mon, 5 Feb 2024 06:56:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPOqKKGf5IWxDcfzaNlTmo7+PGfi5UFpgq6s1uIrpx7gKhfWNtQzh5h9ZHD5DT7CorEaGw X-Received: by 2002:a05:6214:301e:b0:686:ad1a:ecb7 with SMTP id ke30-20020a056214301e00b00686ad1aecb7mr7519290qvb.42.1707145017220; Mon, 05 Feb 2024 06:56:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707145017; cv=pass; d=google.com; s=arc-20160816; b=ZqzdKmBBOyQp4iFll0fKjWJFfZkpaxuUWCCm3qtEYjlprLTJs5D0dY+XP798+45Lj9 qTlXSobFhTVy39qyyd7DZbttvCz/eAU3AIYgDl4Y9UZ2oaEowRRchBGJT9upKf829dbz MS6eHU4lB9FEJrqEVp6VIks18RlQ9uNVGPwyCA9XBz/licRnRVP0Iw/5V0DcQS1l85Wg b7JEr00VlpXCrmxVebMUx1G+2itJLiM1LdbkAox4dH6nuifxCZyu+z1Xte6kg8uoBVXC 6670jrnx/GwwEzoqsIEZdPnS7U/qjVMnY/YZM0OqvonNMmCjfenvvy2J1RQyzO89lGwp JacQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=lzs0VWNEsm3IYxuSqRUM7qhbRC4nXuEV9OofleO1epo=; fh=Nu3TpmqlPc6MqFm3PLP/kvXMhYnpc69oky23Z6N1+Ow=; b=rvrIv6IeQKpvhNtsEuHSFasmnbwisxGzjzQIfXpIVqF4WBaMFba5nL0NWa28AZgGc5 aFJrU0PbbPG3NAfJfycJQKJ7PgS/xQp1ZXDY6BU+YYftU8T3mEbILlJuTaUqwuA8NugP t9m+fExVsfIDqBodwT/8Rp36W5Z4kj3BoyWllGmdRu/sol9Opky9uxWjuIjitUGzNbHp 37S2pikEy/7tKJNK4nMWMY2A/aQqtWO3wZlvTyWTEux84qYcd/Zit9/CDYmeWhdXuKEe Cnb6M9Vgz2zefjGoC+urJXLGpj7uqEu3/eg9BQ+z8mbYcF6EJBsTV/XcdFcHWUj1GebM hCWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Z/zTaB9M"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=1; AJvYcCWeN88Tts/IIJGBA+S4RbHIi2qjQNB+rUTy7+iLSGddhoZK+sUtryxH2haVUkAtJDWc52DDI57RdOT0Rpl6Be1Mj/iP8g== Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c7-20020a0cfb07000000b0068c9cafb620si46991qvp.582.2024.02.05.06.56.57 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 06:56:57 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Z/zTaB9M"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D530D385800A for <ouuuleilei@gmail.com>; Mon, 5 Feb 2024 14:56:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id C1873385842D for <gcc-patches@gcc.gnu.org>; Mon, 5 Feb 2024 14:56:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C1873385842D 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 C1873385842D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707144971; cv=none; b=MhmtjA5TY1dfZEQ/gwN6WtmTeJtQ5YxJvwdSbM8qRcfWfkJIb4HsMKrmT9oYe18nFa3y6GAOWty5BJFDKAQF5BWOO34z/r9eSDW7L+SGe5QokOfzP+yb7DZIfb/jQmKOyvMcR6F/0Qpd62Pa8p+ruyEon8A7WW/NsU9S6E6+o9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707144971; c=relaxed/simple; bh=bmkZVABDaOdBly2FEvexTJVWAQGcx7GyC7teIw8iVVQ=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=NQN9DOeRr6lLtv2K9WBpy2nPiHAdu+BYf4D0gbXDoYZcPGnhJPeDudaCHJIB5vHt4yz+0jJqLtRp/PnIFHbDBFxtIn7gi5LMugNNAfb552nntCWziz2dQc69wC1oxVEm0mOsp/w8aPeA3WpPkF3K12b/R9XbWSdHy9fHSitwdbA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40fb94d42e4so36151145e9.2 for <gcc-patches@gcc.gnu.org>; Mon, 05 Feb 2024 06:56:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707144968; x=1707749768; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=lzs0VWNEsm3IYxuSqRUM7qhbRC4nXuEV9OofleO1epo=; b=Z/zTaB9MoPhBEILadC7ZzMvDs2hGmkpUnjPZV/YmYqP/mw7j/HJjTc8fO/irAEVab3 JHqiflkbXTlBhoONv/9FTSp9so2smN2IEGWWxDbXIn6n56aA4uAQQIgv/9W9GY4WgSTa grJwtoMHTNAo+R4abUUPbIHbejNuSOeoV+0oaIjnDik41PY5qJs27Osl8WOTsAhuYaFD x8nzV45y7vXWJQjBPAJ69O1MZgjvVrZ2NSmZxI+3xLb3CjZI3MJfk53D2P92R8SXuJYb xflIKBZFvMsZ35V/sRwlf5tdf1QAjIadF6ToSOUGWjcUs27M7z5uBfFIOW9hp/rA5tVb 8k3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707144968; x=1707749768; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lzs0VWNEsm3IYxuSqRUM7qhbRC4nXuEV9OofleO1epo=; b=aWbY4zJXFTiNvG4OlOWDrsH9lKqqWD1ufF4vusB37LkqsB7rEoCyuNajYZCyrRhnxJ vBgcwj3TVs4yEtrspZajwy/PFytP+orwPlYwqlztYf5Fk1ARZTTj2IeqTD9Of1miIrbK AzIMIzx3F/4Pp5fQ/rBH8IHK7K7LsiNVaPmpGB3DXUzXs9BeraxACtAH10R0xLzMDSAj NnJVKel6C0a3lUPj22Ot4lQVu+AcijAwNbHtE11Ame4VIuujbEuyL+7MJuaZjxFtG7YG SwNwOiTIAKR2wMTM43SGjM3SB+vs/1u+1yzieF0wiftbiRS8RPCtWeHUET04mOLvXrrD rSfQ== X-Gm-Message-State: AOJu0YxzpiELS37uYvcm7Be1jDvaJDkqikWIo1vjeGEvNID+3q8T0l5T p+nojG//r15CJvntmR3uy/DjXCQ10Pce4fAYV+8sZ+VRFcF0TF9SetiChjhn X-Received: by 2002:a05:600c:314d:b0:40e:60c3:c327 with SMTP id h13-20020a05600c314d00b0040e60c3c327mr25002wmo.1.1707144968072; Mon, 05 Feb 2024 06:56:08 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCViKq8pUKr0oa3cJIy+z8d32DBpcdR1qK8vCpzgA3xdvcPrYvrkeNPKk6YTVsw2l+NqPHLdCCqDqALTTFxwLcsxBw== Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id bd13-20020a05600c1f0d00b0040e3bdff98asm8847935wmb.23.2024.02.05.06.56.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Feb 2024 06:56:07 -0800 (PST) From: Iain Sandoe <iains.gcc@gmail.com> X-Google-Original-From: Iain Sandoe <iain@sandoe.co.uk> To: gcc-patches@gcc.gnu.org Subject: [PATCH] aarch64, acle header: Cast uint64_t pointers to DIMode. Date: Mon, 5 Feb 2024 14:56:06 +0000 Message-Id: <20240205145606.93835-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: iain@sandoe.co.uk Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790071293229716347 X-GMAIL-MSGID: 1790071293229716347 |
Series |
aarch64, acle header: Cast uint64_t pointers to DIMode.
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Iain Sandoe
Feb. 5, 2024, 2:56 p.m. UTC
Tested on aarch64-linux,darwin and a cross from aarch64-darwin to linux, OK for trunk, or some alternative is needed? thanks Iain --- 8< --- Currently, most of the acle tests fail on the Darwin port because DI mode is "long" and uint64 is "long long". The fix for this used in other headers is to cast the pointers using __builtin_aarch64_simd_di and that is what this patch does. gcc/ChangeLog: * config/aarch64/arm_acle.h (__rndr): Cast uint64 pointer to DI mode to avoid typedef mismatches. (__rndrrs): Likewise. --- gcc/config/aarch64/arm_acle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
> On 5 Feb 2024, at 14:56, Iain Sandoe <iains.gcc@gmail.com> wrote: > > Tested on aarch64-linux,darwin and a cross from aarch64-darwin to linux, > OK for trunk, or some alternative is needed? Hmm.. apparently, this fails the linaro pre-commit CI for g++ with: error: invalid conversion from 'long int*' to 'long unsigned int*' [-fpermissive] So, I guess some alternative is needed, advice welcome, Iain > thanks > Iain > > --- 8< --- > > Currently, most of the acle tests fail on the Darwin port because > DI mode is "long" and uint64 is "long long". The fix for this used > in other headers is to cast the pointers using __builtin_aarch64_simd_di > and that is what this patch does. > > gcc/ChangeLog: > > * config/aarch64/arm_acle.h (__rndr): Cast uint64 pointer to DI > mode to avoid typedef mismatches. > (__rndrrs): Likewise. > --- > gcc/config/aarch64/arm_acle.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/gcc/config/aarch64/arm_acle.h b/gcc/config/aarch64/arm_acle.h > index 2aa681090fa..823f87187b1 100644 > --- a/gcc/config/aarch64/arm_acle.h > +++ b/gcc/config/aarch64/arm_acle.h > @@ -309,14 +309,14 @@ __extension__ extern __inline int > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __rndr (uint64_t *__res) > { > - return __builtin_aarch64_rndr (__res); > + return __builtin_aarch64_rndr ((__builtin_aarch64_simd_di *) __res); > } > > __extension__ extern __inline int > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __rndrrs (uint64_t *__res) > { > - return __builtin_aarch64_rndrrs (__res); > + return __builtin_aarch64_rndrrs ((__builtin_aarch64_simd_di *) __res); > } > > #pragma GCC pop_options > -- > 2.39.2 (Apple Git-143) >
Iain Sandoe <iains.gcc@gmail.com> writes: >> On 5 Feb 2024, at 14:56, Iain Sandoe <iains.gcc@gmail.com> wrote: >> >> Tested on aarch64-linux,darwin and a cross from aarch64-darwin to linux, >> OK for trunk, or some alternative is needed? > > Hmm.. apparently, this fails the linaro pre-commit CI for g++ with: > error: invalid conversion from 'long int*' to 'long unsigned int*' [-fpermissive] > > So, I guess some alternative is needed, advice welcome, The builtins are registered with: static void aarch64_init_rng_builtins (void) { tree unsigned_ptr_type = build_pointer_type (unsigned_intDI_type_node); ... Does it work if you change unsigned_intDI_type_node to get_typenode_from_name (UINT64_TYPE)? Thanks, Richard
> On 15 Feb 2024, at 18:05, Richard Sandiford <richard.sandiford@arm.com> wrote: > > Iain Sandoe <iains.gcc@gmail.com> writes: >>> On 5 Feb 2024, at 14:56, Iain Sandoe <iains.gcc@gmail.com> wrote: >>> >>> Tested on aarch64-linux,darwin and a cross from aarch64-darwin to linux, >>> OK for trunk, or some alternative is needed? >> >> Hmm.. apparently, this fails the linaro pre-commit CI for g++ with: >> error: invalid conversion from 'long int*' to 'long unsigned int*' [-fpermissive] >> >> So, I guess some alternative is needed, advice welcome, > > The builtins are registered with: > > static void > aarch64_init_rng_builtins (void) > { > tree unsigned_ptr_type = build_pointer_type (unsigned_intDI_type_node); > ... > > Does it work if you change unsigned_intDI_type_node to > get_typenode_from_name (UINT64_TYPE)? Yes, that works fine; tested on aarch64-linux and aarch64-darwin. revised, as below, OK for trunk? Iain Subject: [PATCH] aarch64: Register rng builtins with uint64_t pointers. Currently, these are registered as unsigned_intDI_type_node which is not necessarily the same type definition as uint64_t. On platforms where these differ that causes fails in consuming the arm_acle.h header. gcc/ChangeLog: * config/aarch64/aarch64-builtins.cc (aarch64_init_rng_builtins): Register these builtins with a pointer to uint64_t rather than unsigned DI mode. --- gcc/config/aarch64/aarch64-builtins.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc index e211a7271ba..1330558f109 100644 --- a/gcc/config/aarch64/aarch64-builtins.cc +++ b/gcc/config/aarch64/aarch64-builtins.cc @@ -1759,7 +1759,8 @@ aarch64_init_tme_builtins (void) static void aarch64_init_rng_builtins (void) { - tree unsigned_ptr_type = build_pointer_type (unsigned_intDI_type_node); + tree unsigned_ptr_type + = build_pointer_type (get_typenode_from_name (UINT64_TYPE)); tree ftype = build_function_type_list (integer_type_node, unsigned_ptr_type, NULL); aarch64_builtin_decls[AARCH64_BUILTIN_RNG_RNDR]
Iain Sandoe <iain@sandoe.co.uk> writes: >> On 15 Feb 2024, at 18:05, Richard Sandiford <richard.sandiford@arm.com> wrote: >> >> Iain Sandoe <iains.gcc@gmail.com> writes: >>>> On 5 Feb 2024, at 14:56, Iain Sandoe <iains.gcc@gmail.com> wrote: >>>> >>>> Tested on aarch64-linux,darwin and a cross from aarch64-darwin to linux, >>>> OK for trunk, or some alternative is needed? >>> >>> Hmm.. apparently, this fails the linaro pre-commit CI for g++ with: >>> error: invalid conversion from 'long int*' to 'long unsigned int*' [-fpermissive] >>> >>> So, I guess some alternative is needed, advice welcome, >> >> The builtins are registered with: >> >> static void >> aarch64_init_rng_builtins (void) >> { >> tree unsigned_ptr_type = build_pointer_type (unsigned_intDI_type_node); >> ... >> >> Does it work if you change unsigned_intDI_type_node to >> get_typenode_from_name (UINT64_TYPE)? > > Yes, that works fine; tested on aarch64-linux and aarch64-darwin. > > revised, as below, > OK for trunk? > Iain > > > Subject: [PATCH] aarch64: Register rng builtins with uint64_t pointers. > > Currently, these are registered as unsigned_intDI_type_node which is not > necessarily the same type definition as uint64_t. On platforms where these > differ that causes fails in consuming the arm_acle.h header. > > gcc/ChangeLog: > > * config/aarch64/aarch64-builtins.cc (aarch64_init_rng_builtins): > Register these builtins with a pointer to uint64_t rather than unsigned > DI mode. OK, thanks. Richard > --- > gcc/config/aarch64/aarch64-builtins.cc | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc > index e211a7271ba..1330558f109 100644 > --- a/gcc/config/aarch64/aarch64-builtins.cc > +++ b/gcc/config/aarch64/aarch64-builtins.cc > @@ -1759,7 +1759,8 @@ aarch64_init_tme_builtins (void) > static void > aarch64_init_rng_builtins (void) > { > - tree unsigned_ptr_type = build_pointer_type (unsigned_intDI_type_node); > + tree unsigned_ptr_type > + = build_pointer_type (get_typenode_from_name (UINT64_TYPE)); > tree ftype > = build_function_type_list (integer_type_node, unsigned_ptr_type, NULL); > aarch64_builtin_decls[AARCH64_BUILTIN_RNG_RNDR]
diff --git a/gcc/config/aarch64/arm_acle.h b/gcc/config/aarch64/arm_acle.h index 2aa681090fa..823f87187b1 100644 --- a/gcc/config/aarch64/arm_acle.h +++ b/gcc/config/aarch64/arm_acle.h @@ -309,14 +309,14 @@ __extension__ extern __inline int __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __rndr (uint64_t *__res) { - return __builtin_aarch64_rndr (__res); + return __builtin_aarch64_rndr ((__builtin_aarch64_simd_di *) __res); } __extension__ extern __inline int __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __rndrrs (uint64_t *__res) { - return __builtin_aarch64_rndrrs (__res); + return __builtin_aarch64_rndrrs ((__builtin_aarch64_simd_di *) __res); } #pragma GCC pop_options