aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKewen Lin <linkw@linux.ibm.com>2021-11-29 21:22:32 -0600
committerKewen Lin <linkw@linux.ibm.com>2021-11-29 21:22:32 -0600
commit6c7d489a1e6592bc73db03678c1231748fd7a126 (patch)
treef8bc09379c1a4dcbb0de0b7ab4f2e3dfede31599 /gcc
parentaca68829d723a11f73b84d59401568015959f432 (diff)
downloadgcc-6c7d489a1e6592bc73db03678c1231748fd7a126.zip
gcc-6c7d489a1e6592bc73db03678c1231748fd7a126.tar.gz
gcc-6c7d489a1e6592bc73db03678c1231748fd7a126.tar.bz2
rs6000: Remove builtin mask check from builtin_decl [PR102347]
As the discussion in PR102347, currently builtin_decl is invoked so early, it's when making up the function_decl for builtin functions, at that time the rs6000_builtin_mask could be wrong for those builtins sitting in #pragma/attribute target functions, though it will be updated properly later when LTO processes all nodes. This patch is to align with the practice i386 port adopts, also align with r10-7462 by relaxing builtin mask checking in some places. gcc/ChangeLog: PR target/102347 * config/rs6000/rs6000-call.c (rs6000_builtin_decl): Remove builtin mask check. gcc/testsuite/ChangeLog: PR target/102347 * gcc.target/powerpc/pr102347.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/rs6000/rs6000-call.c14
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr102347.c15
2 files changed, 19 insertions, 10 deletions
diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index a532be4..cd477fa 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -16633,7 +16633,10 @@ rs6000_new_builtin_decl (unsigned code, bool /* initialize_p */)
return rs6000_builtin_decls_x[code];
}
-/* Returns the rs6000 builtin decl for CODE. */
+/* Returns the rs6000 builtin decl for CODE. Note that we don't check
+ the builtin mask here since there could be some #pragma/attribute
+ target functions and the rs6000_builtin_mask could be wrong when
+ this checking happens, though it will be updated properly later. */
tree
rs6000_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
@@ -16641,18 +16644,9 @@ rs6000_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
if (new_builtins_are_live)
return rs6000_new_builtin_decl (code, initialize_p);
- HOST_WIDE_INT fnmask;
-
if (code >= RS6000_BUILTIN_COUNT)
return error_mark_node;
- fnmask = rs6000_builtin_info[code].mask;
- if ((fnmask & rs6000_builtin_mask) != fnmask)
- {
- rs6000_invalid_builtin ((enum rs6000_builtins)code);
- return error_mark_node;
- }
-
return rs6000_builtin_decls[code];
}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr102347.c b/gcc/testsuite/gcc.target/powerpc/pr102347.c
new file mode 100644
index 0000000..05c439a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr102347.c
@@ -0,0 +1,15 @@
+/* { dg-do link } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-flto -mdejagnu-cpu=power9" } */
+
+/* Verify there are no error messages in LTO mode. */
+
+#pragma GCC target "cpu=power10"
+int main ()
+{
+ float *b;
+ __vector_quad c;
+ __builtin_mma_disassemble_acc (b, &c);
+ return 0;
+}