tests/tcg/s390x: Fix mvc, mvo and pack tests with Clang
authorThomas Huth <thuth@redhat.com>
Tue, 1 Mar 2022 09:39:11 +0000 (10:39 +0100)
committerThomas Huth <thuth@redhat.com>
Mon, 7 Mar 2022 08:04:42 +0000 (09:04 +0100)
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.

Message-Id: <20220301093911.1450719-1-thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/tcg/s390x/mvc.c
tests/tcg/s390x/mvo.c
tests/tcg/s390x/pack.c

index aa552d52e53d184ab50f3b84c6d332833e424447..7ae4c445500c5c0799125704d3b363e294fc2322 100644 (file)
@@ -20,8 +20,8 @@ static inline void mvc_256(const char *dst, const char *src)
     asm volatile (
         "    mvc 0(256,%[dst]),0(%[src])\n"
         :
-        : [dst] "d" (dst),
-          [src] "d" (src)
+        : [dst] "a" (dst),
+          [src] "a" (src)
         : "memory");
 }
 
index 5546fe2a976708f77d80a21efa7964eb9e6550b2..0c3ecdde2eae7ef43b4b7345f69bd9302af3cb64 100644 (file)
@@ -11,8 +11,8 @@ int main(void)
     asm volatile (
         "    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++) {
index 4be36f29a74042294d7d69aeb313f3e8bd87665e..55e7e214e83ef30c568d634e3142f103a5dc25d7 100644 (file)
@@ -9,7 +9,7 @@ int main(void)
     asm volatile(
         "    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]) {