1

I need to fill zmm1 with "1" to be able quickly fill large data field in a memory in a loop. How to set zmm1 by "1" like mov rax, 0FFFFFFFFFFFFFFFFh in Intel assembly? I don't have any experience with {k1}{z} parameters.

See code below.

PCMPEQD zmm1, zmm1

I got an error code "invalid instruction operands"

Ziggi
  • 9
  • 1
  • 5

1 Answers1

2

clang++ and g++ use vpternlogd zmm0, zmm0, zmm0, 255. I found this using https://godbolt.org and https://software.intel.com/sites/landingpage/IntrinsicsGuide

jbapple
  • 3,297
  • 1
  • 24
  • 38
  • 3
    Yup, this is generally the best choice for ZMM regs. It does have a false dependency on the old value, though, so use with care. Inside a loop you might want `vmovdqa64` to copy an existing register, instead of re-generating an all-ones vector, because that doesn't need an ALU execution unit on Skylake-family CPUs. – Peter Cordes Aug 20 '19 at 03:14
  • Unfortunately I noticed that my CPU 7500u can handle 256 bits only: > AVX supported AVX2 supported AVX512CD not supported AVX512ER not supported AVX512F not supported AVX512PF not supported How to modify vpternlogd zmm0, zmm0, zmm0, 255 for AVX2 i.e. ymm0 register? – Ziggi Aug 20 '19 at 10:57