From: Jakub Jelinek Date: Wed, 10 Oct 2018 09:28:26 +0000 (+0200) Subject: re PR target/87550 (Intrinsics for rdpmc (__rdpmc, __builtin_ia32_rdpmc) are interpre... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1f10b5b8db248aa640af3577cdb12ef13980b88b;p=gcc.git re PR target/87550 (Intrinsics for rdpmc (__rdpmc, __builtin_ia32_rdpmc) are interpreted as pure functions) 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8227395dd99..ced143cacd6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-10 Jakub Jelinek + + PR target/87550 + * config/i386/i386-builtin.def (IX86_BUILTIN_RDPMC): Move from args set + to special_args set. + 2018-10-10 Richard Biener * config/i386/sse.md (reduc_plus_scal_v8df, reduc_plus_scal_v4df, diff --git a/gcc/config/i386/i386-builtin.def b/gcc/config/i386/i386-builtin.def index 383f9cc890c..dc4c70c7ea3 100644 --- a/gcc/config/i386/i386-builtin.def +++ b/gcc/config/i386/i386-builtin.def @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5a460a015da..82417134db0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-10-10 Jakub Jelinek + 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 index 00000000000..ef77e321d6e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr87550.c @@ -0,0 +1,21 @@ +/* PR target/87550 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include + +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 } } */