From: Steve Ellcey <sellcey@marvell.com>
To: "jakub@redhat.com" <jakub@redhat.com>,
"richard.sandiford@arm.com" <richard.sandiford@arm.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
"Richard.Earnshaw@arm.com" <Richard.Earnshaw@arm.com>,
"Szabolcs.Nagy@arm.com" <Szabolcs.Nagy@arm.com>
Subject: Re: [PATCH] Fix simd attribute handling on aarch64 (version 2)
Date: Mon, 22 Jul 2019 18:26:00 -0000 [thread overview]
Message-ID: <769cba60a078a7188a4110547cb872e501397aa4.camel@marvell.com> (raw)
In-Reply-To: <mpttvbhzxuh.fsf@arm.com>
[-- Attachment #1: Type: text/plain, Size: 1449 bytes --]
On Fri, 2019-07-19 at 19:24 +0100, Richard Sandiford wrote:
>
> You can probably also remove:
>
> tree new_type = build_distinct_type_copy (TREE_TYPE (node->decl));
> ...
> TREE_TYPE (node->decl) = new_type;
>
> in simd_clone_adjust_argument_types.
>
> I'm happy doing it this way or doing the copy in the AArch64 hook.
> It's really Jakub's call.
You are right, that is no longer needed with the current patch. I
removed it and retested with no regressions. Jakub, do you have
any preference? I have attached a new version of the patch to this
email.
> I don't think the tests need:
>
> /* { dg-require-effective-target aarch64_variant_pcs } */
>
> since they're only dg-do compile. Leaving the line out would get more
> coverage for people using older binutils.
>
> The tests are OK with that change, thanks.
OK, I made that change to the tests.
Latest version of the patch:
2019-07-22 Steve Ellcey <sellcey@marvell.com>
* omp-simd-clone.c (simd_clone_adjust_return_type): Remove call to
build_distinct_type_copy.
(simd_clone_adjust_argument_types): Ditto.
(simd_clone_adjust): Call build_distinct_type_copy here.
(expand_simd_clones): Ditto.
2019-07-22 Steve Ellcey <sellcey@marvell.com>
* gcc.target/aarch64/simd_pcs_attribute.c: New test.
* gcc.target/aarch64/simd_pcs_attribute-2.c: Ditto.
* gcc.target/aarch64/simd_pcs_attribute-3.c: Ditto.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gcc-simd.patch --]
[-- Type: text/x-patch; name="gcc-simd.patch", Size: 1511 bytes --]
diff --git a/gcc/omp-simd-clone.c b/gcc/omp-simd-clone.c
index caa8da3cba5..da01d9b8e6c 100644
--- a/gcc/omp-simd-clone.c
+++ b/gcc/omp-simd-clone.c
@@ -498,7 +498,6 @@ simd_clone_adjust_return_type (struct cgraph_node *node)
/* Adjust the function return type. */
if (orig_rettype == void_type_node)
return NULL_TREE;
- TREE_TYPE (fndecl) = build_distinct_type_copy (TREE_TYPE (fndecl));
t = TREE_TYPE (TREE_TYPE (fndecl));
if (INTEGRAL_TYPE_P (t) || POINTER_TYPE_P (t))
veclen = node->simdclone->vecsize_int;
@@ -724,11 +723,6 @@ simd_clone_adjust_argument_types (struct cgraph_node *node)
else
new_reversed = void_list_node;
}
-
- tree new_type = build_distinct_type_copy (TREE_TYPE (node->decl));
- TYPE_ARG_TYPES (new_type) = new_reversed;
- TREE_TYPE (node->decl) = new_type;
-
adjustments.release ();
}
args.release ();
@@ -1164,6 +1158,7 @@ simd_clone_adjust (struct cgraph_node *node)
{
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
+ TREE_TYPE (node->decl) = build_distinct_type_copy (TREE_TYPE (node->decl));
targetm.simd_clone.adjust (node);
tree retval = simd_clone_adjust_return_type (node);
@@ -1737,6 +1732,8 @@ expand_simd_clones (struct cgraph_node *node)
simd_clone_adjust (n);
else
{
+ TREE_TYPE (n->decl)
+ = build_distinct_type_copy (TREE_TYPE (n->decl));
targetm.simd_clone.adjust (n);
simd_clone_adjust_return_type (n);
simd_clone_adjust_argument_types (n);
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: gcc-simd-test.patch --]
[-- Type: text/x-patch; name="gcc-simd-test.patch", Size: 2439 bytes --]
diff --git a/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c b/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c
index e69de29bb2d..8eec6824f37 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+__attribute__ ((__simd__ ("notinbranch")))
+__attribute__ ((__nothrow__ , __leaf__ , __const__))
+extern double foo (double x);
+
+void bar(double * f, int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ f[i] = foo(f[i]);
+}
+
+/* { dg-final { scan-assembler-not {\.variant_pcs\tfoo} } } */
+/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnN2v_foo} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c b/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c
index e69de29bb2d..95f6a6803e8 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+__attribute__ ((__simd__))
+__attribute__ ((__nothrow__ , __leaf__ , __const__))
+double foo (double x);
+
+void bar(double *f, int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ f[i] = foo(f[i]);
+}
+
+double foo(double x)
+{
+ return x * x / 3.0;
+}
+
+/* { dg-final { scan-assembler-not {\.variant_pcs\tfoo} } } */
+/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnM1v_foo} 1 } } */
+/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnM2v_foo} 1 } } */
+/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnN1v_foo} 1 } } */
+/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnN2v_foo} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c b/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c
index e69de29bb2d..eddcef3597c 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+__attribute__ ((__simd__ ("notinbranch")))
+__attribute__ ((__nothrow__ , __leaf__ , __const__))
+extern double log (double __x);
+
+void foo(double *f, int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ f[i] = log(f[i]);
+}
+
+/* { dg-final { scan-assembler-not {\.variant_pcs\tlog} } } */
+/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnN2v_log} 1 } } */
next prev parent reply other threads:[~2019-07-22 18:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-17 21:29 [PATCH] Fix simd attribute handling on aarch64 Steve Ellcey
2019-07-18 9:22 ` Richard Sandiford
2019-07-18 16:04 ` Steve Ellcey
2019-07-19 15:57 ` [PATCH] Fix simd attribute handling on aarch64 (version 2) Steve Ellcey
2019-07-19 18:26 ` Richard Sandiford
2019-07-22 18:26 ` Steve Ellcey [this message]
2019-07-29 23:00 ` Steve Ellcey
2019-07-30 13:35 ` Richard Sandiford
2019-07-30 22:14 ` Steve Ellcey
2019-07-31 7:34 ` Richard Sandiford
2019-08-07 10:51 ` Szabolcs Nagy
2019-08-07 18:16 ` Steve Ellcey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=769cba60a078a7188a4110547cb872e501397aa4.camel@marvell.com \
--to=sellcey@marvell.com \
--cc=Richard.Earnshaw@arm.com \
--cc=Szabolcs.Nagy@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=richard.sandiford@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).