News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

ARCH:AVX issue

Started by aw27, August 04, 2017, 05:09:29 PM

Previous topic - Next topic

aw27

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

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

Quote from: habran on August 04, 2017, 06:39:47 PM
I believe Johnsa is on holidays
Probably he is hidden in one of the Fiji islands completely disconnected from the UASM bugs.

habran

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

Cod-Father

habran

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

     /* 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

               /* 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

 :t

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

PS:
__UASM__ works!  :t

habran

Please rephrase your question, not clear what that means :dazzled:
Cod-Father

aw27

Quote from: habran on August 04, 2017, 07:55:28 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

I am indeed on holidays :)

Git and packages on the site updated...

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

habran

Enjoy John, you deserved it :biggrin:
Can you please fix that __JWASM__ issue for aw27 ::)
Cod-Father

habran

Isn't that already good enough, symbols.c line 138:

/* 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

maybe this : { "__JWASM__", 212, NULL, NULL },
should be   : { "__JWASM__", _UASM_VERSION_INT_, NULL, NULL },
Cod-Father

habran

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

__UASM__ already works  :t