asmjit icon indicating copy to clipboard operation
asmjit copied to clipboard

vpblendmq support k mask register

Open soforth opened this issue 1 year ago • 3 comments

Issue Description

vpblendmq does not work as supposed, it has no k mask register parameter as input, and i tested to set k0-k3 as the default mask register with no good result.

_mm512_mask_blend_epi64(k, va, vb)); generate assembly good as: "vpblendmq zmm0 {k1}, zmm1, zmm0" but asmjit just output "vpblendmq zmm0 zmm1, zmm0" without k, and there is no place to set the k parameter.

thanks

soforth avatar Oct 04 '24 14:10 soforth

Please check out the "Generating AVX512 code" section here and let me know whether that helped you:

  • https://asmjit.com/doc/classasmjit_1_1x86_1_1Assembler.html

kobalicek avatar Oct 04 '24 14:10 kobalicek

thanks, i checked out it already, and I found the signature of vpblendmq do not support k mask register: ASMJIT_INST_3x(vpblendmq, Vpblendmq, Vec, Vec, Vec) // AVX512_F{kz|b64} ASMJIT_INST_3x(vpblendmq, Vpblendmq, Vec, Vec, Mem) // AVX512_F{kz|b64}

it looks like i need something like ASMJIT_INST_4x(vpblendmq, Vpblendmq, Vec, KReg, Vec, Vec) // AVX512_F{kz|b64} but add this and recompile asmjit does not work, don't know why

FYI, intel manual: __m512i _mm512_mask_blend_epi64 (__mmask8 k, __m512i a, __m512i b) #include <immintrin.h> Instruction: vpblendmq zmm {k}, zmm, zmm CPUID Flags: AVX512F

soforth avatar Oct 04 '24 15:10 soforth

There are no specific signatures for using {k} or {k}{z} forms of the instruction, as stated in the documentation, use the following:

  // Opmask Selectors
  // ----------------
  //
  //   - Opmask / zeroing is part of the instruction options / extraReg.
  //   - k(reg) is like {kreg} in Intel syntax.
  //   - z() is like {z} in Intel syntax.
 
  // vaddpd zmm {k} {z}, zmm1, zmm2
  a.k(k1).z().vaddpd(zmm0, zmm1, zmm2);

kobalicek avatar Oct 09 '24 15:10 kobalicek

Closing as this feature is already supported by AsmJit - use .k(kreg) and possibly .z() to specify {k}{z} options.

kobalicek avatar Oct 20 '24 22:10 kobalicek