On Wed, Apr 1, 2020 at 9:23 AM Hongtao Liu <crazy...@gmail.com> wrote: > > Hi: > This patch is about to enable GCC support for SERIALIZE which would > be in GLC. There's only 1 instruction: SERIALIZE, more details please > refer to > https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf > I know it's stage4 right now, and patches are approved only for bug > fixed, but since many users prefer to use release version other than > build from trunk, i'd like to see this patch landed on GCC10, after > all it's only 1 instruction, without any significant changes. > > Bootstrap ok, regression test on i386/x86 backend is ok. > > gcc/Changelog: > * gcc/common/config/i386/i386-common.c > (OPTION_MASK_ISA2_SERIALIZE_SET, > OPTION_MASK_ISA2_SERIALIZE_UNSET): New macros. > (ix86_handle_option): Handle -mserialize. > * gcc/config.gcc (serializeintrin.h): New header file. > * gcc/config/i386/cpuid.h (bit_SERIALIZE): New bit. > * gcc/config/i386/driver-i386.c (host_detect_local_cpu): Detect > -mserialize. > * gcc/config/i386/i386-builtin.def: Add new builtin. > * gcc/config/i386/i386-c.c (__SERIALIZE__): New macro. > * gcc/config/i386/i386-options.c (ix86_target_opts_isa2_opts): > Add -mserialize. > * (ix86_valid_target_attribute_inner_p): Add target attribute > * for serialize. > * gcc/config/i386/i386.h (TARGET_SERIALIZE, TARGET_SERIALIZE_P): > New macros. > * gcc/config/i386/i386.md (UNSPECV_SERIALIZE): New unspec. > (serialize): New define_insn. > * gcc/config/i386/i386.opt (mserialize): New option > * gcc/config/i386/immintrin.h: Include serailizeintrin.h. > * gcc/config/i386/serializeintrin.h: New header file. > * gcc/doc/invoke.texi: Add documents for -mserialize. > > gcc/testsuite/Changelog > * gcc/testsuite/gcc.target/i386/serialize-1.c: New test. > * gcc/testsuite/g++.dg/other/i386-2.C: Add -mserialize. > * gcc/testsuite/g++.dg/other/i386-3.C: Ditto. > * gcc/testsuite/gcc.target/i386/sse-12.c: Ditto. > * gcc/testsuite/gcc.target/i386/sse-13.c: Ditto. > * gcc/testsuite/gcc.target/i386/sse-14.c: Ditto. > * gcc/testsuite/gcc.target/i386/sse-22.c: Ditto. > * gcc/testsuite/gcc.target/i386/sse-23.c: Ditto. >
Please add new option to gcc.target/i386/funcspec-56.h test file. Just a couple of nits: +/* { dg-final { scan-assembler-times "serialize\[^-]" 1 } } */ Simply scan for "\tserialize", we are sure that file name won't interfere, because it is always quoted. /* { dg-final { scan-assembler "\tserialize" } } */ +void +foo (void) +{ + _serialize (); + return; +} No need for explicit return. OK with the above fixes. Thanks, Uros. > > -- > BR, > Hongtao