Hi Hutch!
Just reading 64 ABI noted that xmm6 to xmm15 must be preserved. I know that... now :biggrin:
Then USING macro group must be updated. Here an idea that apparently work: ; -------------------------------------------------------
; Register preservation macros for stack frame procedures
; -------------------------------------------------------
argcount64 MACRO args:VARARG
LOCAL cnt
cnt = 0
cnt2 = 0
FOR item, <args>
sumar = 8
REPEAT 16
% ifidni <item>, <@CatStr(<xmm>,%cnt2)>
sumar = 16
endif
cnt2 = cnt2 + 1
ENDM
cnt = cnt + sumar
ENDM
EXITM %cnt ;; return as a number
ENDM
USING MACRO arglist:VARARG ;; Must be placed before dynamic code
MLOCAL r64@@_@@[argcount64(arglist)] :BYTE ;; LOCAL QWORD array
reg_64_bit_list_@@@@ equ arglist
ENDM
SaveRegs MACRO ;; must be placed AFTER LOCALs
cntr@@@_@@@ = 0
%FOR arg,<reg_64_bit_list_@@@@>
sumar = 1
cnt2 = 0
;; %echo arg
REPEAT 16
% ifidni <arg>, <@CatStr(<xmm>,%cnt2)>
sumar = 2
endif
cnt2=cnt2+1
ENDM
if sumar eq 1
mov qword ptr r64@@_@@[cntr@@@_@@@], arg
cntr@@@_@@@ = cntr@@@_@@@ + 8
else
movupd oword ptr r64@@_@@[cntr@@@_@@@], arg
cntr@@@_@@@ = cntr@@@_@@@ + 16
endif
ENDM
ENDM
RestoreRegs MACRO ;; must be placed BEFORE "ret"
cntr@@@_@@@ = 0
%FOR arg,<reg_64_bit_list_@@@@>
;; %echo arg
cnt2 = 0
sumar = 1
REPEAT 16
% ifidni <arg>, <@CatStr(<xmm>,%cnt2)>
sumar = 2
endif
cnt2 = cnt2 + 1
ENDM
if sumar eq 1
mov arg, qword ptr r64@@_@@[cntr@@@_@@@]
cntr@@@_@@@ = cntr@@@_@@@ + 8
else
movupd arg, oword ptr r64@@_@@[cntr@@@_@@@]
cntr@@@_@@@ = cntr@@@_@@@ + 16
endif
ENDM
ENDM
; -------------------------------------------------------
The test: i8x$(xmm6) = 1 -2 3 4 -5 6 7 8 9 10 -11 12 13 14 15 16
entering testi8x proc ---------
i8x$(xmm6) = 100 15 -3 74 -5 36 17 8 49 10 -11 12 13 14 15 16
exiting testi8x proc ---------
i8x$(xmm6) = 1 -2 3 4 -5 6 7 8 9 10 -11 12 13 14 15 16