Author Topic: ARCH:AVX issue  (Read 300 times)

aw27

  • Member
  • ****
  • Posts: 697
ARCH:AVX issue
« on: August 04, 2017, 05:09:29 PM »
I have one for you today:

INVOKE mpfr_set_d, addr temp, 3.0, 3


With OPTION ARCH:SSE works fine:


00000001`3fa9143a 488d4de8        lea     rcx,[rbp-18h]
00000001`3fa9143e 48b80000000000000840 mov rax,4008000000000000h
00000001`3fa91448 66480f6ec8      movd    xmm1,rax
00000001`3fa9144d 41b803000000    mov     r8d,3
00000001`3fa91453 e8781a0000      call    mpfr64+0x2ed0 (00000001`3fa92ed0)

With the default ARCH:AVX does not:

00000001`3f50143a 488d4de8        lea     rcx,[rbp-18h]
00000001`3f50143e 48b80000000000000840 mov rax,4008000000000000h
00000001`3f501448 c4e1fa7ec8      vmovq   xmm1,xmm0   <------                ?????
00000001`3f50144d 41b803000000    mov     r8d,3
00000001`3f501453 e8781a0000      call    mpfr64+0x2ed0 (00000001`3f502ed0)

habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: ARCH:AVX issue
« Reply #1 on: August 04, 2017, 06:39:47 PM »
Good find aw27 :t
I remember that issue, and I also remember that we fixed that, however, somehow the old code was compiled and that came back :dazzled:
Will fix that ASAP
I believe Johnsa is on holidays, if so I'll attach fixed exe here until he comes back, because I can not upload on Terraspace or GIT
Cod-Father

aw27

  • Member
  • ****
  • Posts: 697
Re: ARCH:AVX issue
« Reply #2 on: August 04, 2017, 07:15:20 PM »
I believe Johnsa is on holidays
Probably he is hidden in one of the Fiji islands completely disconnected from the UASM bugs.

habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: ARCH:AVX issue
« Reply #3 on: August 04, 2017, 07:30:02 PM »
He deserved that, John is an excellent programmer, fast and furious :t
I am glad he joined to UASM team :biggrin:
Anyway, here are fixed versions:
Cod-Father

habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: ARCH:AVX issue
« Reply #4 on: August 04, 2017, 07:33:07 PM »
Here is a 32bit:
Cod-Father

habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: ARCH:AVX issue
« Reply #5 on: August 04, 2017, 07:49:46 PM »
If someone is planing to build from sources here are fixes to be replaced in codegen.c from GIT: UASM 2.38

file is codegen.c line 872 to 880
Code: [Select]
     /* UASM 2.35 Fix vmovq encoding */
              if (CodeInfo->token == T_VMOVQ && CodeInfo->opnd[OPND1].type == OP_XMM){
                if (CodeInfo->opnd[OPND2].type == OP_R64 || CodeInfo->opnd[OPND2].type == OP_RAX)
{
   lbyte &= 0xfd;
   lbyte |= 1;
         }
              }
            /* KSHIFTLW KSHIFTLQ KSHIFTRW KSHIFTRQ */

and as well here, same file line 1982 to 1905
Code: [Select]
               /* UASM 2.35 fix vmovq encoding for xmm, r64 */
               if (CodeInfo->token == T_VMOVQ && CodeInfo->opnd[OPND1].type == OP_XMM){
                 if (CodeInfo->opnd[OPND2].type == OP_R64 || CodeInfo->opnd[OPND2].type == OP_RAX)
                 OutputCodeByte(ins->opcode - 0x10 | CodeInfo->iswide | CodeInfo->opc_or);
               }
               else if (CodeInfo->token == T_ADOX){
   OutputCodeByte(ins->opcode);
                   OutputCodeByte(0xF6);
                 }
               else
   OutputCodeByte(ins->opcode | CodeInfo->iswide | CodeInfo->opc_or);
             }
        }
        /* emit ModRM byte; bits 7-6 = Mod, bits 5-3 = Reg, bits 2-0 = R/M */
Cod-Father

aw27

  • Member
  • ****
  • Posts: 697
Re: ARCH:AVX issue
« Reply #6 on: August 04, 2017, 07:49:54 PM »
 :t

One question.
Any other built-in variable to replace __JWASM__ (like __UASM__) ?

PS:
 __UASM__ works!  :t

habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: ARCH:AVX issue
« Reply #7 on: August 04, 2017, 07:55:28 PM »
Please rephrase your question, not clear what that means :dazzled:
Cod-Father

aw27

  • Member
  • ****
  • Posts: 697
Re: ARCH:AVX issue
« Reply #8 on: August 04, 2017, 08:03:15 PM »
Please rephrase your question, not clear what that means :dazzled:

IFDEF __UASM__
OPTION frame:auto
OPTION ARCH:SSE
OPTION WIN64:2
OPTION LITERALS:ON ; Allow string literals use in INVOKE
ELSE
   echo
   echo
   echo ****************MUST BE USED WITH UASM**********************
   echo
   echo
   end
ENDIF

johnsa

  • Member
  • ****
  • Posts: 519
    • Uasm
Re: ARCH:AVX issue
« Reply #9 on: August 04, 2017, 08:06:51 PM »
I am indeed on holidays :)

Git and packages on the site updated...

Don't you love being on vacation???  :t

habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: ARCH:AVX issue
« Reply #10 on: August 04, 2017, 08:12:08 PM »
Enjoy John, you deserved it :biggrin:
Can you please fix that __JWASM__ issue for aw27 ::)
Cod-Father

habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: ARCH:AVX issue
« Reply #11 on: August 04, 2017, 08:18:09 PM »
Isn't that already good enough, symbols.c line 138:
Code: [Select]
/* table of predefined numeric equates */
static const struct eqitem eqtab[] = {
    { "__HJWASM__", _UASM_VERSION_INT_, NULL, NULL },
{ "__UASM__", _UASM_VERSION_INT_, NULL, NULL },
{ "__JWASM__", 212, NULL, NULL },
    { "$",         0,                   UpdateCurPC, &symPC },
    { "@Line",     0,                   UpdateLineNumber, &LineCur },
{ "@ProcLine", 0,                   NULL, NULL },
{ "@Arch",     ARCH_AVX,            NULL, NULL },
{ "@Platform", 0,                   NULL, NULL },
{ "@LastReturnType", 0,             NULL, NULL },
    { "@WordSize", 0,                   UpdateWordSize, NULL }, /* must be last (see SymInit()) */
};
Cod-Father

habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: ARCH:AVX issue
« Reply #12 on: August 04, 2017, 08:22:27 PM »
maybe this : { "__JWASM__", 212, NULL, NULL },
should be   : { "__JWASM__", _UASM_VERSION_INT_, NULL, NULL },
Cod-Father

habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: ARCH:AVX issue
« Reply #13 on: August 04, 2017, 08:27:15 PM »
See what I meant when I said that Johnsa is fast and furious, he is already gone
So, aw27, can you build your own exe or you want me to do it and upload here again?
Cod-Father

aw27

  • Member
  • ****
  • Posts: 697
Re: ARCH:AVX issue
« Reply #14 on: August 04, 2017, 08:38:26 PM »
__UASM__ already works  :t