Hi,
GCC uses full 512-bit register to keep the constant. This constant uses in the 
code further but with 128-bit vector length.
The patch avoid fixed large vector length usage.

For the simple code:
void my_test(short *table)
{
  for (int i = 0; i < 128; ++i) {
    table[i] = -1;
  }
}

It generates:
  vpternlogd $0xFF, %zmm0, %zmm0, %zmm0
  vmovups %xmm0, (%rdi)
  vmovups %xmm0, 16(%rdi)
  vmovups %xmm0, 32(%rdi)
...etc..

The patched GCC generates:
  vpcmpeqd %xmm0,%xmm0,%xmm0
  vmovups %xmm0,(%rdi)
  vmovups %xmm0,0x10(%rdi)
  vmovups %xmm0,0x20(%rdi)
...etc..


gcc/ChangeLog:

2017-09-21  Sergey Shalnov  <sergey.shal...@intel.com>

        * config/i386/sse.md: The vector legister length should be the same
        as it used. Avoid the largest fixed vector length.

gcc/testsuite/ChangeLog:

2017-09-21  Sergey Shalnov  <sergey.shal...@intel.com>

        * gcc.target/i386/avx512f-constant-set.c: New test.

Sergey

Attachment: 0001-Adjust-vector-length-usage-in-mov-mode-_internal.patch
Description: 0001-Adjust-vector-length-usage-in-mov-mode-_internal.patch

Reply via email to