re PR target/87550 (Intrinsics for rdpmc (__rdpmc, __builtin_ia32_rdpmc) are interpre...
authorJakub Jelinek <jakub@redhat.com>
Wed, 10 Oct 2018 09:28:26 +0000 (11:28 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 10 Oct 2018 09:28:26 +0000 (11:28 +0200)
PR target/87550
* config/i386/i386-builtin.def (IX86_BUILTIN_RDPMC): Move from args set
to special_args set.

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

From-SVN: r265007

gcc/ChangeLog
gcc/config/i386/i386-builtin.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr87550.c [new file with mode: 0644]

index 8227395dd99e30be7b250ad311b9c969584a8cfd..ced143cacd6739add35ccbf6ce144fe8a678fd77 100644 (file)
@@ -1,3 +1,9 @@
+2018-10-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/87550
+       * config/i386/i386-builtin.def (IX86_BUILTIN_RDPMC): Move from args set
+       to special_args set.
+
 2018-10-10  Richard Biener  <rguenther@suse.de>
 
        * config/i386/sse.md (reduc_plus_scal_v8df, reduc_plus_scal_v4df,
index 383f9cc890c67648756f9b2dea5d2c72658edb6b..dc4c70c7ea33a31f927f7e4b004f3f6c42a4325e 100644 (file)
@@ -90,6 +90,7 @@ BDESC_END (PCMPISTR, SPECIAL_ARGS)
 BDESC_FIRST (special_args, SPECIAL_ARGS,
        0, CODE_FOR_nothing, "__builtin_ia32_rdtsc", IX86_BUILTIN_RDTSC, UNKNOWN, (int) UINT64_FTYPE_VOID)
 BDESC (0, CODE_FOR_nothing, "__builtin_ia32_rdtscp", IX86_BUILTIN_RDTSCP, UNKNOWN, (int) UINT64_FTYPE_PUNSIGNED)
+BDESC (0, CODE_FOR_nothing, "__builtin_ia32_rdpmc", IX86_BUILTIN_RDPMC, UNKNOWN, (int) UINT64_FTYPE_INT)
 BDESC (0, CODE_FOR_pause, "__builtin_ia32_pause", IX86_BUILTIN_PAUSE, UNKNOWN, (int) VOID_FTYPE_VOID)
 
 /* 80387 (for use internally for atomic compound assignment).  */
@@ -427,7 +428,6 @@ BDESC_END (SPECIAL_ARGS, ARGS)
 BDESC_FIRST (args, ARGS,
        0, CODE_FOR_bsr, "__builtin_ia32_bsrsi", IX86_BUILTIN_BSRSI, UNKNOWN, (int) INT_FTYPE_INT)
 BDESC (OPTION_MASK_ISA_64BIT, CODE_FOR_bsr_rex64, "__builtin_ia32_bsrdi", IX86_BUILTIN_BSRDI, UNKNOWN, (int) INT64_FTYPE_INT64)
-BDESC (0, CODE_FOR_nothing, "__builtin_ia32_rdpmc", IX86_BUILTIN_RDPMC, UNKNOWN, (int) UINT64_FTYPE_INT)
 BDESC (0, CODE_FOR_rotlqi3, "__builtin_ia32_rolqi", IX86_BUILTIN_ROLQI, UNKNOWN, (int) UINT8_FTYPE_UINT8_INT)
 BDESC (0, CODE_FOR_rotlhi3, "__builtin_ia32_rolhi", IX86_BUILTIN_ROLHI, UNKNOWN, (int) UINT16_FTYPE_UINT16_INT)
 BDESC (0, CODE_FOR_rotrqi3, "__builtin_ia32_rorqi", IX86_BUILTIN_RORQI, UNKNOWN, (int) UINT8_FTYPE_UINT8_INT)
index 5a460a015dac81ef44beeabc0839300ff2ad7a7a..82417134db046cc9bdd33464677b85d33cea9f06 100644 (file)
@@ -1,5 +1,8 @@
 2018-10-10  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/87550
+       * gcc.target/i386/pr87550.c: New test.
+
        PR c/87286
        * gcc.dg/pr87286.c: Add -Wno-psabi to dg-options.
 
diff --git a/gcc/testsuite/gcc.target/i386/pr87550.c b/gcc/testsuite/gcc.target/i386/pr87550.c
new file mode 100644 (file)
index 0000000..ef77e32
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR target/87550 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <x86intrin.h>
+
+int
+foo (int x)
+{
+  return __rdtsc () + __rdtsc ();
+}
+
+/* { dg-final { scan-assembler-times "\trdtsc\[\n\r]" 2 } } */
+
+int
+bar (int x)
+{
+  return __rdpmc (0) + __rdpmc (0);
+}
+
+/* { dg-final { scan-assembler-times "\trdpmc\[\n\r]" 2 } } */