tests/tcg/s390x: Cleanup of mie3 tests.
PATCH v2 1/1 tests/tcg/s390x: Cleanup of mie3 tests.
Adds clobbers and merges remaining separate asm statements.
v1 -> v2:
* Corrected side in rebase conflict, removing older code.
Signed-off-by David Miller <[email protected]>
--- tests/tcg/s390x/mie3-compl.c | 18 +++++++++++----- tests/tcg/s390x/mie3-mvcrl.c | 12 +++++++---- tests/tcg/s390x/mie3-sel.c | 41 ++++++++++++++++++------------------ 3 files changed, 41 insertions(+), 30 deletions(-)
tests/tcg/s390x/mie3-compl.c +13 -5
@@ -1,13 +1,20 @@#include <stdint.h> +#define FbinOp (S ,ASM ) uint64_t S(uint64_t a, uint64_t b) \ -{ \ - uint64_t res = 0; \ - asm ("llihf %[res],801\n" ASM \ - : [res]"=&r"(res) : [a]"r"(a), [b]"r"(b) : "cc"); \ - return res; \ +{ \ + uint64_t res = 0; \ +asm volatile ( \ + "llihf %[res],801\n"\ + ASM \ + : [res] "=&r" (res) \ + : [a] "r" (a) \ + , [b] "r" (b) \ +); \ + return res; \ } +/* AND WITH COMPLEMENT */ FbinOp(_ncrk, ".insn rrf, 0xB9F50000, %[res], %[b], %[a], 0\n")FbinOp (_ncgrk,".insn rrf, 0xB9E50000, %[res], %[b], %[a], 0\n" )
@@ -28,6 +35,7 @@ FbinOp(_nogrk, ".insn rrf, 0xB9660000, %[res], %[b], %[a], 0\n") FbinOp(_ocrk, ".insn rrf, 0xB9750000, %[res], %[b], %[a], 0\n") FbinOp(_ocgrk, ".insn rrf, 0xB9650000, %[res], %[b], %[a], 0\n") +int main (int argc,char *argv[]) { if (_ncrk(0xFF88, 0xAA11) != 0x0000032100000011ull ||
tests/tcg/s390x/mie3-mvcrl.c +8 -4
@@ -1,15 +1,17 @@#include <stdint.h> #include <string.h> +static inline void mvcrl_8 (const char *dst,const char *src) { asmvolatile ( -"llill %%r0, 8\n" -".insn sse, 0xE50A00000000, 0(%[dst]), 0(%[src])" - : : [dst]"d" (dst), [src]"d" (src) - :"memory" ); +"llill %%r0, 8\n" +".insn sse, 0xE50A00000000, 0(%[dst]), 0(%[src])" + : : [dst]"d" (dst), [src]"d" (src) + :"r0" ,"memory" ); } +int main (int argc,char *argv[]) {const char *alpha ="abcdefghijklmnop" ;
@@ -25,3 +27,5 @@ int main(int argc, char *argv[])return strncmp (alpha, tstr,16ul ); } + +
tests/tcg/s390x/mie3-sel.c +20 -21
53 lines not on this page · raw message
Signature · 1 line
2.34.1
tests/tcg/s390x/mie3-sel.c line 16
Quoted 13 lines · David Miller
tests/tcg/s390x/mie3-sel.c +13
-0+{ \ +uint64_t res =0 ; \ +asmvolatile ( \ +"lg %%r0, %[c]\n" \ +"ltgr %%r0, %%r0\n" \ +ASM \ +"stg %%r0, %[res] " \ + : [res]"=m" (res) \ + : [a]"r" (a), \ + [b]"r" (b), \ + [c]"m" (c) \ + :"r0" ,"memory" \ +); \
I don't understand why you're still going through memory.
r~
I used
#define Fi3(S, ASM) uint64_t S(uint64_t a, uint64_t b, uint64_t c) \
{ \
uint64_t res = 0; \
asm volatile ( \
"ltgr %[c], %[c]\n" \
ASM \
"stg %[c], %[res] " \
: [res] "=&r" (res) \
: [a] "r" (a), \
[b] "r" (b), \
[c] "r" (c) \
); \
return res; \
}However the constraint must be wrong there.
Sorry about split message.
Quoted 20 lines · David Miller
I used
#define
Fi3(S, ASM)uint64_tS(uint64_t a, uint64_t b, uint64_t c)\{ \ uint64_t res = 0; \ asm volatile ( \ "ltgr %[c], %[c]\n" \ ASM \ "stg %[c], %[res] " \ : [res] "=&r" (res) \ : [a] "r" (a), \ [b] "r" (b), \ [c] "r" (c) \ ); \ return res; \ }
Quoted 14 lines · David Miller
However the constraint must be wrong there.
Sorry about split message.On Tue, Mar 1, 2022 at 3:21 PM David Miller <[email protected] <mailto:[email protected]>> wrote:
I used #define Fi3(S, ASM) uint64_t S(uint64_t a, uint64_t b, uint64_t c) \ { \ uint64_t res= 0; \ asm volatile ( \ "ltgr %[c], %[c]\n" \ ASM \
Quoted 10 lines
"stg %[c], %[res] " \
: [res]"=&r" (res) \
: [a]"r" (a), \
[b]"r" (b), \
[c]"r" (c) \
); \
return res; \
}The final stg is wrong and unnecessary.
r~