1 /* tests, xc,oc and nc */
2 #include <stdio.h>
3 #include "test.h"
4
test_oc(void)5 void test_oc(void)
6 {
7 char buf1[20] = "UUUUU*UUU****U*\0\0\0\0\n";
8 char buf2[20] = "*U\0*\0\0UU*\0U*AUAA*UU\n";
9 char zero[2] = "\0\0";
10
11 printf("\nOC:\n");
12 asm volatile ("oc %O0(1,%R0),%0\n"::"Q" (*zero),
13 "Q"(*zero):"memory");
14 printf("CC:%d\n", get_cc());
15 dump_field(zero, 2);
16
17 asm volatile ("oc %O0(19,%R0),%1\n"::"Q" (*buf1),
18 "Q"(*buf2):"memory");
19 printf("CC:%d\n", get_cc());
20 dump_field(buf1, 20);
21 }
22
test_nc(void)23 void test_nc(void)
24 {
25 char buf1[20] = "UUUUU*UUU****U*\0\0\0\0\n";
26 char buf2[20] = "*U\0*\0\0UU*\0U*AUAA*UU\n";
27 char zero[2] = "\0\0";
28
29 printf("\nNC:\n");
30 asm volatile ("nc %O0(1,%R0),%0\n"::"Q" (*zero),
31 "Q"(*zero):"memory");
32 printf("CC:%d\n", get_cc());
33 dump_field(zero, 2);
34
35 asm volatile ("nc %O0(19,%R0),%1\n"::"Q" (*buf1),
36 "Q"(*buf2):"memory");
37 printf("CC:%d\n", get_cc());
38 dump_field(buf1, 20);
39 }
40
41
test_xc(void)42 void test_xc(void)
43 {
44 char buf1[20] = "UUUUU*UUU****U*\0\0\0\0\n";
45 char buf2[20] = "*U\0*\0\0UU*\0U*AUAA*UU\n";
46 char buf3[20] = "0123456789abcdefghij";
47 char zero[300] =
48 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
49 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
50 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
51 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
52 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
53 "aaaaa";
54
55 printf("\nXC:\n");
56 asm volatile ("xc %O0(1,%R0),%0\n"::"Q" (*zero),
57 "Q"(*zero):"memory");
58 printf("CC:%d\n", get_cc());
59 dump_field(zero, 4);
60
61 asm volatile ("xc %O0(10,%R0),%0\n"::"Q" (*zero),
62 "Q"(*zero):"memory");
63 printf("CC:%d\n", get_cc());
64 dump_field(zero, 12);
65
66 asm volatile ("xc %O0(100,%R0),%0\n"::"Q" (*zero),
67 "Q"(*zero):"memory");
68 printf("CC:%d\n", get_cc());
69 dump_field(zero, 102);
70
71 asm volatile ("xc %O0(256,%R0),%0\n"::"Q" (*zero),
72 "Q"(*zero):"memory");
73 printf("CC:%d\n", get_cc());
74 dump_field(zero, 257);
75
76 asm volatile ("lghi 1,256 + 20\n"
77 "larl 2,1f\n"
78 "ex 1,0(2)\n"
79 "j 2f\n"
80 "1: xc 260(1,%0),260(%0)\n"
81 "2:\n"::"a" (zero), "a"(zero):"memory", "1", "2");
82 printf("CC:%d\n", get_cc());
83 dump_field(zero + 260, 30);
84
85 asm volatile ("xc 0(19,%0),0(%1)\n"::"a" (buf1),
86 "a"(buf2):"memory");
87 printf("CC:%d\n", get_cc());
88 dump_field(buf1, 20);
89 asm volatile ("xc 0(10,%0),0(%0)\n"::"a" (buf3):"memory");
90
91 printf("CC:%d\n", get_cc());
92 dump_field(buf3, 20);
93 return;
94 }
95
main()96 int main()
97 {
98 test_oc();
99 test_nc();
100 test_xc();
101 return 0;
102 }
103