Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / tcg / s390x / exrl-trtr.c
blob422f7f385a30b495d9f8f17c12caa7090b62d92a
1 #include <stdint.h>
2 #include <unistd.h>
4 int main(void)
6 char op1[] = {0, 1, 2, 3};
7 char op2[256];
8 register uint64_t r1 asm("r1") = 0xffffffffffffffffull;
9 register uint64_t r2 asm("r2") = 0xffffffffffffffffull;
10 uint64_t cc;
11 int i;
13 for (i = 0; i < 256; i++) {
14 if (i == 1) {
15 op2[i] = 0xbb;
16 } else {
17 op2[i] = 0;
20 asm volatile(
21 " j 2f\n"
22 "1: trtr 3(1,%[op1]),%[op2]\n"
23 "2: exrl %[op1_len],1b\n"
24 " ipm %[cc]\n"
25 : [r1] "+r" (r1),
26 [r2] "+r" (r2),
27 [cc] "=r" (cc)
28 : [op1] "a" (&op1),
29 [op1_len] "a" (3),
30 [op2] "Q" (op2)
31 : "cc");
32 cc = (cc >> 28) & 3;
33 if (cc != 1) {
34 write(1, "bad cc\n", 7);
35 return 1;
37 if ((char *)r1 != &op1[1]) {
38 write(1, "bad r1\n", 7);
39 return 1;
41 if (r2 != 0xffffffffffffffbbull) {
42 write(1, "bad r2\n", 7);
43 return 1;
45 return 0;