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

Uros Bizjak ubizjak@gmail.com
Wed Oct 14 06:26:32 GMT 2020


On Tue, Oct 13, 2020 at 10:49 AM Hongyu Wang <wwwhhhyyy333@gmail.com> wrote:
>
> 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.

The patch doesn't include all testsuite changes.

Otherwise OK.

Thanks,
Uros.


More information about the Gcc-patches mailing list