none/tests/fdleak_cmsg_supp.supp: Add suppressions for older glibc
[valgrind.git] / none / tests / s390x / stmg.c
blob7f590619009c9c3c65e90541cb24f9c4c48ed79f
1 #include <stdio.h>
3 static const union words {
4 char c[5 * 8];
5 unsigned long i[5];
6 } base = { .c = "0123456789abcdefghijklmnopqrstuvwxyzABCD" },
7 init = { .c = "._,-'-._,-'-._,-'-._,-'-._,-'-._,-'-._,-" };
9 static void stmg_no_wrap(void)
11 union words buf = init;
12 register unsigned long a asm("5") = base.i[0];
13 register unsigned long b asm("6") = base.i[1];
14 register unsigned long c asm("7") = base.i[2];
16 /* No-wrap around case; copies 24 bytes from BASE to BUF */
17 asm ("stmg %[a], %[c], %[buf]"
18 : [buf] "=S"(buf)
19 : [a] "d"(a), "d"(b), [c] "d"(c)
20 : );
22 /* Write out BUF */
23 fwrite(buf.c, sizeof(buf), 1, stdout);
26 static void stmg_wrap(void)
28 union words buf = init;
29 register unsigned long sp asm("15");
30 register unsigned long a asm("0") = base.i[2];
31 register unsigned long b asm("1") = base.i[3];
32 register unsigned long c asm("2") = base.i[4];
34 /* Wrap around case: avoid changing r15, but ensure it's stored */
35 asm ("stmg 15, %[c], %[buf]"
36 : [buf] "=S"(buf), "=d"(sp)
37 : "d"(a), "d"(b), [c] "d"(c)
38 : );
39 buf.i[0] ^= sp ^ base.i[1];
41 /* Write out BUF */
42 fwrite(buf.c, sizeof(buf), 1, stdout);
46 int main(void)
48 stmg_no_wrap();
49 putchar('\n');
50 stmg_wrap();
51 putchar('\n');
53 return 0;