This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][i386][AVX512] Match latest spec. Add CPUID prefetchwt1.
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Ilya Tocar <tocarip dot intel at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, Kirill Yukhin <kirill dot yukhin at gmail dot com>
- Date: Tue, 25 Feb 2014 10:37:55 +0100
- Subject: Re: [PATCH][i386][AVX512] Match latest spec. Add CPUID prefetchwt1.
- Authentication-results: sourceware.org; auth=none
- References: <20140220153922 dot GB1312 at msticlxl7 dot ims dot intel dot com> <CAFULd4YEGF=BYb7SSELe1GihTGAimked3Pm_KVr7j1-3d=z+RA at mail dot gmail dot com> <20140221152524 dot GA12550 at msticlxl7 dot ims dot intel dot com> <CAFULd4YrG8rWoTy0Lm9jKQeQRgD7YjMQDidLfdXqxGWrDZpP3A at mail dot gmail dot com> <20140225091323 dot GA31394 at msticlxl7 dot ims dot intel dot com>
On Tue, Feb 25, 2014 at 10:13 AM, Ilya Tocar <tocarip.intel@gmail.com> wrote:
>> >> > Latest version of AVX512 spec
>> >> > http://download-software.intel.com/sites/default/files/managed/50/1a/319433-018.pdf
>> >> > Has a few changes.
>> >> >
>> >> > 1)PREFETCHWT1 instruction now has separate CPUID bit PREFETCHWT1.
>> >> > We can either support new CPUID or disable PREFETCHWT1 from generating,
>> >> > without removing code, and enable it in 4.9.1/latest version.
>> >> > I am not sure that adding new -m flag and related stuff this late
>> >> > is a good idea. Should still add it?
>> >>
>> >> Please submit the patch anyway. We can relax release constraints on
>> >> non-algorithmic patch a bit, weighting in benefits of having gcc
>> >> release that fully conforms to some published specification.
>> >>
>> > Patch bellow add -mprefetchwt1 flag, corresponding TARGET_PREFETCHWT1,
>> > and uses them for prefetchwt1 instruction. Bootstraps/passes testing.
>> > Ok for trunk?
>> >
>
>> > * gcc.target/i386/avx-1.c: Update __builtin_prefetch.
>>
>> Please also add new switch to gcc-target/i386/sse-{12,13,14}.c and
>> g++.dg/other/i386-{2,3} and new options to
>> gcc.tatget/i386/sse-{22,23}.c. Please re-test with new additions and
>> repost the patch.
>>
>
> I've added new switch to those tests. However when I add prefetchwt1
> to pragma GCC target ("sse") sse-22a.c test fails with:
> pmmintrin.h: In function '_mm_loaddup_pd':
> emmintrin.h:119:1: error: inlining failed in call to always_inline
> '_mm_load1_pd': target specific option mismatch
>
> I've checked and this isn't a problem with prefetchwt1. I get the same
> error when I add any other option (e. g. sha) to #pragma GCC target ("sse").
> So I haven't added anything there. As that was the only fail,
> I'm reposting this patch.
>
> ChangeLog for GCC:
>
> * common/config/i386/i386-common.c (OPTION_MASK_ISA_PREFETCHWT1_SET),
> (OPTION_MASK_ISA_PREFETCHWT1_UNSET): New.
> (ix86_handle_option): Handle OPT_mprefetchwt1.
> * config/i386/cpuid.h (bit_PREFETCHWT1): New.
> * config/i386/driver-i386.c (host_detect_local_cpu): Detect
> PREFETCHWT1 CPUID.
> * config/i386/i386-c.c (ix86_target_macros_internal): Handle
> OPTION_MASK_ISA_PREFETCHWT1.
> * config/i386/i386.c (ix86_target_string): Handle mprefetchwt1.
> (PTA_PREFETCHWT1): New.
> (ix86_option_override_internal): Handle PTA_PREFETCHWT1.
> (ix86_valid_target_attribute_inner_p): Handle OPT_mprefetchwt1.
> * config/i386/i386.h (TARGET_PREFETCHWT1), (TARGET_PREFETCHWT1_P):
> New.
> * config/i386/i386.md (prefetch): Check TARGET_PREFETCHWT1
> (*prefetch_avx512pf_<mode>_: Change into ...
> (*prefetch_prefetchwt1_<mode>: This.
> * config/i386/i386.opt (mprefetchwt1): New.
> * config/i386/xmmintrin.h (_mm_hint): Add _MM_HINT_ET1.
> (_mm_prefetch): Handle intent to write.
> * doc/invoke.texi (mprefetchwt1), (mno-prefetchwt1): Doccument.
>
> ChangeLog for tests:
>
> * gcc.target/i386/avx-1.c: Update __builtin_prefetch.
> * gcc.target/i386/prefetchwt1-1.c: New.
> * g++.dg/other/i386-2.C: Add new option.
> * g++.dg/other/i386-3.C: Ditto.
> * gcc.target/i386/sse-12.c: Ditto.
> * gcc.target/i386/sse-13.c: Update __builtin_prefetch, add new option.
> * gcc.target/i386/sse-22.c: Add new option.
> * gcc.target/i386/sse-23.c: Update __builtin_prefetch, add new option.
The patch is OK for mainline.
Thanks,
Uros.