tests/tcg/s390x: Fix mvc, mvo and pack tests with Clang
PATCH 1/1 tests/tcg/s390x: Fix mvc, mvo and pack tests with Clang
These instructions use addressing with a "base address", meaning that if register r0 is used, it is always treated as zero, no matter what value is stored in the register. So we have to make sure not to use register r0 for these instructions in our tests. There was no problem with GCC so far since it seems to always pick other registers by default, but Clang likes to chose register r0, too, so we have to use the "a" constraint to make sure that it does not pick r0 here.
--- tests/tcg/s390x/mvc.c | 4 ++-- tests/tcg/s390x/mvo.c | 4 ++-- tests/tcg/s390x/pack.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
tests/tcg/s390x/mvc.c +2 -2
@@ -20,8 +20,8 @@ static inline void mvc_256(const char *dst, const char *src) asmvolatile (" mvc 0(256,%[dst]),0(%[src])\n" : - : [dst]"d" (dst), - [src]"d" (src) + : [dst]"a" (dst), + [src]"a" (src) :"memory" ); }
tests/tcg/s390x/mvo.c +2 -2
@@ -11,8 +11,8 @@ int main(void) asmvolatile (" mvo 0(4,%[dest]),0(3,%[src])\n" : - : [dest]"d" (dest +1 ), - [src]"d" (src +1 ) + : [dest]"a" (dest +1 ), + [src]"a" (src +1 ) :"memory" );for (i =0 ; i <sizeof (expected); i++) {
tests/tcg/s390x/pack.c +1 -1
@@ -9,7 +9,7 @@ int main(void) asmvolatile (" pack 2(4,%[data]),2(4,%[data])\n" : - : [data]"r" (&data[0 ]) + : [data]"a" (&data[0 ]) :"memory" );for (i =0 ; i <8 ; i++) {if (data[i] != exp[i]) {
Signature · 1 line
2.27.0
Quoted 51 lines · Thomas Huth
These instructions use addressing with a "base address", meaning that if register r0 is used, it is always treated as zero, no matter what value is stored in the register. So we have to make sure not to use register r0 for these instructions in our tests. There was no problem with GCC so far since it seems to always pick other registers by default, but Clang likes to chose register r0, too, so we have to use the "a" constraint to make sure that it does not pick r0 here.
Signed-off-by Thomas Huth <[email protected]>--- tests/tcg/s390x/mvc.c | 4 ++-- tests/tcg/s390x/mvo.c | 4 ++-- tests/tcg/s390x/pack.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)tests/tcg/s390x/mvc.c +2
-2@@ -20,8 +20,8 @@ static inline void mvc_256(const char *dst, const char *src) asmvolatile (" mvc 0(256,%[dst]),0(%[src])\n" : - : [dst]"d" (dst), - [src]"d" (src) + : [dst]"a" (dst), + [src]"a" (src) :"memory" ); }tests/tcg/s390x/mvo.c +2
-2@@ -11,8 +11,8 @@ int main(void) asmvolatile (" mvo 0(4,%[dest]),0(3,%[src])\n" : - : [dest]"d" (dest +1 ), - [src]"d" (src +1 ) + : [dest]"a" (dest +1 ), + [src]"a" (src +1 ) :"memory" );for (i =0 ; i <sizeof (expected); i++) {tests/tcg/s390x/pack.c +0
-0
tests/tcg/s390x/pack.c int main(void) · line 15
Quoted 8 lines
tests/tcg/s390x/pack.c +1
-1@@ -9,7 +9,7 @@ int main(void) asmvolatile (" pack 2(4,%[data]),2(4,%[data])\n" : - : [data]"r" (&data[0 ]) + : [data]"a" (&data[0 ]) :"memory" );for (i =0 ; i <8 ; i++) {if (data[i] != exp[i]) {
Signature · 3 lines
Thanks, David / dhildenb
Quoted 9 lines · Thomas Huth
These instructions use addressing with a "base address", meaning that if register r0 is used, it is always treated as zero, no matter what value is stored in the register. So we have to make sure not to use register r0 for these instructions in our tests. There was no problem with GCC so far since it seems to always pick other registers by default, but Clang likes to chose register r0, too, so we have to use the "a" constraint to make sure that it does not pick r0 here.
Quoted 6 lines
Signed-off-by Thomas Huth<[email protected]>--- tests/tcg/s390x/mvc.c | 4 ++-- tests/tcg/s390x/mvo.c | 4 ++-- tests/tcg/s390x/pack.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
r~