1b35637a050d995634a21a126d37957f7bcee03a6petarj#include <stdio.h>
2b35637a050d995634a21a126d37957f7bcee03a6petarj
3b35637a050d995634a21a126d37957f7bcee03a6petarjunsigned int mem[] = {
4b35637a050d995634a21a126d37957f7bcee03a6petarj   0x121f1e1f, 0, 3, -1,
5b35637a050d995634a21a126d37957f7bcee03a6petarj   0x232f2e2f, 0x242c2b2b, 0x252a2e2b, 0x262d2d2a,
6b35637a050d995634a21a126d37957f7bcee03a6petarj   0x3f343f3e, 0x3e353d3c, 0x363a3c3b, 0x3b373b3a,
7b35637a050d995634a21a126d37957f7bcee03a6petarj   0x454f4e45, 0x4e464d46, 0x474d474c, 0x4a484a4c
8b35637a050d995634a21a126d37957f7bcee03a6petarj};
9b35637a050d995634a21a126d37957f7bcee03a6petarj
10b35637a050d995634a21a126d37957f7bcee03a6petarjunsigned int mem1[] = {
11b35637a050d995634a21a126d37957f7bcee03a6petarj   0, 0, 0, 0,
12b35637a050d995634a21a126d37957f7bcee03a6petarj   0, 0, 0, 0,
13b35637a050d995634a21a126d37957f7bcee03a6petarj   0xffffffff, 0, 0, 0,
14b35637a050d995634a21a126d37957f7bcee03a6petarj   0, 0, 0, 0
15b35637a050d995634a21a126d37957f7bcee03a6petarj};
16b35637a050d995634a21a126d37957f7bcee03a6petarj
17b35637a050d995634a21a126d37957f7bcee03a6petarjunsigned int mem2[] = {
18b35637a050d995634a21a126d37957f7bcee03a6petarj   0x0000e680, 0x00010700, 0x0000e7dc, 0x0000b0d0,
19b35637a050d995634a21a126d37957f7bcee03a6petarj   0x2ab05fd0, 0x0000b6a0, 0x0000be80, 0x0000de10,
20b35637a050d995634a21a126d37957f7bcee03a6petarj   0x0000df20, 0x2ab05fe0, 0x0000dfd0, 0x00010300
21b35637a050d995634a21a126d37957f7bcee03a6petarj};
22b35637a050d995634a21a126d37957f7bcee03a6petarj
23b35637a050d995634a21a126d37957f7bcee03a6petarj#define TESTINST1(instruction, RTval, offset, RT, RS)  \
24b35637a050d995634a21a126d37957f7bcee03a6petarj{                                                      \
25b35637a050d995634a21a126d37957f7bcee03a6petarj   unsigned int out;                                   \
26b35637a050d995634a21a126d37957f7bcee03a6petarj   __asm__ __volatile__(                               \
27b35637a050d995634a21a126d37957f7bcee03a6petarj      "move $"#RS", %1"                 "\n\t"         \
28b35637a050d995634a21a126d37957f7bcee03a6petarj      "li   $"#RT", "#RTval             "\n\t"         \
29b35637a050d995634a21a126d37957f7bcee03a6petarj      instruction                       "\n\t"         \
30b35637a050d995634a21a126d37957f7bcee03a6petarj      "lw   %0,     "#offset"($"#RS")"  "\n\t"         \
31b35637a050d995634a21a126d37957f7bcee03a6petarj      : "=&r" (out)                                    \
32b35637a050d995634a21a126d37957f7bcee03a6petarj      : "r" (mem1), "r" (RTval)                        \
33b35637a050d995634a21a126d37957f7bcee03a6petarj      : #RT, #RS                                       \
34b35637a050d995634a21a126d37957f7bcee03a6petarj   );                                                  \
35b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("%s :: RTval: 0x%x, out: 0x%x\n",            \
36b35637a050d995634a21a126d37957f7bcee03a6petarj          instruction, RTval, out);                    \
37b35637a050d995634a21a126d37957f7bcee03a6petarj   out = 0;                                            \
38b35637a050d995634a21a126d37957f7bcee03a6petarj   __asm__ __volatile__(                               \
39b35637a050d995634a21a126d37957f7bcee03a6petarj      "move $"#RS", %1"                 "\n\t"         \
40b35637a050d995634a21a126d37957f7bcee03a6petarj      "li   $"#RT", " #RTval            "\n\t"         \
41b35637a050d995634a21a126d37957f7bcee03a6petarj      instruction                       "\n\t"         \
42b35637a050d995634a21a126d37957f7bcee03a6petarj      "lw   %0,     "#offset"($"#RS")"  "\n\t"         \
43b35637a050d995634a21a126d37957f7bcee03a6petarj      : "=&r" (out)                                    \
44b35637a050d995634a21a126d37957f7bcee03a6petarj      : "r" (mem), "r" (RTval)                         \
45b35637a050d995634a21a126d37957f7bcee03a6petarj      : #RT, #RS                                       \
46b35637a050d995634a21a126d37957f7bcee03a6petarj   );                                                  \
47b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("%s :: RTval: 0x%x, out: 0x%x\n",            \
48b35637a050d995634a21a126d37957f7bcee03a6petarj          instruction, RTval, out);                    \
49b35637a050d995634a21a126d37957f7bcee03a6petarj}
50b35637a050d995634a21a126d37957f7bcee03a6petarj
51b35637a050d995634a21a126d37957f7bcee03a6petarj/* swl $t0, 3($t1)
52b35637a050d995634a21a126d37957f7bcee03a6petarj   swr $t0, 0($t1) */
53b35637a050d995634a21a126d37957f7bcee03a6petarj#define TESTINSTsw(RTval, offset, RT, RS)                                    \
54b35637a050d995634a21a126d37957f7bcee03a6petarj{                                                                            \
55b35637a050d995634a21a126d37957f7bcee03a6petarj   unsigned int out;                                                         \
56b35637a050d995634a21a126d37957f7bcee03a6petarj   __asm__ __volatile__(                                                     \
57b35637a050d995634a21a126d37957f7bcee03a6petarj      "move   $"#RS", %1"               "\n\t"                               \
58b35637a050d995634a21a126d37957f7bcee03a6petarj      "daddiu $"#RS", $"#RS", "#offset  "\n\t"                               \
59b35637a050d995634a21a126d37957f7bcee03a6petarj      "li     $"#RT", "#RTval           "\n\t"                               \
60b35637a050d995634a21a126d37957f7bcee03a6petarj      "swl    $t0,    3($t1)"           "\n\t"                               \
61b35637a050d995634a21a126d37957f7bcee03a6petarj      "swr    $t0,    0($t1)"           "\n\t"                               \
62b35637a050d995634a21a126d37957f7bcee03a6petarj      "lw     %0,     0($"#RS")"        "\n\t"                               \
63b35637a050d995634a21a126d37957f7bcee03a6petarj      : "=&r" (out)                                                          \
64b35637a050d995634a21a126d37957f7bcee03a6petarj      : "r" (mem2), "r" (RTval)                                              \
65b35637a050d995634a21a126d37957f7bcee03a6petarj      : #RT, #RS                                                             \
66b35637a050d995634a21a126d37957f7bcee03a6petarj   );                                                                        \
67b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("swl $t0, 3($t1)\nswr $t0, 0($t1)\n :: RTval: 0x%x, out: 0x%x\n",  \
68b35637a050d995634a21a126d37957f7bcee03a6petarj          RTval, out);                                                       \
69b35637a050d995634a21a126d37957f7bcee03a6petarj}
70b35637a050d995634a21a126d37957f7bcee03a6petarj
71b35637a050d995634a21a126d37957f7bcee03a6petarjvoid ppMem(unsigned int* m, int len)
72b35637a050d995634a21a126d37957f7bcee03a6petarj{
73b35637a050d995634a21a126d37957f7bcee03a6petarj   int i;
74b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("MEM1:\n");
75b35637a050d995634a21a126d37957f7bcee03a6petarj   for (i = 0; i < len; i += 4) {
76b35637a050d995634a21a126d37957f7bcee03a6petarj      printf("0x%x, 0x%x, 0x%x, 0x%x\n", m[i], m[i+1], m[i+2], m[i+3]);
77b35637a050d995634a21a126d37957f7bcee03a6petarj      m[i] = 0;
78b35637a050d995634a21a126d37957f7bcee03a6petarj      m[i+1] = 0;
79b35637a050d995634a21a126d37957f7bcee03a6petarj      m[i+2] = 0;
80b35637a050d995634a21a126d37957f7bcee03a6petarj      m[i+3] = 0;
81b35637a050d995634a21a126d37957f7bcee03a6petarj      if (i == 2) {
82b35637a050d995634a21a126d37957f7bcee03a6petarj         m[i] = 0xffffffff;
83b35637a050d995634a21a126d37957f7bcee03a6petarj         m[i+1] = 0;
84b35637a050d995634a21a126d37957f7bcee03a6petarj         m[i+2] = 0;
85b35637a050d995634a21a126d37957f7bcee03a6petarj         m[i+3] = 0;
86b35637a050d995634a21a126d37957f7bcee03a6petarj      }
87b35637a050d995634a21a126d37957f7bcee03a6petarj   }
88b35637a050d995634a21a126d37957f7bcee03a6petarj}
89b35637a050d995634a21a126d37957f7bcee03a6petarj
90b35637a050d995634a21a126d37957f7bcee03a6petarjvoid ppMem1(unsigned int* m, int len)
91b35637a050d995634a21a126d37957f7bcee03a6petarj{
92b35637a050d995634a21a126d37957f7bcee03a6petarj   int i;
93b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("MEM:\n");
94b35637a050d995634a21a126d37957f7bcee03a6petarj   for (i = 0; i < len; i += 4) {
95b35637a050d995634a21a126d37957f7bcee03a6petarj      printf("0x%x, 0x%x, 0x%x, 0x%x\n", m[i], m[i+1], m[i+2], m[i+3]);
96b35637a050d995634a21a126d37957f7bcee03a6petarj   }
97b35637a050d995634a21a126d37957f7bcee03a6petarj   m[0] = 0x121f1e1f;
98b35637a050d995634a21a126d37957f7bcee03a6petarj   m[1] = 0;
99b35637a050d995634a21a126d37957f7bcee03a6petarj   m[2] = 3;
100b35637a050d995634a21a126d37957f7bcee03a6petarj   m[3] = -1;
101b35637a050d995634a21a126d37957f7bcee03a6petarj   m[4] = 0x232f2e2f;
102b35637a050d995634a21a126d37957f7bcee03a6petarj   m[5] = 0x242c2b2b;
103b35637a050d995634a21a126d37957f7bcee03a6petarj   m[6] = 0x252a2e2b;
104b35637a050d995634a21a126d37957f7bcee03a6petarj   m[7] = 0x262d2d2a;
105b35637a050d995634a21a126d37957f7bcee03a6petarj   m[8] = 0x3f343f3e;
106b35637a050d995634a21a126d37957f7bcee03a6petarj   m[9] = 0x3e353d3c;
107b35637a050d995634a21a126d37957f7bcee03a6petarj   m[10] = 0x363a3c3b;
108b35637a050d995634a21a126d37957f7bcee03a6petarj   m[11] = 0x3b373b3a;
109b35637a050d995634a21a126d37957f7bcee03a6petarj   m[12] = 0x454f4e45;
110b35637a050d995634a21a126d37957f7bcee03a6petarj   m[13] = 0x4e464d46;
111b35637a050d995634a21a126d37957f7bcee03a6petarj   m[14] = 0x474d474c;
112b35637a050d995634a21a126d37957f7bcee03a6petarj   m[15] = 0x4a484a4c;
113b35637a050d995634a21a126d37957f7bcee03a6petarj}
114b35637a050d995634a21a126d37957f7bcee03a6petarj
115b35637a050d995634a21a126d37957f7bcee03a6petarjvoid ppMem2(unsigned int* m, int len)
116b35637a050d995634a21a126d37957f7bcee03a6petarj{
117b35637a050d995634a21a126d37957f7bcee03a6petarj   int i;
118b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("MEM:\n");
119b35637a050d995634a21a126d37957f7bcee03a6petarj   for (i = 0; i < len; i=i+4) {
120b35637a050d995634a21a126d37957f7bcee03a6petarj      printf("0x%x, 0x%x, 0x%x, 0x%x\n", m[i], m[i+1], m[i+2], m[i+3]);
121b35637a050d995634a21a126d37957f7bcee03a6petarj   }
122b35637a050d995634a21a126d37957f7bcee03a6petarj
123b35637a050d995634a21a126d37957f7bcee03a6petarj   m[0] = 0x0000e680;
124b35637a050d995634a21a126d37957f7bcee03a6petarj   m[1] = 0x00010700;
125b35637a050d995634a21a126d37957f7bcee03a6petarj   m[2] = 0x0000e7dc;
126b35637a050d995634a21a126d37957f7bcee03a6petarj   m[3] = 0x0000b0d0;
127b35637a050d995634a21a126d37957f7bcee03a6petarj   m[4] = 0x2ab05fd0;
128b35637a050d995634a21a126d37957f7bcee03a6petarj   m[5] = 0x0000b6a0;
129b35637a050d995634a21a126d37957f7bcee03a6petarj   m[6] = 0x0000be80;
130b35637a050d995634a21a126d37957f7bcee03a6petarj   m[7] = 0x0000de10;
131b35637a050d995634a21a126d37957f7bcee03a6petarj   m[8] = 0x0000df20;
132b35637a050d995634a21a126d37957f7bcee03a6petarj   m[9] = 0x2ab05fe0;
133b35637a050d995634a21a126d37957f7bcee03a6petarj   m[10] = 0x0000dfd0;
134b35637a050d995634a21a126d37957f7bcee03a6petarj   m[11] = 0x00010300;
135b35637a050d995634a21a126d37957f7bcee03a6petarj}
136b35637a050d995634a21a126d37957f7bcee03a6petarj
137b35637a050d995634a21a126d37957f7bcee03a6petarjint main()
138b35637a050d995634a21a126d37957f7bcee03a6petarj{
139b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("sb\n");
140b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 3($t1)",  0,          3,  t0, t1);
141b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 5($t1)",  0x31415927, 5,  t0, t1);
142b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 7($t1)",  0x7fffffff, 7,  t0, t1);
143b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 1($t1)",  0x80000000, 1,  t0, t1);
144b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 2($t1)",  0x80000000, 2,  t0, t1);
145b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 6($t1)",  0x7fffffff, 6,  t0, t1);
146b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 11($t1)", 0x7fffffff, 11, t0, t1);
147b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 8($t1)",  -1,         8,  t0, t1);
148b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 0($t1)",  0x31415927, 0,  t0, t1);
149b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 0($t1)",  0x0dd00000, 0,  t0, t1);
150b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 0($t1)",  655,        0,  t0, t1);
151b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 0($t1)",  -655,       0,  t0, t1);
152b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 0($t1)",  15,         0,  t0, t1);
153b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 0($t1)",  1,          0,  t0, t1);
154b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 0($t1)",  53,         0,  t0, t1);
155b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
156b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
157b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 31($t1)", 0xffffffff, 31, t0, t1);
158b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 35($t1)", 0xffffffff, 35, t0, t1);
159b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 41($t1)", 0x31415927, 41, t0, t1);
160b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 42($t1)", 0x7fffffff, 42, t0, t1);
161b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 45($t1)", 0x80000000, 45, t0, t1);
162b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sb $t0, 51($t1)", 655,        51, t0, t1);
163b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem(mem1, 16);
164b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem1(mem, 16);
165b35637a050d995634a21a126d37957f7bcee03a6petarj
166b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("sh\n");
167b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 1($t1)",  0,          1,  t0, t1);
168b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 3($t1)",  0x31415927, 3,  t0, t1);
169b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 5($t1)",  0x7fffffff, 5,  t0, t1);
170b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 7($t1)",  0x80000000, 7,  t0, t1);
171b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 9($t1)",  0x80000000, 9,  t0, t1);
172b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 6($t1)",  0x7fffffff, 6,  t0, t1);
173b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 11($t1)", 0x7fffffff, 11, t0, t1);
174b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 8($t1)",  -1,         8,  t0, t1);
175b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 0($t1)",  0x31415927, 0,  t0, t1);
176b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 0($t1)",  0x0dd00000, 0,  t0, t1);
177b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 0($t1)",  655,        0,  t0, t1);
178b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 0($t1)",  -655,       0,  t0, t1);
179b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 0($t1)",  15,         0,  t0, t1);
180b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 0($t1)",  1,          0,  t0, t1);
181b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 0($t1)",  53,         0,  t0, t1);
182b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
183b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
184b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 31($t1)", 0xffffffff, 31, t0, t1);
185b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 35($t1)", 0xffffffff, 35, t0, t1);
186b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 41($t1)", 0x31415927, 41, t0, t1);
187b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 47($t1)", 0x7fffffff, 47, t0, t1);
188b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 49($t1)", 0x80000000, 49, t0, t1);
189b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sh $t0, 51($t1)", 655,        51, t0, t1);
190b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem(mem1, 16);
191b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem1(mem, 16);
192b35637a050d995634a21a126d37957f7bcee03a6petarj
193b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("sw\n");
194b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 1($t1)",  0,          1,  t0, t1);
195b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 3($t1)",  0x31415927, 3,  t0, t1);
196b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 5($t1)",  0x7fffffff, 5,  t0, t1);
197b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 7($t1)",  0x80000000, 7,  t0, t1);
198b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 9($t1)",  0x80000000, 9,  t0, t1);
199b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 6($t1)",  0x7fffffff, 6,  t0, t1);
200b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 15($t1)", 0x7fffffff, 11, t0, t1);
201b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 8($t1)",  -1,         8,  t0, t1);
202b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 0($t1)",  0x31415927, 0,  t0, t1);
203b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 0($t1)",  0x0dd00000, 0,  t0, t1);
204b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 0($t1)",  655,        0,  t0, t1);
205b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 0($t1)",  -655,       0,  t0, t1);
206b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 0($t1)",  15,         0,  t0, t1);
207b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 0($t1)",  1,          0,  t0, t1);
208b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 0($t1)",  53,         0,  t0, t1);
209b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
210b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
211b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 31($t1)", 0xffffffff, 31, t0, t1);
212b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 37($t1)", 0xffffffff, 37, t0, t1);
213b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 49($t1)", 0x31415927, 49, t0, t1);
214b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 41($t1)", 0x7fffffff, 41, t0, t1);
215b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 43($t1)", 0x80000000, 43, t0, t1);
216b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("sw $t0, 51($t1)", 655,        51, t0, t1);
217b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem(mem1, 16);
218b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem1(mem, 16);
219b35637a050d995634a21a126d37957f7bcee03a6petarj
220b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("swl\n");
221b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 1($t1)",  0,          1,  t0, t1);
222b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 3($t1)",  0x31415927, 3,  t0, t1);
223b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 5($t1)",  0x7fffffff, 5,  t0, t1);
224b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 7($t1)",  0x80000000, 7,  t0, t1);
225b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 9($t1)",  0x80000000, 9,  t0, t1);
226b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 6($t1)",  0x7fffffff, 6,  t0, t1);
227b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 11($t1)", 0x7fffffff, 11, t0, t1);
228b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 8($t1)",  -1,         8,  t0, t1);
229b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 0($t1)",  0x31415927, 0,  t0, t1);
230b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 0($t1)",  0x0dd00000, 0,  t0, t1);
231b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 0($t1)",  655,        0,  t0, t1);
232b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 0($t1)",  -655,       0,  t0, t1);
233b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 0($t1)",  15,         0,  t0, t1);
234b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 0($t1)",  1,          0,  t0, t1);
235b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 0($t1)",  53,         0,  t0, t1);
236b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
237b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
238b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 33($t1)", 0xffffffff, 33, t0, t1);
239b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 35($t1)", 0xffffffff, 35, t0, t1);
240b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 41($t1)", 0x31415927, 41, t0, t1);
241b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 45($t1)", 0x7fffffff, 45, t0, t1);
242b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 49($t1)", 0x80000000, 49, t0, t1);
243b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swl $t0, 51($t1)", 655,        51, t0, t1);
244b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem(mem1, 16);
245b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem1(mem, 16);
246b35637a050d995634a21a126d37957f7bcee03a6petarj
247b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("swr\n");
248b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 1($t1)",  0,          1,  t0, t1);
249b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 3($t1)",  0x31415927, 3,  t0, t1);
250b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 5($t1)",  0x7fffffff, 5,  t0, t1);
251b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 7($t1)",  0x80000000, 7,  t0, t1);
252b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 9($t1)",  0x80000000, 9,  t0, t1);
253b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 6($t1)",  0x7fffffff, 6,  t0, t1);
254b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 11($t1)", 0x7fffffff, 11, t0, t1);
255b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 8($t1)",  -1,         8,  t0, t1);
256b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 0($t1)",  0x31415927, 0,  t0, t1);
257b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 0($t1)",  0x0dd00000, 0,  t0, t1);
258b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 0($t1)",  655,        0,  t0, t1);
259b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 0($t1)",  -655,       0,  t0, t1);
260b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 0($t1)",  15,         0,  t0, t1);
261b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 0($t1)",  1,          0,  t0, t1);
262b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 0($t1)",  53,         0,  t0, t1);
263b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
264b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
265b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 31($t1)", 0xffffffff, 31, t0, t1);
266b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 33($t1)", 0xffffffff, 33, t0, t1);
267b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 45($t1)", 0x31415927, 45, t0, t1);
268b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 47($t1)", 0x7fffffff, 47, t0, t1);
269b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 49($t1)", 0x80000000, 49, t0, t1);
270b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("swr $t0, 51($t1)", 655,        51, t0, t1);
271b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem(mem1, 16);
272b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem1(mem, 16);
273b35637a050d995634a21a126d37957f7bcee03a6petarj
274b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("ulw\n");
275b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 0($t1)",  0,          0,  t0, t1);
276b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 0($t1)",  0x31415927, 0,  t0, t1);
277b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 0($t1)",  0x7fffffff, 0,  t0, t1);
278b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 0($t1)",  0x80000000, 0,  t0, t1);
279b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 2($t1)",  0x80000000, 2,  t0, t1);
280b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 6($t1)",  0x7fffffff, 6,  t0, t1);
281b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 10($t1)", 0x7fffffff, 10, t0, t1);
282b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 8($t1)",  -1,         8,  t0, t1);
283b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 0($t1)",  0x31415927, 0,  t0, t1);
284b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 0($t1)",  0x0dd00000, 0,  t0, t1);
285b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 0($t1)",  655,        0,  t0, t1);
286b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 0($t1)",  -655,       0,  t0, t1);
287b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 0($t1)",  15,         0,  t0, t1);
288b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 0($t1)",  1,          0,  t0, t1);
289b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 0($t1)",  53,         0,  t0, t1);
290b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
291b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
292b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 32($t1)", 0xffffffff, 32, t0, t1);
293b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 36($t1)", 0xffffffff, 36, t0, t1);
294b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 40($t1)", 0x31415927, 40, t0, t1);
295b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 44($t1)", 0x7fffffff, 44, t0, t1);
296b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 48($t1)", 0x80000000, 48, t0, t1);
297b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("ulw $t0, 52($t1)", 655,        52, t0, t1);
298b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem(mem1, 16);
299b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem1(mem, 16);
300b35637a050d995634a21a126d37957f7bcee03a6petarj
301b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("usw\n");
302b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 0($t1)",  0,          0,  t0, t1);
303b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 0($t1)",  0x31415927, 0,  t0, t1);
304b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 0($t1)",  0x7fffffff, 0,  t0, t1);
305b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 0($t1)",  0x80000000, 0,  t0, t1);
306b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 2($t1)",  0x80000000, 2,  t0, t1);
307b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 6($t1)",  0x7fffffff, 6,  t0, t1);
308b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 10($t1)", 0x7fffffff, 10, t0, t1);
309b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 8($t1)",  -1,         8,  t0, t1);
310b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 0($t1)",  0x31415927, 0,  t0, t1);
311b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 0($t1)",  0x0dd00000, 0,  t0, t1);
312b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 0($t1)",  655,        0,  t0, t1);
313b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 0($t1)",  -655,       0,  t0, t1);
314b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 0($t1)",  15,         0,  t0, t1);
315b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 0($t1)",  1,          0,  t0, t1);
316b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 0($t1)",  53,         0,  t0, t1);
317b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
318b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 2($t1)",  0xffffffff, 2,  t0, t1);
319b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 32($t1)", 0xffffffff, 32, t0, t1);
320b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 36($t1)", 0xffffffff, 36, t0, t1);
321b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 40($t1)", 0x31415927, 40, t0, t1);
322b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 44($t1)", 0x7fffffff, 44, t0, t1);
323b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 48($t1)", 0x80000000, 48, t0, t1);
324b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINST1("usw $t0, 52($t1)", 655,        52, t0, t1);
325b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem(mem1, 16);
326b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem1(mem, 16);
327b35637a050d995634a21a126d37957f7bcee03a6petarj
328b35637a050d995634a21a126d37957f7bcee03a6petarj   printf("swl $t0, 3($t0)\nswr $t0, 0($t0)\n");
329b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINSTsw(0x4853000,  0,  t0, t1);
330b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem2(mem2, 12);
331b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINSTsw(0x4853000,  4,  t0, t1);
332b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem2(mem2, 12);
333b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINSTsw(0x4863700,  8,  t0, t1);
334b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem2(mem2, 12);
335b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINSTsw(0x48aedd0,  12, t0, t1);
336b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem2(mem2, 12);
337b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINSTsw(0x2aaee700, 16, t0, t1);
338b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem2(mem2, 12);
339b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINSTsw(0x2aaee7ff, 20, t0, t1);
340b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem2(mem2, 12);
341b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINSTsw(0x2aaeffff, 24, t0, t1);
342b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem2(mem2, 12);
343b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINSTsw(0x4863700,  28, t0, t1);
344b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem2(mem2, 12);
345b35637a050d995634a21a126d37957f7bcee03a6petarj   TESTINSTsw(0x2aaee700, 32, t0, t1);
346b35637a050d995634a21a126d37957f7bcee03a6petarj   ppMem2(mem2, 12);
347b35637a050d995634a21a126d37957f7bcee03a6petarj
348b35637a050d995634a21a126d37957f7bcee03a6petarj   return 0;
349b35637a050d995634a21a126d37957f7bcee03a6petarj}
350b35637a050d995634a21a126d37957f7bcee03a6petarj
351