On Thu, Oct 18, 2012 at 2:16 AM, Alexander Ivchenko <aivch...@gmail.com> wrote:
> Hi,
>
> this patch adds new intrinsics for fxsave, fxsave64, xsave, xsave64,
> xsaveopt and xsaveopt64 instructions
>
> Bootstrapped on x86-64
>
> Is it ok for trunk?
>
> Changelog entry:
> 2012-10-16  Alexander Ivchenko  <alexander.ivche...@intel.com>
>
>         * gcc/common/config/i386/i386-common.c
>         (OPTION_MASK_ISA_FXSAVE_SET): New.
>         (OPTION_MASK_ISA_XSAVE_SET): Likewise.
>         (ix86_handle_option): Handle mfxsave and mxsave options.
>         * gcc/config.gcc (i[34567]86-*-*): Add fxsaveintrin.h and 
> xsaveintrin.h.
>         (x86_64-*-*): Likewise.
>         * config/i386/xsaveintrin.h: New header.
>         * config/i386/fxsaveintrin.h: Likewise.
>         * gcc/config/i386/driver-i386.c (host_detect_local_cpu): Detect
>         FXSAVE/XSAVE support.
>         * gcc/config/i386/i386-builtin-types.def
>         (VOID_FTYPE_PVOID_INT64): New function type.
>         * gcc/config/i386/i386-c.c: Define __FXSAVE__ and __XSAVE__ if needed.
>         * gcc/config/i386/i386.c (ix86_target_string): Define -mfxsave
>         and -mxsave options.
>         (PTA_FXSAVE): New.
>         (PTA_XSAVE): Likewise.
>         (ix86_option_override_internal): Handle new option.
>         (ix86_valid_target_attribute_inner_p): Add OPT_mfxsave, OPT_mxsave.
>         (ix86_builtins): Add IX86_BUILTIN_FXSAVE32, IX86_BUILTIN_FXSAVE64,
>         IX86_BUILTIN_XSAVE32, IX86_BUILTIN_XSAVE64,
>         IX86_BUILTIN_XSAVEOPT32, IX86_BUILTIN_XSAVEOPT64.
>         (ix86_expand_builtin): Handle these built-ins.
>         * gcc/config/i386/i386.h (TARGET_FXSAVE): New.
>         (TARGET_XSAVE): Likewise.
>         * gcc/config/i386/i386.md (fxsave32): New.
>         (fxsave64): Likewise.
>         (xsave32): Likewise.
>         (xsave64): Likewise.
>         (xsaveopt32): Likewise.
>         (xsaveopt64): Likewise.
>         * gcc/config/i386/i386.opt (mfxsave): New.
>         (mxsave): Likewise.
>         * gcc/config/i386/x86intrin.h: Include
>         xsaveintrin.h, fxsaveintrin.h.
>
> testsuite/Changelog entry:
> 2012-10-16  Alexander Ivchenko  <alexander.ivche...@intel.com>
>
>         * gcc.target/i386/fxsave-1.c: New.
>         * gcc.target/i386/fxsave64-1.c: Ditto.
>         * gcc.target/i386/xsave-1.c: Ditto.
>         * gcc.target/i386/xsave64-1.c: Ditto.
>         * gcc.target/i386/xsaveopt-1.c: Ditto.
>         * gcc.target/i386/xsaveopt64-1.c: Ditto.

A few comments:

1. Shouldn't we also support XSAVEOPT?
2. Shouldn't we enable FXSAVE for -msse?
3. Shouldn't we enable XSAVE for -mavx.
4. XSAVE detection is wrong in host_detect_local_cpu.
Please follow Intel64 SDM.  You should also check
OSXSAVE bit, similar to AVX.
5. Should we use the feature same in Intel SDM, FXSR?
6. Please add PTA_XXX to proper -march=xxxx.
7. Shouldn't we add intrinsics for fxrstr and xrstor


-- 
H.J.

Reply via email to