10 #include <orc-test/orctest.h>
17 get_program (int type)
23 p = orc_program_new ();
24 orc_program_add_destination (p, 2, "d1");
25 orc_program_add_source (p, 2, "s1");
26 orc_program_add_source (p, 2, "s2");
27 orc_program_add_constant (p, 2, 2, "c1");
28 orc_program_add_constant (p, 2, 2, "c2");
29 orc_program_add_temporary (p, 2, "t1");
31 orc_program_append_str (p, "addw", "t1", "s1", "s2");
32 orc_program_append_str (p, "addw", "t1", "t1", "c1");
33 orc_program_append_str (p, "shrsw", "t1", "t1", "c2");
34 orc_program_append_str (p, "addw", "d1", "d1", "t1");
37 p = orc_program_new ();
38 orc_program_add_destination (p, 2, "d1");
39 orc_program_add_source (p, 2, "s1");
40 orc_program_add_source (p, 2, "s2");
41 orc_program_add_constant (p, 2, 2, "c1");
42 orc_program_add_constant (p, 2, 2, "c2");
43 orc_program_add_temporary (p, 2, "t1");
45 orc_program_append_str (p, "addw", "t1", "s1", "s2");
46 orc_program_append_str (p, "addw", "t1", "t1", "c1");
47 orc_program_append_str (p, "shrsw", "t1", "t1", "c2");
48 orc_program_append_str (p, "subw", "d1", "d1", "t1");
51 p = orc_program_new ();
52 orc_program_add_destination (p, 2, "d1");
53 orc_program_add_source (p, 2, "s1");
54 orc_program_add_source (p, 2, "s2");
55 orc_program_add_constant (p, 2, 1, "c1");
56 orc_program_add_constant (p, 2, 1, "c2");
57 orc_program_add_temporary (p, 2, "t1");
59 orc_program_append_str (p, "addw", "t1", "s1", "s2");
60 orc_program_append_str (p, "addw", "t1", "t1", "c1");
61 orc_program_append_str (p, "shrsw", "t1", "t1", "c2");
62 orc_program_append_str (p, "addw", "d1", "d1", "t1");
65 p = orc_program_new ();
66 orc_program_add_destination (p, 2, "d1");
67 orc_program_add_source (p, 2, "s1");
68 orc_program_add_source (p, 2, "s2");
69 orc_program_add_constant (p, 2, 1, "c1");
70 orc_program_add_constant (p, 2, 1, "c2");
71 orc_program_add_temporary (p, 2, "t1");
73 orc_program_append_str (p, "addw", "t1", "s1", "s2");
74 orc_program_append_str (p, "addw", "t1", "t1", "c1");
75 orc_program_append_str (p, "shrsw", "t1", "t1", "c2");
76 orc_program_append_str (p, "subw", "d1", "d1", "t1");
79 p = orc_program_new_dss (2,2,2);
80 orc_program_add_constant (p, 2, 1, "c1");
81 orc_program_add_temporary (p, 2, "t1");
83 orc_program_append_str (p, "addw", "t1", "s1", "c1");
84 orc_program_append_str (p, "shrsw", "d1", "t1", "c1");
87 p = orc_program_new_dss (2,2,2);
89 orc_program_append_str (p, "addw", "d1", "s1", "s2");
92 p = orc_program_new_ds (2,2);
93 orc_program_add_constant (p, 2, 1, "c1");
95 orc_program_append_str (p, "shlw", "d1", "s1", "c1");
98 p = orc_program_new_ds (2,2);
99 orc_program_add_constant (p, 2, 2, "c1");
101 orc_program_append_str (p, "shlw", "d1", "s1", "c1");
104 p = orc_program_new_dss (2,2,2);
105 orc_program_add_temporary (p, 2, "t1");
106 orc_program_add_temporary (p, 4, "t2");
107 orc_program_add_parameter (p, 2, "p1");
108 orc_program_add_parameter (p, 4, "p2");
109 orc_program_add_parameter (p, 4, "p3");
111 orc_program_append_str (p, "addw", "t1", "s1", "s2");
112 orc_program_append_str (p, "mulswl", "t2", "t1", "p1");
113 orc_program_append_str (p, "addl", "t2", "t2", "p2");
114 orc_program_append_str (p, "shll", "t2", "t2", "p3");
115 orc_program_append_ds_str (p, "convlw", "t1", "t2");
116 orc_program_append_str (p, "addw", "d1", "d1", "t1");
119 p = orc_program_new ();
120 orc_program_add_destination (p, 2, "d1");
121 orc_program_add_source (p, 2, "s20");
122 orc_program_add_source (p, 2, "s21");
123 orc_program_add_source (p, 2, "s22");
124 orc_program_add_source (p, 2, "s23");
125 orc_program_add_constant (p, 2, 9, "c1");
126 orc_program_add_parameter (p, 2, "p1");
127 orc_program_add_parameter (p, 2, "p2");
128 orc_program_add_temporary (p, 2, "t1");
129 orc_program_add_temporary (p, 2, "t2");
131 orc_program_append_str (p, "addw", "t1", "s21", "s22");
132 orc_program_append_str (p, "mullw", "t1", "t1", "c1");
133 orc_program_append_str (p, "addw", "t2", "s20", "s23");
134 orc_program_append_str (p, "subw", "t1", "t1", "t2");
135 orc_program_append_str (p, "addw", "t1", "t1", "p1");
136 orc_program_append_str (p, "shrsw", "t1", "t1", "p2");
137 orc_program_append_str (p, "addw", "d1", "d1", "t1");
140 p = orc_program_new ();
141 orc_program_add_destination (p, 2, "d1");
142 orc_program_add_source (p, 2, "s20");
143 orc_program_add_source (p, 2, "s21");
144 orc_program_add_source (p, 2, "s22");
145 orc_program_add_source (p, 2, "s23");
146 orc_program_add_constant (p, 2, 9, "c1");
147 orc_program_add_parameter (p, 2, "p1");
148 orc_program_add_parameter (p, 2, "p2");
149 orc_program_add_temporary (p, 2, "t1");
150 orc_program_add_temporary (p, 2, "t2");
152 orc_program_append_str (p, "addw", "t1", "s21", "s22");
153 orc_program_append_str (p, "mullw", "t1", "t1", "c1");
154 orc_program_append_str (p, "addw", "t2", "s20", "s23");
155 orc_program_append_str (p, "subw", "t1", "t1", "t2");
156 orc_program_append_str (p, "addw", "t1", "t1", "p1");
157 orc_program_append_str (p, "shrsw", "t1", "t1", "p2");
158 orc_program_append_str (p, "subw", "d1", "d1", "t1");
161 p = orc_program_new_dss (2,2,2);
163 orc_program_append_str (p, "subw", "d1", "s1", "s2");
166 p = orc_program_new_ds (1,1);
167 orc_program_append_ds_str (p, "copyb", "d1", "s1");
170 p = orc_program_new_dss (2,2,1);
171 orc_program_add_temporary (p, 2, "t1");
173 orc_program_append_ds_str (p, "convubw", "t1", "s2");
174 orc_program_append_str (p, "addw", "d1", "t1", "s1");
177 p = orc_program_new_ds (2,1);
179 orc_program_append_ds_str (p, "convubw", "d1", "s1");
182 p = orc_program_new_ds (1,2);
184 orc_program_append_ds_str (p, "convsuswb", "d1", "s1");
187 p = orc_program_new_dss (2,2,1);
188 orc_program_add_temporary (p, 2, "t1");
190 orc_program_append_ds_str (p, "convubw", "t1", "s2");
191 orc_program_append_str (p, "subw", "d1", "s1", "t1");
194 p = orc_program_new_dss (2,2,2);
195 orc_program_add_source (p, 1, "s3");
196 orc_program_add_temporary (p, 2, "t1");
198 orc_program_append_ds_str (p, "convubw", "t1", "s3");
199 orc_program_append_str (p, "mullw", "t1", "t1", "s2");
200 orc_program_append_str (p, "addw", "d1", "s1", "t1");
212 test_program (int type)
218 p = get_program(type);
220 sprintf(s, "test_schro_%d", type);
221 orc_program_set_name (p, s);
223 ret = orc_test_compare_output (p);
231 main (int argc, char *argv[])
239 //printf("/* %d */\n", i);