Terraspace / UASM

UASM - Macro Assembler
http://www.terraspace.co.uk/uasm.html
Other
220 stars 49 forks source link

Macros and writemasks error #68

Closed gwoltman closed 6 years ago

gwoltman commented 6 years ago

This file only contains a macro. It incorrectly raises an error.

TITLE setup

OPTION EVEX:1

_TEXT SEGMENT

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

_TEXT ENDS END

BTW, in real code zfmsubpd would be another macro.

john-terraspace commented 6 years ago

What is “zfmsubpd” ?

From: gwoltman [mailto:notifications@github.com] Sent: 11 December 2017 18:10 To: Terraspace/UASM UASM@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [Terraspace/UASM] Macros and writemasks error (#68)

This file only contains a macro. It incorrectly raises an error.

TITLE setup

OPTION EVEX:1

_TEXT SEGMENT

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

_TEXT ENDS END

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68 , or mute the thread https://github.com/notifications/unsubscribe-auth/AQGQVJyyd32hXt7WpJY_jd45y0jfyhpFks5s_W_wgaJpZM4Q9z8y .

gwoltman commented 6 years ago

zfmsubpd is a cool macro that gives me easy-to-use 4 argument FMA. Of course, the actual macro definition is irrelevant as a source file that only contains a macro that is never invoked should not raise an error.

zfmsubpd MACRO dest, mulval1, mulval2, addval LOCAL destreglen destreglen = @SIZESTR(<&dest>) IF @INSTR(,@substr(<&dest>, 1, destreglen),<{>) NE 0 destreglen = @INSTR(,@substr(<&dest>, 1, destreglen),<{>) - 1 ENDIF IF @INSTR(,@substr(<&dest>, 1, destreglen),< >) NE 0 destreglen = @INSTR(,@substr(<&dest>, 1, destreglen),< >) - 1 ENDIF IFIDNI @substr(<&dest>, 1, destreglen), <&addval> IF (OPATTR (mulval1)) AND 10000b vfmsub231pd dest, mulval1, mulval2 ELSE vfmsub231pd dest, mulval2, mulval1 ENDIF ELSE IFIDNI @substr(<&dest>, 1, destreglen), <&mulval1> IF (OPATTR (mulval2)) AND 10000b vfmsub213pd dest, mulval2, addval ELSE vfmsub132pd dest, addval, mulval2 ENDIF ELSE IFIDNI @substr(<&dest>, 1, destreglen), <&mulval2> IF (OPATTR (mulval1)) AND 10000b vfmsub213pd dest, mulval1, addval ELSE vfmsub132pd dest, addval, mulval1 ENDIF ELSE IF (OPATTR (mulval2)) AND 10000b vmovapd dest, mulval2 IF (OPATTR (mulval1)) AND 10000b vfmsub213pd dest, mulval1, addval ELSE vfmsub132pd dest, addval, mulval1 ENDIF ELSE vmovapd dest, mulval1 vfmsub132pd dest, addval, mulval2 ENDIF ENDIF ENDIF ENDIF ENDM

On Mon, Dec 11, 2017 at 4:49 PM, John Hankinson notifications@github.com wrote:

What is “zfmsubpd” ?

From: gwoltman [mailto:notifications@github.com] Sent: 11 December 2017 18:10 To: Terraspace/UASM UASM@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [Terraspace/UASM] Macros and writemasks error (#68)

This file only contains a macro. It incorrectly raises an error.

TITLE setup

OPTION EVEX:1

_TEXT SEGMENT

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

_TEXT ENDS END

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ Terraspace/UASM/issues/68 , or mute the thread https://github.com/ notifications/unsubscribe-auth/AQGQVJyyd32hXt7WpJY_jd45y0jfyhpFks5s_W_ wgaJpZM4Q9z8y .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-350869713, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPFM5ym7IX5nnmmSdOcn9O6ahDbh6m-ks5s_aOFgaJpZM4Q9z8y .

john-terraspace commented 6 years ago

What error do you get ?

I just tried without defining zfmsubpd and I got a wrong mask register error A2016.

From: gwoltman [mailto:notifications@github.com] Sent: 11 December 2017 22:28 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment comment@noreply.github.com Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

zfmsubpd is a cool macro that gives me easy-to-use 4 argument FMA. Of course, the actual macro definition is irrelevant as a source file that only contains a macro that is never invoked should not raise an error.

zfmsubpd MACRO dest, mulval1, mulval2, addval LOCAL destreglen destreglen = @SIZESTR(<&dest>) IF @INSTR(,@substr(<&dest>, 1, destreglen),<{>) NE 0 destreglen = @INSTR(,@substr(<&dest>, 1, destreglen),<{>) - 1 ENDIF IF @INSTR(,@substr(<&dest>, 1, destreglen),< >) NE 0 destreglen = @INSTR(,@substr(<&dest>, 1, destreglen),< >) - 1 ENDIF IFIDNI @substr(<&dest>, 1, destreglen), <&addval> IF (OPATTR (mulval1)) AND 10000b vfmsub231pd dest, mulval1, mulval2 ELSE vfmsub231pd dest, mulval2, mulval1 ENDIF ELSE IFIDNI @substr(<&dest>, 1, destreglen), <&mulval1> IF (OPATTR (mulval2)) AND 10000b vfmsub213pd dest, mulval2, addval ELSE vfmsub132pd dest, addval, mulval2 ENDIF ELSE IFIDNI @substr(<&dest>, 1, destreglen), <&mulval2> IF (OPATTR (mulval1)) AND 10000b vfmsub213pd dest, mulval1, addval ELSE vfmsub132pd dest, addval, mulval1 ENDIF ELSE IF (OPATTR (mulval2)) AND 10000b vmovapd dest, mulval2 IF (OPATTR (mulval1)) AND 10000b vfmsub213pd dest, mulval1, addval ELSE vfmsub132pd dest, addval, mulval1 ENDIF ELSE vmovapd dest, mulval1 vfmsub132pd dest, addval, mulval2 ENDIF ENDIF ENDIF ENDIF ENDM

On Mon, Dec 11, 2017 at 4:49 PM, John Hankinson <notifications@github.com mailto:notifications@github.com > wrote:

What is “zfmsubpd” ?

From: gwoltman [mailto:notifications@github.com] Sent: 11 December 2017 18:10 To: Terraspace/UASM <UASM@noreply.github.com mailto:UASM@noreply.github.com > Cc: Subscribed <subscribed@noreply.github.com mailto:subscribed@noreply.github.com > Subject: [Terraspace/UASM] Macros and writemasks error (#68)

This file only contains a macro. It incorrectly raises an error.

TITLE setup

OPTION EVEX:1

_TEXT SEGMENT

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

_TEXT ENDS END

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/ https://github.com/%0b Terraspace/UASM/issues/68> , or mute the thread <https://github.com/ https://github.com/%0b notifications/unsubscribe-auth/AQGQVJyyd32hXt7WpJY_jd45y0jfyhpFks5sW wgaJpZM4Q9z8y> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-350869713, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPFM5ym7IX5nnmmSdOcn9O6ahDbh6m-ks5s_aOFgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-350879254 , or mute the thread https://github.com/notifications/unsubscribe-auth/AQGQVAR-CbuHy-n7ZXe7qZZ0vhgP4R0qks5s_axkgaJpZM4Q9z8y . https://github.com/notifications/beacon/AQGQVAYi-UyOViU47ySm8ZnEV1eM-O1vks5s_axkgaJpZM4Q9z8y.gif

gwoltman commented 6 years ago

That is the error message I get.

My goal is to call this macro and pass k5 for the kwritemask parameter. Note I worked around the problem as follows:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask,uasmbug zfmsubpd zmmcarry {kwritemask}, zmmval, zmm24, zmm20 ;; zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 zfmsubpd uasmbug {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

and pass zmm16 in the uasmbug parameter

On Mon, Dec 11, 2017 at 5:34 PM, John Hankinson notifications@github.com wrote:

What error do you get ?

I just tried without defining zfmsubpd and I got a wrong mask register error A2016.

From: gwoltman [mailto:notifications@github.com] Sent: 11 December 2017 22:28 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment < comment@noreply.github.com> Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

zfmsubpd is a cool macro that gives me easy-to-use 4 argument FMA. Of course, the actual macro definition is irrelevant as a source file that only contains a macro that is never invoked should not raise an error.

zfmsubpd MACRO dest, mulval1, mulval2, addval LOCAL destreglen destreglen = @SIZESTR(<&dest>) IF @INSTR(,@substr(<&dest>, 1, destreglen),<{>) NE 0 destreglen = @INSTR(,@substr(<&dest>, 1, destreglen),<{>) - 1 ENDIF IF @INSTR(,@substr(<&dest>, 1, destreglen),< >) NE 0 destreglen = @INSTR(,@substr(<&dest>, 1, destreglen),< >) - 1 ENDIF IFIDNI @substr(<&dest>, 1, destreglen), <&addval> IF (OPATTR (mulval1)) AND 10000b vfmsub231pd dest, mulval1, mulval2 ELSE vfmsub231pd dest, mulval2, mulval1 ENDIF ELSE IFIDNI @substr(<&dest>, 1, destreglen), <&mulval1> IF (OPATTR (mulval2)) AND 10000b vfmsub213pd dest, mulval2, addval ELSE vfmsub132pd dest, addval, mulval2 ENDIF ELSE IFIDNI @substr(<&dest>, 1, destreglen), <&mulval2> IF (OPATTR (mulval1)) AND 10000b vfmsub213pd dest, mulval1, addval ELSE vfmsub132pd dest, addval, mulval1 ENDIF ELSE IF (OPATTR (mulval2)) AND 10000b vmovapd dest, mulval2 IF (OPATTR (mulval1)) AND 10000b vfmsub213pd dest, mulval1, addval ELSE vfmsub132pd dest, addval, mulval1 ENDIF ELSE vmovapd dest, mulval1 vfmsub132pd dest, addval, mulval2 ENDIF ENDIF ENDIF ENDIF ENDM

On Mon, Dec 11, 2017 at 4:49 PM, John Hankinson <notifications@github.com mailto:notifications@github.com > wrote:

What is “zfmsubpd” ?

From: gwoltman [mailto:notifications@github.com] Sent: 11 December 2017 18:10 To: Terraspace/UASM <UASM@noreply.github.com <mailto: UASM@noreply.github.com> > Cc: Subscribed <subscribed@noreply.github.com <mailto: subscribed@noreply.github.com> > Subject: [Terraspace/UASM] Macros and writemasks error (#68)

This file only contains a macro. It incorrectly raises an error.

TITLE setup

OPTION EVEX:1

_TEXT SEGMENT

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

_TEXT ENDS END

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/ < https://github.com/%0b> Terraspace/UASM/issues/68> , or mute the thread <https://github.com/ < https://github.com/%0b> notifications/unsubscribe-auth/AQGQVJyyd32hXt7WpJY_jd45y0jfyhpFks5sW wgaJpZM4Q9z8y> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-350869713, or mute the thread https://github.com/notifications/unsubscribe-auth/ AVPFM5ym7IX5nnmmSdOcn9O6ahDbh6m-ks5s_aOFgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ Terraspace/UASM/issues/68#issuecomment-350879254 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AQGQVAR-CbuHy- n7ZXe7qZZ0vhgP4R0qks5saxkgaJpZM4Q9z8y> . <https://github.com/ notifications/beacon/AQGQVAYi-UyOViU47ySm8ZnEV1eM-O1vks5s axkgaJpZM4Q9z8y.gif>

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-350880907, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPFM1MnESHlG_ZufgQS17u9jt0Mzo3Aks5s_a3tgaJpZM4Q9z8y .

john-terraspace commented 6 years ago

Ok, I’ve found the source of the issue.. when expanding the decorators it’s trying to immediately evaluate the correctness of the mask { } if the preceding token is a register, will get this fixed and update soon. I’ve updated the website to include the full version number now (2.46.4) so it’s easier to check if you have the latest version. Once this bug is fixed it’ll be 2.46.5

I was about to say that it only happens when there is a fixed register so you could work around it temporarily as you have done 😊

Cheers!

John

From: gwoltman [mailto:notifications@github.com] Sent: 11 December 2017 22:49 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment comment@noreply.github.com Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

That is the error message I get.

My goal is to call this macro and pass k5 for the kwritemask parameter. Note I worked around the problem as follows:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask,uasmbug zfmsubpd zmmcarry {kwritemask}, zmmval, zmm24, zmm20 ;; zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 zfmsubpd uasmbug {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

and pass zmm16 in the uasmbug parameter

On Mon, Dec 11, 2017 at 5:34 PM, John Hankinson notifications@github.com wrote:

What error do you get ?

I just tried without defining zfmsubpd and I got a wrong mask register error A2016.

From: gwoltman [mailto:notifications@github.com] Sent: 11 December 2017 22:28 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment < comment@noreply.github.com> Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

zfmsubpd is a cool macro that gives me easy-to-use 4 argument FMA. Of course, the actual macro definition is irrelevant as a source file that only contains a macro that is never invoked should not raise an error.

zfmsubpd MACRO dest, mulval1, mulval2, addval LOCAL destreglen destreglen = @SIZESTR(<&dest>) IF @INSTR(,@substr(<&dest>, 1, destreglen),<{>) NE 0 destreglen = @INSTR(,@substr(<&dest>, 1, destreglen),<{>) - 1 ENDIF IF @INSTR(,@substr(<&dest>, 1, destreglen),< >) NE 0 destreglen = @INSTR(,@substr(<&dest>, 1, destreglen),< >) - 1 ENDIF IFIDNI @substr(<&dest>, 1, destreglen), <&addval> IF (OPATTR (mulval1)) AND 10000b vfmsub231pd dest, mulval1, mulval2 ELSE vfmsub231pd dest, mulval2, mulval1 ENDIF ELSE IFIDNI @substr(<&dest>, 1, destreglen), <&mulval1> IF (OPATTR (mulval2)) AND 10000b vfmsub213pd dest, mulval2, addval ELSE vfmsub132pd dest, addval, mulval2 ENDIF ELSE IFIDNI @substr(<&dest>, 1, destreglen), <&mulval2> IF (OPATTR (mulval1)) AND 10000b vfmsub213pd dest, mulval1, addval ELSE vfmsub132pd dest, addval, mulval1 ENDIF ELSE IF (OPATTR (mulval2)) AND 10000b vmovapd dest, mulval2 IF (OPATTR (mulval1)) AND 10000b vfmsub213pd dest, mulval1, addval ELSE vfmsub132pd dest, addval, mulval1 ENDIF ELSE vmovapd dest, mulval1 vfmsub132pd dest, addval, mulval2 ENDIF ENDIF ENDIF ENDIF ENDM

On Mon, Dec 11, 2017 at 4:49 PM, John Hankinson <notifications@github.com mailto:notifications@github.com > wrote:

What is “zfmsubpd” ?

From: gwoltman [mailto:notifications@github.com] Sent: 11 December 2017 18:10 To: Terraspace/UASM <UASM@noreply.github.com <mailto: UASM@noreply.github.com> > Cc: Subscribed <subscribed@noreply.github.com <mailto: subscribed@noreply.github.com> > Subject: [Terraspace/UASM] Macros and writemasks error (#68)

This file only contains a macro. It incorrectly raises an error.

TITLE setup

OPTION EVEX:1

_TEXT SEGMENT

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

_TEXT ENDS END

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/ < https://github.com/%0b> Terraspace/UASM/issues/68> , or mute the thread <https://github.com/ < https://github.com/%0b> notifications/unsubscribe-auth/AQGQVJyyd32hXt7WpJY_jd45y0jfyhpFks5sW wgaJpZM4Q9z8y> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-350869713, or mute the thread https://github.com/notifications/unsubscribe-auth/ AVPFM5ym7IX5nnmmSdOcn9O6ahDbh6m-ks5s_aOFgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ Terraspace/UASM/issues/68#issuecomment-350879254 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AQGQVAR-CbuHy- n7ZXe7qZZ0vhgP4R0qks5saxkgaJpZM4Q9z8y> . <https://github.com/ notifications/beacon/AQGQVAYi-UyOViU47ySm8ZnEV1eM-O1vks5s axkgaJpZM4Q9z8y.gif>

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-350880907, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPFM1MnESHlG_ZufgQS17u9jt0Mzo3Aks5s_a3tgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-350884380 , or mute the thread https://github.com/notifications/unsubscribe-auth/AQGQVD-s9WBdVxRZUOxPyYpNyv9HufE3ks5s_bFpgaJpZM4Q9z8y .

gwoltman commented 6 years ago

Not fixed in 2.46.5. Now I get a "too many decorators" error message.

john-terraspace commented 6 years ago

Did you change the macro to take the mask as a separate parameter ? I used your macro in the test-case which is working here as follows:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16, {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

gwoltman commented 6 years ago

There is no comma after "zmm16". Try:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

On Thu, Dec 14, 2017 at 2:58 PM, John Hankinson notifications@github.com wrote:

Did you change the macro to take the mask as a separate parameter ? I used your macro in the test-case which is working here as follows:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16, {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351819445, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPFM65GOUEkp-nK_3mECQ9B_Ha4oDA9ks5tAX3sgaJpZM4Q9z8y .

john-terraspace commented 6 years ago

Hi,

Yep that’ll never work passing reg {decorator} as a single parameter to another macro, they have to be separated.

Zfmsubpd zmm16, kwritemask, zmmcarry, zmm26, zmm22

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 20:33 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment comment@noreply.github.com Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

There is no comma after "zmm16". Try:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

On Thu, Dec 14, 2017 at 2:58 PM, John Hankinson notifications@github.com wrote:

Did you change the macro to take the mask as a separate parameter ? I used your macro in the test-case which is working here as follows:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16, {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351819445, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPFM65GOUEkp-nK_3mECQ9B_Ha4oDA9ks5tAX3sgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351827787 , or mute the thread https://github.com/notifications/unsubscribe-auth/AQGQVO9ps9Wpw01gyLQwS6D_j18SfmI-ks5tAYXmgaJpZM4Q9z8y .

gwoltman commented 6 years ago

There is no reason this shouldn't work. First off, defining a macro should never raise an error. Errors should happen when the macro is expanded. Second, this simplified macro shows how it should work.

simplemacro2 MACRO zreg vsubpd zreg, zmm10, zmm11 ENDM

simplemacro1 MACRO kwritemask simplemacro2 zmm16 {kwritemask} ENDM

simplemacro1 k6

As proof that passing "zmm16 {k6}" as one argument to a macro is valid, consider that the following does work:

simplemacro3 MACRO zreg, kwritemask simplemacro2 zreg {kwritemask} ENDM

simplemacro3 zmm16, k6

Hopefully that fully explains what I'm trying to do here.

The above should expand to the valid "vsubpd zmm16 {k6}, zmm10, zmm11"

On Thu, Dec 14, 2017 at 3:40 PM, John Hankinson notifications@github.com wrote:

Hi,

Yep that’ll never work passing reg {decorator} as a single parameter to another macro, they have to be separated.

Zfmsubpd zmm16, kwritemask, zmmcarry, zmm26, zmm22

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 20:33 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment < comment@noreply.github.com> Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

There is no comma after "zmm16". Try:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

On Thu, Dec 14, 2017 at 2:58 PM, John Hankinson notifications@github.com wrote:

Did you change the macro to take the mask as a separate parameter ? I used your macro in the test-case which is working here as follows:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16, {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351819445, or mute the thread https://github.com/notifications/unsubscribe- auth/AVPFM65GOUEkp-nK_3mECQ9B_Ha4oDA9ks5tAX3sgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ Terraspace/UASM/issues/68#issuecomment-351827787 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AQGQVO9ps9Wpw01gyLQwS6D_ j18SfmI-ks5tAYXmgaJpZM4Q9z8y> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351829523, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPFMzKBhjEjUfhpBeKDONoos_x_MdkAks5tAYetgaJpZM4Q9z8y .

john-terraspace commented 6 years ago

The macro triggers the error at declaration rather than invocation due to the fact that macros are pre-parsed and stored in a cached/tokenized form.

It’s the tokenization phase that causes the issue here due to historical reasons the decorators { } etc are handled at tokenization stage, and in the case

where a decorator is preceded by a zmm register the tokenizer expects to be able to extract a valid k mask. The macro argument name is not stored in the symbol table in any form that allows

for easily preventing the assumption that {kwritemask} should be substituted later and not immediately evaluated. Unfortunately there was no other way to implement decorators without a near-complete re-write of the original jwasm parser, evaluator and codegenerator to handle decorators at a different stage. The macro3 case where the mask is preceded by another argument (which is not a register) avoids the issue. (This may be a clue as to a possible solution to avoid evaluating the decorator at all during macro caching).

This is why I suggested the separated form as it prevents the tokenizer from trying to extract the decorator until invocation time, for example the below example modified as such:

simplemacro2 MACRO zreg, kwritemask

vsubpd zreg {kwritemask}, zmm10, zmm11

ENDM

simplemacro1 MACRO kwritemask

simplemacro2 zmm16, kwritemask

ENDM

simplemacro1 k6

;As proof that passing "zmm16 {k6}" as one argument to a macro is valid,

;consider that the following does work:

simplemacro3 MACRO zreg, kwritemask

simplemacro2 zreg, kwritemask

ENDM

simplemacro3 zmm16, k6

This works in all cases. I know it’s not what you wanted, but it achieves the same end result ?

I will continue to see if there is another way to solve it, but I’m not hopeful that it would be a quick fix …

unless the idea around prevention of decorator extraction at all during macro caching works out 😐

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 22:23 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment comment@noreply.github.com Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

There is no reason this shouldn't work. First off, defining a macro should never raise an error. Errors should happen when the macro is expanded. Second, this simplified macro shows how it should work.

simplemacro2 MACRO zreg vsubpd zreg, zmm10, zmm11 ENDM

simplemacro1 MACRO kwritemask simplemacro2 zmm16 {kwritemask} ENDM

simplemacro1 k6

As proof that passing "zmm16 {k6}" as one argument to a macro is valid, consider that the following does work:

simplemacro3 MACRO zreg, kwritemask simplemacro2 zreg {kwritemask} ENDM

simplemacro3 zmm16, k6

Hopefully that fully explains what I'm trying to do here.

The above should expand to the valid "vsubpd zmm16 {k6}, zmm10, zmm11"

On Thu, Dec 14, 2017 at 3:40 PM, John Hankinson notifications@github.com wrote:

Hi,

Yep that’ll never work passing reg {decorator} as a single parameter to another macro, they have to be separated.

Zfmsubpd zmm16, kwritemask, zmmcarry, zmm26, zmm22

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 20:33 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment < comment@noreply.github.com> Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

There is no comma after "zmm16". Try:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

On Thu, Dec 14, 2017 at 2:58 PM, John Hankinson notifications@github.com wrote:

Did you change the macro to take the mask as a separate parameter ? I used your macro in the test-case which is working here as follows:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16, {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351819445, or mute the thread https://github.com/notifications/unsubscribe- auth/AVPFM65GOUEkp-nK_3mECQ9B_Ha4oDA9ks5tAX3sgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ Terraspace/UASM/issues/68#issuecomment-351827787 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AQGQVO9ps9Wpw01gyLQwS6D_ j18SfmI-ks5tAYXmgaJpZM4Q9z8y> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351829523, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPFMzKBhjEjUfhpBeKDONoos_x_MdkAks5tAYetgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351854370 , or mute the thread https://github.com/notifications/unsubscribe-auth/AQGQVJ5pgJ4eAMgmtlNPkzfJ2w-q5pftks5tAZ-7gaJpZM4Q9z8y .

gwoltman commented 6 years ago

I'm not blocked on this problem at all. I use workarounds similar to what we've discussed above.

However, that I've worked around the problem does not mean the problem is fixed. If you wish to leave this issue open until you can come up with an elegant solution (or leave the issue open forever) that is fine by me. My contention though is that this is a uasm bug.

On Thu, Dec 14, 2017 at 6:33 PM, John Hankinson notifications@github.com wrote:

The macro triggers the error at declaration rather than invocation due to the fact that macros are pre-parsed and stored in a cached/tokenized form.

It’s the tokenization phase that causes the issue here due to historical reasons the decorators { } etc are handled at tokenization stage, and in the case

where a decorator is preceded by a zmm register the tokenizer expects to be able to extract a valid k mask. The macro argument name is not stored in the symbol table in any form that allows

for easily preventing the assumption that {kwritemask} should be substituted later and not immediately evaluated. Unfortunately there was no other way to implement decorators without a near-complete re-write of the original jwasm parser, evaluator and codegenerator to handle decorators at a different stage. The macro3 case where the mask is preceded by another argument (which is not a register) avoids the issue. (This may be a clue as to a possible solution to avoid evaluating the decorator at all during macro caching).

This is why I suggested the separated form as it prevents the tokenizer from trying to extract the decorator until invocation time, for example the below example modified as such:

simplemacro2 MACRO zreg, kwritemask

vsubpd zreg {kwritemask}, zmm10, zmm11

ENDM

simplemacro1 MACRO kwritemask

simplemacro2 zmm16, kwritemask

ENDM

simplemacro1 k6

;As proof that passing "zmm16 {k6}" as one argument to a macro is valid,

;consider that the following does work:

simplemacro3 MACRO zreg, kwritemask

simplemacro2 zreg, kwritemask

ENDM

simplemacro3 zmm16, k6

This works in all cases. I know it’s not what you wanted, but it achieves the same end result ?

I will continue to see if there is another way to solve it, but I’m not hopeful that it would be a quick fix …

unless the idea around prevention of decorator extraction at all during macro caching works out 😐

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 22:23

To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment < comment@noreply.github.com> Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

There is no reason this shouldn't work. First off, defining a macro should never raise an error. Errors should happen when the macro is expanded. Second, this simplified macro shows how it should work.

simplemacro2 MACRO zreg vsubpd zreg, zmm10, zmm11 ENDM

simplemacro1 MACRO kwritemask simplemacro2 zmm16 {kwritemask} ENDM

simplemacro1 k6

As proof that passing "zmm16 {k6}" as one argument to a macro is valid, consider that the following does work:

simplemacro3 MACRO zreg, kwritemask simplemacro2 zreg {kwritemask} ENDM

simplemacro3 zmm16, k6

Hopefully that fully explains what I'm trying to do here.

The above should expand to the valid "vsubpd zmm16 {k6}, zmm10, zmm11"

On Thu, Dec 14, 2017 at 3:40 PM, John Hankinson notifications@github.com wrote:

Hi,

Yep that’ll never work passing reg {decorator} as a single parameter to another macro, they have to be separated.

Zfmsubpd zmm16, kwritemask, zmmcarry, zmm26, zmm22

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 20:33 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment < comment@noreply.github.com> Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

There is no comma after "zmm16". Try:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

On Thu, Dec 14, 2017 at 2:58 PM, John Hankinson < notifications@github.com> wrote:

Did you change the macro to take the mask as a separate parameter ? I used your macro in the test-case which is working here as follows:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16, {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351819445, or mute the thread https://github.com/notifications/unsubscribe- auth/AVPFM65GOUEkp-nK_3mECQ9B_Ha4oDA9ks5tAX3sgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ Terraspace/UASM/issues/68#issuecomment-351827787 , or mute the thread < https://github.com/notifications/unsubscribe- auth/AQGQVO9ps9Wpw01gyLQwS6D_ j18SfmI-ks5tAYXmgaJpZM4Q9z8y> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351829523, or mute the thread https://github.com/notifications/unsubscribe-auth/ AVPFMzKBhjEjUfhpBeKDONoos_x_MdkAks5tAYetgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ Terraspace/UASM/issues/68#issuecomment-351854370 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ AQGQVJ5pgJ4eAMgmtlNPkzfJ2w-q5pftks5tAZ-7gaJpZM4Q9z8y> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351868489, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPFM805KEI2wgfmIRaXFHohA-cV2mI2ks5tAbBZgaJpZM4Q9z8y .

john-terraspace commented 6 years ago

I agree it’s a bug, so leave it open until we can experiment with some other options.. hopefully a clever solution can be found that doesn’t require weeks of dev effort.

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 23:44 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment comment@noreply.github.com Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

I'm not blocked on this problem at all. I use workarounds similar to what we've discussed above.

However, that I've worked around the problem does not mean the problem is fixed. If you wish to leave this issue open until you can come up with an elegant solution (or leave the issue open forever) that is fine by me. My contention though is that this is a uasm bug.

On Thu, Dec 14, 2017 at 6:33 PM, John Hankinson notifications@github.com wrote:

The macro triggers the error at declaration rather than invocation due to the fact that macros are pre-parsed and stored in a cached/tokenized form.

It’s the tokenization phase that causes the issue here due to historical reasons the decorators { } etc are handled at tokenization stage, and in the case

where a decorator is preceded by a zmm register the tokenizer expects to be able to extract a valid k mask. The macro argument name is not stored in the symbol table in any form that allows

for easily preventing the assumption that {kwritemask} should be substituted later and not immediately evaluated. Unfortunately there was no other way to implement decorators without a near-complete re-write of the original jwasm parser, evaluator and codegenerator to handle decorators at a different stage. The macro3 case where the mask is preceded by another argument (which is not a register) avoids the issue. (This may be a clue as to a possible solution to avoid evaluating the decorator at all during macro caching).

This is why I suggested the separated form as it prevents the tokenizer from trying to extract the decorator until invocation time, for example the below example modified as such:

simplemacro2 MACRO zreg, kwritemask

vsubpd zreg {kwritemask}, zmm10, zmm11

ENDM

simplemacro1 MACRO kwritemask

simplemacro2 zmm16, kwritemask

ENDM

simplemacro1 k6

;As proof that passing "zmm16 {k6}" as one argument to a macro is valid,

;consider that the following does work:

simplemacro3 MACRO zreg, kwritemask

simplemacro2 zreg, kwritemask

ENDM

simplemacro3 zmm16, k6

This works in all cases. I know it’s not what you wanted, but it achieves the same end result ?

I will continue to see if there is another way to solve it, but I’m not hopeful that it would be a quick fix …

unless the idea around prevention of decorator extraction at all during macro caching works out 😐

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 22:23

To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment < comment@noreply.github.com> Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

There is no reason this shouldn't work. First off, defining a macro should never raise an error. Errors should happen when the macro is expanded. Second, this simplified macro shows how it should work.

simplemacro2 MACRO zreg vsubpd zreg, zmm10, zmm11 ENDM

simplemacro1 MACRO kwritemask simplemacro2 zmm16 {kwritemask} ENDM

simplemacro1 k6

As proof that passing "zmm16 {k6}" as one argument to a macro is valid, consider that the following does work:

simplemacro3 MACRO zreg, kwritemask simplemacro2 zreg {kwritemask} ENDM

simplemacro3 zmm16, k6

Hopefully that fully explains what I'm trying to do here.

The above should expand to the valid "vsubpd zmm16 {k6}, zmm10, zmm11"

On Thu, Dec 14, 2017 at 3:40 PM, John Hankinson notifications@github.com wrote:

Hi,

Yep that’ll never work passing reg {decorator} as a single parameter to another macro, they have to be separated.

Zfmsubpd zmm16, kwritemask, zmmcarry, zmm26, zmm22

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 20:33 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment < comment@noreply.github.com> Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

There is no comma after "zmm16". Try:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

On Thu, Dec 14, 2017 at 2:58 PM, John Hankinson < notifications@github.com> wrote:

Did you change the macro to take the mask as a separate parameter ? I used your macro in the test-case which is working here as follows:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16, {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351819445, or mute the thread https://github.com/notifications/unsubscribe- auth/AVPFM65GOUEkp-nK_3mECQ9B_Ha4oDA9ks5tAX3sgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ Terraspace/UASM/issues/68#issuecomment-351827787 , or mute the thread < https://github.com/notifications/unsubscribe- auth/AQGQVO9ps9Wpw01gyLQwS6D_ j18SfmI-ks5tAYXmgaJpZM4Q9z8y> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351829523, or mute the thread https://github.com/notifications/unsubscribe-auth/ AVPFMzKBhjEjUfhpBeKDONoos_x_MdkAks5tAYetgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ Terraspace/UASM/issues/68#issuecomment-351854370 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ AQGQVJ5pgJ4eAMgmtlNPkzfJ2w-q5pftks5tAZ-7gaJpZM4Q9z8y> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351868489, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPFM805KEI2wgfmIRaXFHohA-cV2mI2ks5tAbBZgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351870297 , or mute the thread https://github.com/notifications/unsubscribe-auth/AQGQVFbMi7YF8CmEuk4MPaR4SOTSXg-uks5tAbLbgaJpZM4Q9z8y .

john-terraspace commented 6 years ago

Out of interest, how are you finding the performance of the avx512 stuff on the xeon phi in comparison to regular cpu execution ?

I’ve just bought a threadripper 1950x, still haven’t had time to fully play with having 32 threads at my disposal yet!

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 23:44 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment comment@noreply.github.com Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

I'm not blocked on this problem at all. I use workarounds similar to what we've discussed above.

However, that I've worked around the problem does not mean the problem is fixed. If you wish to leave this issue open until you can come up with an elegant solution (or leave the issue open forever) that is fine by me. My contention though is that this is a uasm bug.

On Thu, Dec 14, 2017 at 6:33 PM, John Hankinson notifications@github.com wrote:

The macro triggers the error at declaration rather than invocation due to the fact that macros are pre-parsed and stored in a cached/tokenized form.

It’s the tokenization phase that causes the issue here due to historical reasons the decorators { } etc are handled at tokenization stage, and in the case

where a decorator is preceded by a zmm register the tokenizer expects to be able to extract a valid k mask. The macro argument name is not stored in the symbol table in any form that allows

for easily preventing the assumption that {kwritemask} should be substituted later and not immediately evaluated. Unfortunately there was no other way to implement decorators without a near-complete re-write of the original jwasm parser, evaluator and codegenerator to handle decorators at a different stage. The macro3 case where the mask is preceded by another argument (which is not a register) avoids the issue. (This may be a clue as to a possible solution to avoid evaluating the decorator at all during macro caching).

This is why I suggested the separated form as it prevents the tokenizer from trying to extract the decorator until invocation time, for example the below example modified as such:

simplemacro2 MACRO zreg, kwritemask

vsubpd zreg {kwritemask}, zmm10, zmm11

ENDM

simplemacro1 MACRO kwritemask

simplemacro2 zmm16, kwritemask

ENDM

simplemacro1 k6

;As proof that passing "zmm16 {k6}" as one argument to a macro is valid,

;consider that the following does work:

simplemacro3 MACRO zreg, kwritemask

simplemacro2 zreg, kwritemask

ENDM

simplemacro3 zmm16, k6

This works in all cases. I know it’s not what you wanted, but it achieves the same end result ?

I will continue to see if there is another way to solve it, but I’m not hopeful that it would be a quick fix …

unless the idea around prevention of decorator extraction at all during macro caching works out 😐

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 22:23

To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment < comment@noreply.github.com> Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

There is no reason this shouldn't work. First off, defining a macro should never raise an error. Errors should happen when the macro is expanded. Second, this simplified macro shows how it should work.

simplemacro2 MACRO zreg vsubpd zreg, zmm10, zmm11 ENDM

simplemacro1 MACRO kwritemask simplemacro2 zmm16 {kwritemask} ENDM

simplemacro1 k6

As proof that passing "zmm16 {k6}" as one argument to a macro is valid, consider that the following does work:

simplemacro3 MACRO zreg, kwritemask simplemacro2 zreg {kwritemask} ENDM

simplemacro3 zmm16, k6

Hopefully that fully explains what I'm trying to do here.

The above should expand to the valid "vsubpd zmm16 {k6}, zmm10, zmm11"

On Thu, Dec 14, 2017 at 3:40 PM, John Hankinson notifications@github.com wrote:

Hi,

Yep that’ll never work passing reg {decorator} as a single parameter to another macro, they have to be separated.

Zfmsubpd zmm16, kwritemask, zmmcarry, zmm26, zmm22

From: gwoltman [mailto:notifications@github.com] Sent: 14 December 2017 20:33 To: Terraspace/UASM UASM@noreply.github.com Cc: John Hankinson john@terraspace.co.uk; Comment < comment@noreply.github.com> Subject: Re: [Terraspace/UASM] Macros and writemasks error (#68)

There is no comma after "zmm16". Try:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16 {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

On Thu, Dec 14, 2017 at 2:58 PM, John Hankinson < notifications@github.com> wrote:

Did you change the macro to take the mask as a separate parameter ? I used your macro in the test-case which is working here as follows:

znoconst_rounding_single_nottp MACRO zmmval, zmmcarry, kwritemask zfmsubpd zmmcarry, {kwritemask}, zmmval, zmm24, zmm20 zfmsubpd zmm16, {kwritemask}, zmmcarry, zmm26, zmm22 vsubpd zmmval {kwritemask}, zmmval, zmm16 ENDM

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351819445, or mute the thread https://github.com/notifications/unsubscribe- auth/AVPFM65GOUEkp-nK_3mECQ9B_Ha4oDA9ks5tAX3sgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ Terraspace/UASM/issues/68#issuecomment-351827787 , or mute the thread < https://github.com/notifications/unsubscribe- auth/AQGQVO9ps9Wpw01gyLQwS6D_ j18SfmI-ks5tAYXmgaJpZM4Q9z8y> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351829523, or mute the thread https://github.com/notifications/unsubscribe-auth/ AVPFMzKBhjEjUfhpBeKDONoos_x_MdkAks5tAYetgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ Terraspace/UASM/issues/68#issuecomment-351854370 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ AQGQVJ5pgJ4eAMgmtlNPkzfJ2w-q5pftks5tAZ-7gaJpZM4Q9z8y> .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351868489, or mute the thread https://github.com/notifications/unsubscribe-auth/AVPFM805KEI2wgfmIRaXFHohA-cV2mI2ks5tAbBZgaJpZM4Q9z8y .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/68#issuecomment-351870297 , or mute the thread https://github.com/notifications/unsubscribe-auth/AQGQVFbMi7YF8CmEuk4MPaR4SOTSXg-uks5tAbLbgaJpZM4Q9z8y .

gwoltman commented 6 years ago

Fixed in latest test release