Commit e6c7bfdb by Julia Koval Committed by Julia Koval

re PR target/83618 (_rdpid_u32 doesn't work on 64-bit targets as gas expects the 64-bit register)

PR target/83618

gcc/
	* config/i386/i386.c (ix86_expand_builtin): Handle IX86_BUILTIN_RDPID.
	* config/i386/i386.md (rdpid_rex64) New.
	(rdpid): Make 32bit only.

gcc/testsuite/
	* gcc.target/i386/rdpid.c: Remove "eax".

From-SVN: r257229
parent 7aec1b82
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
......
......@@ -36736,6 +36736,29 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
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:
......@@ -20559,7 +20559,14 @@
(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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment