Does Metal-C inline assembler support ternary address?
Posted: Sat Mar 09, 2019 12:23 pm
The MVC instruction requires 'ternary address' for the destination operand: D(L,B). If you want to use default L, you must write it like this: D(,B). If the comma is omitted, say D(L), the number in brackets is treated as L rather than B.
However, in Metal-C, if I write it like the following:
int val1, val2 = 0;
__asm(" MVC %0,%1"
: "=m"(val1)
: "m"(val2)
: );
The compiler will generates code like the following:
MVC 124(13),128(13)
This is definitely wrong. The programme will probably ABEND because the instruction will copy 13 bytes of data rather than 4, and causes 'buffer overrun'. Actually I really tried this, and got 0C4 / 4 which is not a surprise.
So the question is how I can make the Metal-C compiler generate operand in such form: num(num, num), or at least num(,num)?
Thank you guys!!
However, in Metal-C, if I write it like the following:
int val1, val2 = 0;
__asm(" MVC %0,%1"
: "=m"(val1)
: "m"(val2)
: );
The compiler will generates code like the following:
MVC 124(13),128(13)
This is definitely wrong. The programme will probably ABEND because the instruction will copy 13 bytes of data rather than 4, and causes 'buffer overrun'. Actually I really tried this, and got 0C4 / 4 which is not a surprise.
So the question is how I can make the Metal-C compiler generate operand in such form: num(num, num), or at least num(,num)?
Thank you guys!!