Author Topic: HJWasm  (Read 22752 times)

habran

  • Member
  • *****
  • Posts: 1116
    • uasm
Re: HJWasm
« Reply #30 on: July 19, 2015, 05:41:45 AM »
Thanks Johnsa, :t
I'll check it  :dazzled:
Cod-Father

habran

  • Member
  • *****
  • Posts: 1116
    • uasm
Re: HJWasm
« Reply #31 on: July 19, 2015, 06:47:49 AM »
Hi Johnsa,
I have changed alignment to be able to align to 32 and it works, even though it complains:
warning A4130: Incompatible with segment alignment: 32
I tested it and it works properly on my laptop

please test this one
Cod-Father

johnsa

  • Member
  • ****
  • Posts: 589
    • Uasm
Re: HJWasm
« Reply #32 on: July 19, 2015, 06:51:41 AM »
Hi,

Yeah I know about the warning with align 32, but that's not the problem. The problem is that it's (incorrectly) assembling SIMD(128bit) instructions to their AVX(256bit) equivalents.
So:

vmovaps xmm1,pt

is becoming

vmovaps ymm1,pt (once assembled).

Possibly related to the opcode-prefix emit again in codegen ?

habran

  • Member
  • *****
  • Posts: 1116
    • uasm
Re: HJWasm
« Reply #33 on: July 19, 2015, 06:55:42 AM »
Did you test this one, because it works as expected on my lap
Cod-Father

johnsa

  • Member
  • ****
  • Posts: 589
    • Uasm
Re: HJWasm
« Reply #34 on: July 19, 2015, 07:08:20 AM »
CORRECT:
   908:    vmovaps xmm7,xmmword ptr pt1
000000013F5846D8 C5 F8 28 3D 40 60 00 00 vmovaps     xmm7,xmmword ptr [pt1 (013F58A720h)] 

WRONG:
   909:    vmovaps xmm8,pt2
000000013F5846E0 C5 7C 28 05 48 60 00 00 vmovaps     ymm8,ymmword ptr [pt2 (013F58A730h)] 
   910:    vmovaps xmm9,pt3
000000013F5846E8 C5 7C 28 0D 50 60 00 00 vmovaps     ymm9,ymmword ptr [pt3 (013F58A740h)] 
   911:    vmovaps xmm10,pt4
000000013F5846F0 C5 7C 28 15 58 60 00 00 vmovaps     ymm10,ymmword ptr [pt4 (013F58A750h)] 

It works IF and only IF you type out XMMWORD PTR.
If you leave that out, it get's it wrong, and it should know from the register what the size is (like it does in 2.13 and before).

habran

  • Member
  • *****
  • Posts: 1116
    • uasm
Re: HJWasm
« Reply #35 on: July 19, 2015, 07:12:27 AM »
How is it possible
Look this:
   513:  vmovaps ymm6,ymem
0000000000391508 C5 FC 28 74 24 30    vmovaps     ymm6,ymmword ptr [ymem] 
   514:  vmovaps xmm7,xmem   
000000000039150E C5 F8 28 7C 24 50    vmovaps     xmm7,xmmword ptr [xmem] 
Cod-Father

johnsa

  • Member
  • ****
  • Posts: 589
    • Uasm
Re: HJWasm
« Reply #36 on: July 19, 2015, 07:18:38 AM »
IF you declare the variable:

xmem XMMWORD 0,0,0,0

or

LOCAL xmem:XMMWORD

then it works too without the XMMWORD PTR on the instruction.

If the data is just in memory without the XMMWORD qualified type is when it doesn't work.

So in my case I use VirtualAlloc and point at that data, then it's wrong. I also use my own custom struct __mm128 which unions integer and float (like intrinsics).
If I point at that type it also doesn't work.
(This is working in 2.13 and before so it's some sort of regression in the latest version).

Try this:

  909:    vmovaps xmm7,[rsi] ;pt1
000000013FE046D8 C5 FC 28 3E          vmovaps     ymm7,ymmword ptr [rsi] 



habran

  • Member
  • *****
  • Posts: 1116
    • uasm
Re: HJWasm
« Reply #37 on: July 19, 2015, 07:22:48 AM »
OK, now it doesn't compile properly
Thanks, I'll try to fix it ASAP
I have to go now, be back in 2 hours
Cod-Father

habran

  • Member
  • *****
  • Posts: 1116
    • uasm
Re: HJWasm
« Reply #38 on: July 19, 2015, 07:24:35 AM »
in .data? section
Cod-Father

habran

  • Member
  • *****
  • Posts: 1116
    • uasm
Re: HJWasm
« Reply #39 on: July 19, 2015, 10:10:34 AM »
Fixed :bgrin:
Cod-Father

johnsa

  • Member
  • ****
  • Posts: 589
    • Uasm
Re: HJWasm
« Reply #40 on: July 19, 2015, 09:13:38 PM »
My 3 big test projects all work 100% now including some really hairy avx stuff and macro layers doing OOP! So far it looks good to go! :)  :eusa_clap:
I'm still not able to link using the table+index style EA addressing.. and for some reason I cannot install VS2013 over my VS2012 Ultimate install I already have :( Although I don't see why VS2013 Link would behave any differently to 2012.

Good job!

jj2007

  • Member
  • *****
  • Posts: 7756
  • Assembler is fun ;-)
    • MasmBasic
Re: HJWasm
« Reply #41 on: July 19, 2015, 10:23:33 PM »
I get plenty of errors, so I assume this is the 64-bit version 8)

habran

  • Member
  • *****
  • Posts: 1116
    • uasm
Re: HJWasm
« Reply #42 on: July 19, 2015, 11:22:11 PM »
JJ here is a 32 bit
test it please :biggrin:

Thanks Johnsa :t
AFAIK, if you want to link AVX2 you need VS13 linker
I am afraid that you will have to accept the reality
however VS15 Community will be soon availible
I have already installed   VS15 Community RC and it works pretty good
Cod-Father

jj2007

  • Member
  • *****
  • Posts: 7756
  • Assembler is fun ;-)
    • MasmBasic
Re: HJWasm
« Reply #43 on: July 20, 2015, 01:44:30 AM »
JJ here is a 32 bit
test it please :biggrin:


Plenty of error messages for Windows.inc, line 12948:

Code: [Select]
MOUSEINPUT STRUCT
   _dx                    DWORD ?
   dy                     DWORD ?

Same for line 19062:
Code: [Select]
NMLVSCROLL STRUCT
   hdr                    NMHDR <>
   _dx                    DWORD ?
   dy                     DWORD ?
NMLVSCROLL ENDS

Using _dy instead of dy makes MB assemble without errors, but that could break existing Masm32 code.

The pair _dx / dy is certainly inconsistent, but it's a bit late in the process to change Windows.inc; perhaps you can find the culprit in HJWasm which declares "dy" a reserved word...

johnsa

  • Member
  • ****
  • Posts: 589
    • Uasm
Re: HJWasm
« Reply #44 on: July 20, 2015, 02:21:40 AM »
Habran did mention earlier about making that change.

DO, DY and DZ are now reserverd data type defines (like DD,DW etc) for XMM,YMM and ZMM respectively.
I've changed the dy/dx in my windows.inc to _dy, _dx and so-far it has not caused any issue elsewhere.

Apart from that is it working ok?