FreeBSD: add file descriptor tracking for _umtx_op
[valgrind.git] / none / tests / s390x / clc.c
blob4640bd5fd591ab7d90147474f51370868a8fccca
1 #include <stdio.h>
2 #include <stdlib.h>
4 char b1[23] ="0123456789abcdefghijklm";
5 char b2[23] ="mlkjihgfedcba9876543210";
6 char b3[23] ="mmmmmmmmmmmmmmmmmmmmmmm";
7 char b4[23] ="00000000000000000000000";
8 char longbuf1[256];
9 char longbuf2[256];
11 static int clc(char *a1,char *a2, int l)
13 int cc;
15 asm volatile( "larl 1, 1f\n"
16 "ex %3,0(1)\n"
17 "j 2f\n"
18 "1: clc 0(1,%1),0(%2)\n"
19 "2: ipm %0\n"
20 "srl %0,28\n"
21 :"=d" (cc)
22 :"a" (a1), "a" (a2), "a" (l): "1", "cc");
23 return cc;
27 void testrun(char *a1, char *a2, int l)
29 int cc;
31 cc = clc(a1, a2, l);
32 printf("%d bytes:%d\n",l, cc);
36 void multiplex(int l, long offset1, long offset2)
38 testrun(b1 + offset1, b1 + offset2, l);
39 testrun(b1 + offset1, b2 + offset2, l);
40 testrun(b1 + offset1, b3 + offset2, l);
41 testrun(b1 + offset1, b4 + offset2, l);
42 testrun(b2 + offset1, b2 + offset2, l);
43 testrun(b2 + offset1, b3 + offset2, l);
44 testrun(b2 + offset1, b4 + offset2, l);
45 testrun(b3 + offset1, b3 + offset2, l);
46 testrun(b3 + offset1, b4 + offset2, l);
47 testrun(b4 + offset1, b4 + offset2, l);
50 void sweep(int l)
52 multiplex(l, 0, 0);
53 multiplex(l, 1, 0);
54 multiplex(l, 1, 1);
55 multiplex(l, 0, 1);
58 int main()
60 sweep(0);
61 sweep(1);
62 sweep(2);
63 sweep(3);
64 sweep(4);
65 sweep(5);
66 sweep(22);
67 testrun(longbuf1, longbuf2, 255);
68 longbuf1[255] = 'a';
69 testrun(longbuf1, longbuf2, 255);
70 longbuf2[255] = 'b';
71 testrun(longbuf1, longbuf2, 255);
72 return 0;