diff options
author | Sebastian Peryt <sebastian.peryt@intel.com> | 2018-05-11 15:17:42 +0200 |
---|---|---|
committer | Sebastian Peryt <speryt@gcc.gnu.org> | 2018-05-11 15:17:42 +0200 |
commit | 55f31ed10fd38c50560114c47698ed0aa2b302c8 (patch) | |
tree | 5be5eee255e124ed77f310e674dc92f07c1bc408 /gcc/config/i386/i386.md | |
parent | c40a8be80895679e8100e6ed32274bbed57d6543 (diff) | |
download | gcc-55f31ed10fd38c50560114c47698ed0aa2b302c8.zip gcc-55f31ed10fd38c50560114c47698ed0aa2b302c8.tar.gz gcc-55f31ed10fd38c50560114c47698ed0aa2b302c8.tar.bz2 |
i386-common.c (OPTION_MASK_ISA_WAITPKG_SET, [...]): New defines.
2018-05-11 Sebastian Peryt <sebastian.peryt@intel.com>
gcc/
* common/config/i386/i386-common.c (OPTION_MASK_ISA_WAITPKG_SET,
OPTION_MASK_ISA_WAITPKG_UNSET): New defines.
(ix86_handle_option): Handle -mwaitpkg.
* config.gcc: New header.
* config/i386/cpuid.h (bit_WAITPKG): New bit.
* config/i386/driver-i386.c (host_detect_local_cpu): Detect -mwaitpkg.
* config/i386/i386-builtin-types.def ((UINT8, UNSIGNED, UINT64)): New
function type.
* config/i386/i386-c.c (ix86_target_macros_internal): Handle
OPTION_MASK_ISA_WAITPKG.
* config/i386/i386.c (ix86_target_string): Add -mwaitpkg.
(ix86_option_override_internal): Add PTA_WAITPKG.
(ix86_valid_target_attribute_inner_p): Add -mwaitpkg.
(enum ix86_builtins): Add IX86_BUILTIN_UMONITOR, IX86_BUILTIN_UMWAIT,
IX86_BUILTIN_TPAUSE.
(ix86_init_mmx_sse_builtins): Define __builtin_ia32_umonitor,
__builtin_ia32_umwait and __builtin_ia32_tpause.
(ix86_expand_builtin): Expand IX86_BUILTIN_UMONITOR,
IX86_BUILTIN_UMWAIT, IX86_BUILTIN_TPAUSE.
* config/i386/i386.h (TARGET_WAITPKG, TARGET_WAITPKG_P): New.
* config/i386/i386.md (UNSPECV_UMWAIT, UNSPECV_UMONITOR,
UNSPECV_TPAUSE): New.
(umwait, umwait_rex64, umonitor_<mode>, tpause, tpause_rex64): New.
* config/i386/i386.opt: Add -mwaitpkg.
* config/i386/waitpkgintrin.h: New file.
* config/i386/x86intrin.h: New header.
* doc/invoke.texi: Add -mwaitpkg.
gcc/testsuite/
* gcc.target/i386/tpause-1.c: New test.
* gcc.target/i386/umonitor-1.c: New test.
From-SVN: r260161
Diffstat (limited to 'gcc/config/i386/i386.md')
-rw-r--r-- | gcc/config/i386/i386.md | 69 |
1 files changed, 63 insertions, 6 deletions
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 97b1ca3..1ba352a 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -289,8 +289,15 @@ UNSPECV_WRUSS UNSPECV_SETSSBSY UNSPECV_CLRSSBSY + + ;; For MOVDIRI and MOVDIR64B support UNSPECV_MOVDIRI UNSPECV_MOVDIR64B + + ;; For WAITPKG support + UNSPECV_UMWAIT + UNSPECV_UMONITOR + UNSPECV_TPAUSE ]) ;; Constants to represent rounding modes in the ROUND instruction @@ -20960,22 +20967,72 @@ "wbnoinvd" [(set_attr "type" "other")]) +;; MOVDIRI and MOVDIR64B + (define_insn "movdiri<mode>" - [(unspec_volatile:SWI48[(match_operand:SWI48 0 "memory_operand" "m") - (match_operand:SWI48 1 "register_operand" "r")] - UNSPECV_MOVDIRI)] + [(unspec_volatile:SWI48 [(match_operand:SWI48 0 "memory_operand" "m") + (match_operand:SWI48 1 "register_operand" "r")] + UNSPECV_MOVDIRI)] "TARGET_MOVDIRI" "movdiri\t{%1, %0|%0, %1}" [(set_attr "type" "other")]) (define_insn "movdir64b_<mode>" - [(unspec_volatile:XI[(match_operand:P 0 "register_operand" "r") - (match_operand:XI 1 "memory_operand")] - UNSPECV_MOVDIR64B)] + [(unspec_volatile:XI [(match_operand:P 0 "register_operand" "r") + (match_operand:XI 1 "memory_operand")] + UNSPECV_MOVDIR64B)] "TARGET_MOVDIR64B" "movdir64b\t{%1, %0|%0, %1}" [(set_attr "type" "other")]) +;; WAITPKG + +(define_insn "umwait" + [(set (reg:CCC FLAGS_REG) + (unspec_volatile:CCC [(match_operand:SI 0 "register_operand" "r") + (match_operand:DI 1 "register_operand" "A")] + UNSPECV_UMWAIT))] + "!TARGET_64BIT && TARGET_WAITPKG" + "umwait\t%0" + [(set_attr "length" "3")]) + +(define_insn "umwait_rex64" + [(set (reg:CCC FLAGS_REG) + (unspec_volatile:CCC [(match_operand:SI 0 "register_operand" "r") + (match_operand:SI 1 "register_operand" "a") + (match_operand:SI 2 "register_operand" "d")] + UNSPECV_UMWAIT))] + "TARGET_64BIT && TARGET_WAITPKG" + "umwait\t%0" + [(set_attr "length" "3")]) + +(define_insn "umonitor_<mode>" + [(unspec_volatile [(match_operand:P 0 "register_operand" "r")] + UNSPECV_UMONITOR)] + "TARGET_WAITPKG" + "umonitor\t%0" + [(set (attr "length") + (symbol_ref ("(Pmode != word_mode) + 3")))]) + +(define_insn "tpause" + [(set (reg:CCC FLAGS_REG) + (unspec_volatile:CCC [(match_operand:SI 0 "register_operand" "r") + (match_operand:DI 1 "register_operand" "A")] + UNSPECV_TPAUSE))] + "!TARGET_64BIT && TARGET_WAITPKG" + "tpause\t%0" + [(set_attr "length" "3")]) + +(define_insn "tpause_rex64" + [(set (reg:CCC FLAGS_REG) + (unspec_volatile:CCC [(match_operand:SI 0 "register_operand" "r") + (match_operand:SI 1 "register_operand" "a") + (match_operand:SI 2 "register_operand" "d")] + UNSPECV_TPAUSE))] + "TARGET_64BIT && TARGET_WAITPKG" + "tpause\t%0" + [(set_attr "length" "3")]) + (include "mmx.md") (include "sse.md") (include "sync.md") |