News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

VPTESTMW & kmovd

Started by mabdelouahab, October 07, 2020, 09:26:11 AM

Previous topic - Next topic

mabdelouahab

VPTESTMW k0,ymm15,YMMWORD PTR [rbx]
Syntax error: ,YMMWORD PTR [rbx]
Also
kmovd ecx,k0
During execution:
line 1:  4440 Illegal instruction

KradMoonRa

#1
Interesting, I can reproduce the problem with both vptestmb and vptestmw.

Adding option evex:1 and arch:avx to recognize avx512 opcodes.

    .xmm
    option arch:avx
    option evex:1
    kmovd ecx,k0                              ;ok
    vptestmd k0, ymm15, xmmword ptr [rbx]     ;ok
    vptestmq k0, ymm15, xmmword ptr [rbx]     ;ok
    vptestnmd k0, ymm15, xmmword ptr [rbx]    ;ok
    vptestnmq k0, ymm15, xmmword ptr [rbx]    ;ok


In reswords.c line 677 changing from VX_NND to VX_HALF, the opcode is recognized and successfully assembles.

VX_LL|VX_L|VX_HALF,      /* VPTESTMB    */
VX_LL|VX_L|VX_HALF,      /* VPTESTMW    */
VX_LL|VX_L|VX_HALF,      /* VPTESTMD    */
VX_LL|VX_L|VX_HALF,      /* VPTESTMQ    */
VX_LL|VX_L|VX_HALF,      /* VPTESTNMB   */
VX_LL|VX_L|VX_HALF,      /* VPTESTNMW   */
VX_LL|VX_L|VX_HALF,      /* VPTESTNMD   */
VX_LL|VX_L|VX_HALF,      /* VPTESTNMQ   */


vptestmw k0, ymm15, ymmword ptr [rbx]                  ;  62 F2 85 28  26 03
The uasmlib

mabdelouahab

Thank you KradMoonRa
Quote from: KradMoonRa on October 08, 2020, 06:45:29 AM
In reswords.c line 677 changing from VX_NND to VX_HALF, the opcode is recognized and successfully assembles.
but After this modification, how to recompile it under linux, It is better to make a bash file

johnsa

You will need to use option evex:1 to be able to assemble any avx512 instructions, do they work with just that or still not?

mabdelouahab

Quote from: johnsa on October 09, 2020, 03:22:47 AM
You will need to use option evex:1 to be able to assemble any avx512 instructions, do they work with just that or still not?

I did that before I write this topic, because I know this, but I had this problem

;   uasm  -elf64 main.asm
   ;option arch:avx ;==Error A2169: General Failure
    option evex:1

.data
   ll1      dq 1024   dup(0)
.code
   main proc
      lea rbx,ll1
       vpxor ymm15,ymm15,ymm15
   ;   vptestmw k0, ymm15, ymmword ptr [rbx]    ; Error A2210: Syntax error: , xmmword ptr [rbx]
;     vptestmd k0, ymm15, ymmword ptr [rbx]     ;Illegal instruction  (During execution)
   ;   kmovd ecx,k0                              ;Illegal instruction  (During execution)
      xor rax,rax
      ret
   main endp
end

mabdelouahab

from :IntelĀ® Compilers
QuoteIllegal instruction error if run on unsupported processor
VEX.L0.66.0F.W1 91 /r KMOVD m32, k1    MR    V/V    AVX512BW
EVEX.256.66.0F38.W1 26 /r VPTESTMW k2 {k1}, ymm2, ymm3/m256    A    V/V    AVX512VL AVX512BW


:sad: I d'ont have AVX512

Quote:~$ more /proc/cpuinfo
processor : Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
cpu MHz      : 1502.788

fflags      : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp
lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr
pdcm pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase
tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts
vmx flags   : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple