Author Topic: VPTESTMW & kmovd  (Read 382 times)

mabdelouahab

  • Member
  • ***
  • Posts: 484
VPTESTMW & kmovd
« on: October 07, 2020, 09:26:11 AM »
Code: [Select]
VPTESTMW k0,ymm15,YMMWORD PTR [rbx] Syntax error: ,YMMWORD PTR [rbx]
Also
Code: [Select]
kmovd ecx,k0During execution:
line 1:  4440 Illegal instruction

KradMoonRa

  • Member
  • **
  • Posts: 60
Re: VPTESTMW & kmovd
« Reply #1 on: October 08, 2020, 06:45:29 AM »
Interesting, I can reproduce the problem with both vptestmb and vptestmw.

Adding option evex:1 and arch:avx to recognize avx512 opcodes.
Code: [Select]
    .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.
Code: [Select]
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   */

Code: [Select]
vptestmw k0, ymm15, ymmword ptr [rbx]                  ;  62 F2 85 28  26 03
« Last Edit: October 08, 2020, 08:52:33 AM by KradMoonRa »

mabdelouahab

  • Member
  • ***
  • Posts: 484
Re: VPTESTMW & kmovd
« Reply #2 on: October 08, 2020, 04:48:18 PM »
Thank you KradMoonRa
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

  • Member
  • ****
  • Posts: 813
    • Uasm
Re: VPTESTMW & kmovd
« Reply #3 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?

mabdelouahab

  • Member
  • ***
  • Posts: 484
Re: VPTESTMW & kmovd
« Reply #4 on: October 09, 2020, 05:50:14 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

  • Member
  • ***
  • Posts: 484
Re: VPTESTMW & kmovd
« Reply #5 on: October 09, 2020, 07:46:04 AM »
from :IntelĀ® Compilers
Quote
Illegal 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

johnsa

  • Member
  • ****
  • Posts: 813
    • Uasm
Re: VPTESTMW & kmovd
« Reply #6 on: October 11, 2020, 09:58:05 PM »
I'll check this out.