re PR target/88195 (misleading error message for unsupported builtin)
authorJakub Jelinek <jakub@redhat.com>
Mon, 26 Nov 2018 21:26:19 +0000 (22:26 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 26 Nov 2018 21:26:19 +0000 (22:26 +0100)
PR target/88195
* config/i386/i386.c (def_builtin2): If tcode == VOID_FTYPE_UINT64
and !TARGET_64BIT, return NULL_TREE.

* gcc.target/i386/pr88195.c: New test.

From-SVN: r266487

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr88195.c [new file with mode: 0644]

index 42f2ff059e3f0616777780e32837100078bc1169..2d7bcb83f33da89584a45b61ab68dc7ac8a6974b 100644 (file)
@@ -1,5 +1,9 @@
 2018-11-26  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/88195
+       * config/i386/i386.c (def_builtin2): If tcode == VOID_FTYPE_UINT64
+       and !TARGET_64BIT, return NULL_TREE.
+
        PR c++/86900
        * dwarf2out.c (secname_for_decl): For functions with
        DECL_SECTION_NAME if in_cold_section_p, try to return
index 851598004ccf02ec07179268ff52e7928212e1e8..95abde95f89dd3b2b1dadc35c69d0b461e545a04 100644 (file)
@@ -30220,9 +30220,13 @@ def_builtin2 (HOST_WIDE_INT mask, const char *name,
 {
   tree decl = NULL_TREE;
 
-  ix86_builtins_isa[(int) code].isa2 = mask;
   if (tcode == VOID_FTYPE_UINT64)
-    ix86_builtins_isa[(int) code].isa = OPTION_MASK_ISA_64BIT;
+    {
+      if (!TARGET_64BIT)
+       return decl;
+      ix86_builtins_isa[(int) code].isa = OPTION_MASK_ISA_64BIT;
+    }
+  ix86_builtins_isa[(int) code].isa2 = mask;
 
   if (mask == 0
       || (mask & ix86_isa_flags2) != 0
index 4043524049da166d537be5bf22b1c22e0e45cec6..47f8b19935758fbf151baf39d4fa2548cbcc717a 100644 (file)
@@ -1,5 +1,8 @@
 2018-11-26  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/88195
+       * gcc.target/i386/pr88195.c: New test.
+
        PR testsuite/88090
        * obj-c++.dg/attributes/method-nonnull-1.mm (my_size_t): New typedef.
        (MyArray::removeObjectAtIndex): Use my_size_t instead of size_t and
diff --git a/gcc/testsuite/gcc.target/i386/pr88195.c b/gcc/testsuite/gcc.target/i386/pr88195.c
new file mode 100644 (file)
index 0000000..cd12adc
--- /dev/null
@@ -0,0 +1,8 @@
+/* PR target/88195 */
+/* { dg-options "-mptwrite" } */
+
+void
+foo (void)
+{
+  __builtin_ia32_ptwrite64 (1);        /* { dg-warning "implicit declaration of function" "" { target ia32 } } */
+}