FreeBSD: add file descriptor tracking for _umtx_op
[valgrind.git] / none / tests / s390x / lpr.c
blob2b03da14938f2355003f550bdb6c31f2ddc22be8
1 #include <limits.h>
2 #include <stdio.h>
4 int lpr(int org, int *new)
6 int _new, cc;
7 asm volatile( "lpr %0,%2\n\t"
8 "ipm %1\n\t"
9 "srl %1,28\n\t"
10 : "=d" (_new), "=d" (cc)
11 : "d" (org)
12 : "cc");
13 *new = _new;
14 return cc;
17 int lpgr(unsigned long org, unsigned long *new)
19 unsigned long _new;
20 int cc;
21 asm volatile( "lpgr %0,%2\n\t"
22 "ipm %1\n\t"
23 "srl %1,28\n\t"
24 : "=d" (_new), "=d" (cc)
25 : "d" (org)
26 : "cc");
27 *new = _new;
28 return cc;
31 int lpgfr(unsigned long org, unsigned long *new)
33 unsigned long _new;
34 int cc;
35 asm volatile( "lpgfr %0,%2\n\t"
36 "ipm %1\n\t"
37 "srl %1,28\n\t"
38 : "=d" (_new), "=d" (cc)
39 : "d" (org)
40 : "cc");
41 *new = _new;
42 return cc;
46 void t32(int value)
48 int n,cc;
50 cc = lpr(value, &n);
52 printf("new: %d cc: %d\n", n, cc);
55 void t64(unsigned long value)
57 int cc;
58 unsigned long n;
60 cc = lpgr(value, &n);
62 printf("new: %ld cc: %d\n", n, cc);
65 void t3264(unsigned long value)
67 int cc;
68 unsigned long n;
70 cc = lpgfr(value, &n);
72 printf("new: %ld cc: %d\n", n, cc);
77 int main()
79 printf("lpr\n");
80 t32(0); t32(1); t32(-1);
81 t32(INT_MAX); t32(INT_MIN); t32(UINT_MAX);
83 printf("lpgr\n");
84 t64(0); t64(1); t64(-1);
85 t64(INT_MAX); t64(INT_MIN); t64(UINT_MAX);
86 t64(LONG_MAX); t64(LONG_MIN); t64(ULONG_MAX);
88 printf("lpgfr\n");
89 t3264(0); t3264(1); t64(-1);
90 t3264(INT_MAX); t3264(INT_MIN); t3264(UINT_MAX);
91 t3264(LONG_MAX); t3264(LONG_MIN); t3264(ULONG_MAX);
93 return 0;