Hello!

> From: Andi Kleen <a...@linux.intel.com>
>
> Add builtins/intrinsics for PTWRITE. PTWRITE is a new instruction on Intel 
> Gemini Lake/
> Goldmont Plus that allows to write values into the Processor Trace log. This 
> allows
> very light weight instrumentation of programs.
>
> The intrinsics are compatible to icc. Automatically enabled for Goldmont Plus.
>
> gcc/:
>
> 2018-11-03  Andi Kleen  <a...@linux.intel.com>
>
> * common/config/i386/i386-common.c (OPTION_MASK_ISA_PTWRITE_SET): New.
> (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.
> * config/i386/i386-builtin.def (BDESC): Add ptwrite32/64.
> * config/i386/i386-c.c (ix86_target_macros_internal): Define __PTWRITE__.
> * config/i386/i386.c (ix86_target_string): Handle ptwrite.
> (ix86_option_override_internal): Handle PTA_PTWRITE.
> (ix86_valid_target_attribute_inner_p): Define ptwrite.
> (def_builtin2): Force UINT64 to be 64bit only.
> * config/i386/i386.h (TARGET_PTWRITE): Add.
> (TARGET_PTWRITE_P): Add.
> (PTA_PTWRITE): Add.
> * config/i386/i386.md: Define ptwrite.
> * config/i386/i386.opt: Add -mptwrite.
> * config/i386/immintrin.h (_ptwrite64): Add.
> (_ptwrite32): Add
> * doc/extend.texi: Document __builtin_ia32_ptwrite*.
> * doc/invoke.texi: Document -mptwrite.
>
> gcc/testsuite/ChangeLog:
>
> 2018-11-03  Andi Kleen  <a...@linux.intel.com>
>
> * gcc.target/i386/ptwrite1.c: New test.
> * gcc.target/i386/ptwrite2.c: New test.

OK for x86 part (that is only PATCH 1/3). It looks that this part can
go to mainline as an independent patch from other patches in serie.

diff --git a/gcc/testsuite/gcc.target/i386/ptwrite2.c
b/gcc/testsuite/gcc.target/i386/ptwrite2.c
new file mode 100644
index 00000000000..299c6511ef4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ptwrite2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mptwrite " } */
+/* { dg-final { scan-assembler "ptwrite.*r" } } */
+/* { dg-final { scan-assembler "ptwrite.*e" } } */

Better use \[^\n\r\] instead of .* to avoid unwanted multi-line matches.

Thanks,
Uros.

Reply via email to