+2018-01-31 Julia Koval <julia.koval@intel.com>
+
+ PR target/83618
+ * config/i386/i386.c (ix86_expand_builtin): Handle IX86_BUILTIN_RDPID.
+ * config/i386/i386.md (rdpid_rex64) New.
+ (rdpid): Make 32bit only.
+
2018-01-29 Aldy Hernandez <aldyh@redhat.com>
PR lto/84105
case IX86_BUILTIN_NANSQ:
return expand_call (exp, target, ignore);
+ case IX86_BUILTIN_RDPID:
+
+ op0 = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
+
+ if (TARGET_64BIT)
+ {
+ insn = gen_rdpid_rex64 (op0);
+ op0 = convert_to_mode (SImode, op0, 1);
+ }
+ else
+ insn = gen_rdpid (op0);
+ emit_insn (insn);
+
+ if (target == 0)
+ {
+ /* mode is VOIDmode if __builtin_rdpid has been called
+ without lhs. */
+ if (mode == VOIDmode)
+ return target;
+ target = gen_reg_rtx (mode);
+ }
+ emit_move_insn (target, op0);
+ return target;
case IX86_BUILTIN_RDPMC:
case IX86_BUILTIN_RDTSC:
case IX86_BUILTIN_RDTSCP:
(define_insn "rdpid"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec_volatile:SI [(const_int 0)] UNSPECV_RDPID))]
- "TARGET_RDPID"
+ "!TARGET_64BIT && TARGET_RDPID"
+ "rdpid\t%0"
+ [(set_attr "type" "other")])
+
+(define_insn "rdpid_rex64"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_RDPID))]
+ "TARGET_64BIT && TARGET_RDPID"
"rdpid\t%0"
[(set_attr "type" "other")])
+2018-01-31 Julia Koval <julia.koval@intel.com>
+
+ PR target/83618
+ * gcc.target/i386/rdpid.c: Remove "eax".
+
2018-01-31 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR tree-optimization/64946
/* { dg-do compile } */
/* { dg-options "-O2 -mrdpid" } */
-/* { dg-final { scan-assembler "rdpid\[ \t]+(%|)eax" } } */
+/* { dg-final { scan-assembler "rdpid" } } */
#include <x86intrin.h>