[PATCH i386 9/8] [AVX512] Add forgotten kmovw insn, built-in and test.

Ilya Tocar tocarip.intel@gmail.com
Tue Dec 31 10:23:00 GMT 2013


> RA figured out that operation with general registers results in less
> moves (you already have x1 in general reg). This is exaclty the reason
> why I think unspecs are not needed. It is the job of the compiler to
> choose most appropriate approach, and its behavior should be adjusted
> with appropriate cost functions.
> 
> I guess that if you load x from memory, RA will allocate mask
> registers all the way to add insn.

I tried loading from memory and result is the same. Without unspec this
intrinsic is just return __A and is completely useless. As for RA
choosing best approach, big concern was generating k<logic> for normal
instructions, so current implementation of masks is conservative and RA
chooses gpr alternatives. So i think, that kmov intrinsic with unspec
has it's uses as a hint to complier. If you are against this approach
here is version without unspec.

---
 gcc/config/i386/avx512fintrin.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/config/i386/avx512fintrin.h b/gcc/config/i386/avx512fintrin.h
index 0a43b1e..e0e74cf 100644
--- a/gcc/config/i386/avx512fintrin.h
+++ b/gcc/config/i386/avx512fintrin.h
@@ -14826,6 +14826,13 @@ _mm_maskz_fnmsub_ss (__mmask8 __U, __m128 __W, __m128 __A, __m128 __B)
 						  _MM_FROUND_CUR_DIRECTION);
 }
 
+extern __inline __mmask16
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_kmov (__mmask16 __A)
+{
+  return __A;
+}
+
 #ifdef __DISABLE_AVX512F__
 #undef __DISABLE_AVX512F__
 #pragma GCC pop_options
-- 
1.8.3.1



More information about the Gcc-patches mailing list