On Wed, May 9, 2018 at 1:23 PM, Peryt, Sebastian
<[email protected]> wrote:
> I have rebased this patch to the latest trunk and addressed comments. Also,
> there was a test in changelog,
> but not in the patch itself - this has been added.
>
> Is it ok for trunk and backport to GCC-8 after few days?
>
> gcc/
>
> * common/config/i386/i386-common.c (OPTION_MASK_ISA_PTWRITE_SET,
> OPTION_MASK_ISA_PTWRITE_UNSET): New.
> (ix86_handle_option): Handle OPT_mptwrite.
> * config/i386/cpuid.h (bit_PTWRITE): Add.
> * config/i386/driver-i386.c (host_detect_local_cpu): Detect
> PTWRITE CPUID.
> * config/i386/i386-builtin.def (PTWRITE): Add PTWRITE.
> * config/i386/i386-c.c (ix86_target_macros_internal):
> Support __PTWRITE__.
> * config/i386/i386.c (ix86_target_string): Add -mptwrite.
> (ix86_valid_target_attribute_inner_p): Support ptwrite.
> (ix86_init_mmx_sse_builtins): Add edges detection for ptwrites
> generated by vartrace.
> * config/i386/i386.h (TARGET_PTWRITE): Add.
> (TARGET_PTWRITE_P): Add.
> * config/i386/i386.md: Add ptwrite.
> * config/i386/i386.opt: Add -mptwrite.
> * config/i386/immintrin.h (target):
> (_ptwrite64): Add.
> (_ptwrite32): Add.
> * doc/extend.texi: Document ptwrite builtins.
> * doc/invoke.texi: Document -mptwrite.
>
> gcc/testsuite/
>
> * gcc.target/i386/ptwrite-1.c: New test.
@@ -31325,7 +31329,21 @@ ix86_init_mmx_sse_builtins (void)
continue;
ftype = (enum ix86_builtin_func_type) d->flag;
- def_builtin2 (d->mask, d->name, ftype, d->code);
+ decl = def_builtin2 (d->mask, d->name, ftype, d->code);
+
+ /* Avoid edges for ptwrites generated by vartrace pass. */
+ if (decl)
+ {
+ DECL_ATTRIBUTES (decl) = build_tree_list (get_identifier ("leaf"),
+ NULL_TREE);
+ TREE_NOTHROW (decl) = 1;
+ }
+ else
+ {
+ ix86_builtins_isa[(int)d->code].leaf_p = true;
+ ix86_builtins_isa[(int)d->code].nothrow_p = true;
+ }
+
Can you please explain what is the purpose of the above change?
Uros.