[Patch] x86: Enable GCC support for Intel Hreset extension

Hongyu Wang wwwhhhyyy333@gmail.com
Tue Oct 13 08:46:13 GMT 2020


Hi:

This patch is about to support Intel Hreset instruction.

Hreset provides a hint to the processor to selectively reset the prediction
history of the current logical processor.

For more details, please refer to
https://software.intel.com/content/dam/develop/external/us/en/documents/architecture-instruction-set-extensions-programming-reference.pdf

Bootstrap ok, regression test on i386/x86 backend is ok.

OK for master?

gcc/

    * common/config/i386/cpuinfo.h (get_available_features):
    Detect HRESET.
    * common/config/i386/i386-common.c (OPTION_MASK_ISA2_HRESET_SET,
    OPTION_MASK_ISA2_HRESET_UNSET): New macros.
    (ix86_handle_option): Handle -mhreset.
    * common/config/i386/i386-cpuinfo.h (enum processor_features):
    Add FEATURE_HRESET.
    * common/config/i386/i386-isas.h: Add ISA_NAMES_TABLE_ENTRY
    for hreset.
    * config.gcc: Add hresetintrin.h
    * config/i386/hresetintrin.h: New header file.
    * config/i386/x86gprintrin.h: Include hresetintrin.h.
    * config/i386/cpuid.h (bit_HRESET): New.
    * config/i386/i386-builtin.def: Add new builtin.
    * config/i386/i386-expand.c (ix86_expand_builtin):
    Handle new builtin.
    * config/i386/i386-c.c (ix86_target_macros_internal): Define
    __HRESET__.
    * config/i386/i386-options.c (isa2_opts): Add -mhreset.
    (ix86_valid_target_attribute_inner_p): Handle hreset.
    * config/i386/i386.h (TARGET_HRESET, TARGET_HRESET_P,
    PTA_HRESET): New.
    (PTA_ALDERLAKE): Add PTA_HRESET.
    * config/i386/i386.opt: Add option -mhreset.
    * config/i386/i386.md (UNSPECV_HRESET): New unspec.
    (hreset): New define_insn.
    * doc/invoke.texi: Document -mhreset.
    * doc/extend.texi: Document hreset.

gcc/testsuite/

    * gcc.target/i386/hreset-1.c: New test.
    * gcc.target/i386/funcspec-56.inc: Add new target attribute.
    * gcc.target/i386/sse-12.c: Update -mhreset.
    * gcc.target/i386/sse-13.c: Likewise.
    * gcc.target/i386/sse-14.c: Likewise.
    * gcc.target/i386/sse-22.c: Likewise.
    * gcc.target/i386/sse-23.c: Likewise.
    * g++.dg/other/i386-2.C: Likewise.
    * g++.dg/other/i386-3.C: Likewise.

-- 
Regards,

Hongyu, Wang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Enable-Intel-HRESET-Instruction.patch
Type: text/x-patch
Size: 19646 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201013/d6b43b05/attachment-0001.bin>


More information about the Gcc-patches mailing list