qemu/tests/tcg/s390x/mvo.c
Thomas Huth f530ba8f8d 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.

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>
2022-03-07 09:04:42 +01:00

26 lines
585 B
C

#include <stdint.h>
#include <stdio.h>
int main(void)
{
uint8_t dest[6] = {0xff, 0x77, 0x88, 0x99, 0x0c, 0xff};
uint8_t src[5] = {0xee, 0x12, 0x34, 0x56, 0xee};
uint8_t expected[6] = {0xff, 0x01, 0x23, 0x45, 0x6c, 0xff};
int i;
asm volatile (
" mvo 0(4,%[dest]),0(3,%[src])\n"
:
: [dest] "a" (dest + 1),
[src] "a" (src + 1)
: "memory");
for (i = 0; i < sizeof(expected); i++) {
if (dest[i] != expected[i]) {
fprintf(stderr, "bad data\n");
return 1;
}
}
return 0;
}