72
72
AluInstr expect(op1_mov,
73
73
new Register(2000, 1, pin_none),
74
74
new Register(1999, 0, pin_none),
75
{alu_write, alu_last_instr, alu_src0_neg});
75
{alu_write, alu_last_instr});
76
expect.set_source_mod(0, AluInstr::mod_neg);
77
78
check("ALU MOV R2000.y : -R1999.x {WL}", expect);
83
84
AluInstr expect(op1_mov,
84
85
new Register(2000, 1, pin_none),
85
86
new Register(1999, 0, pin_none),
86
{alu_write, alu_last_instr, alu_src0_abs});
87
{alu_write, alu_last_instr});
88
expect.set_source_mod(0, AluInstr::mod_abs);
88
90
check("ALU MOV R2000.y : |R1999.x| {WL}", expect);
94
96
AluInstr expect(op1_mov,
95
97
new Register(2000, 1, pin_none),
96
98
new Register(1999, 0, pin_none),
97
{alu_write, alu_src0_neg, alu_src0_abs});
100
expect.set_source_mod(0, AluInstr::mod_abs);
101
expect.set_source_mod(0, AluInstr::mod_neg);
98
103
check("ALU MOV R2000.y : -|R1999.x| {W}", expect);
131
136
new Register(2000, 1, pin_none),
132
137
new Register(1999, 3, pin_none),
133
138
new Register(1998, 2, pin_none),
134
{alu_last_instr, alu_src1_neg});
140
expect.set_source_mod(1, AluInstr::mod_neg);
135
142
check("ALU ADD __.y : R1999.w -R1998.z {L}", expect);
143
150
new Register(2000, 1, pin_none),
144
151
new Register(1999, 3, pin_none),
145
152
new Register(1998, 2, pin_none),
146
{alu_last_instr, alu_src1_neg, alu_update_pred});
153
{alu_last_instr, alu_update_pred});
154
expect.set_source_mod(1, AluInstr::mod_neg);
147
155
check("ALU SETE __.y : R1999.w -R1998.z {LP}", expect);
167
175
new Register(2000, 1, pin_none),
168
176
new Register(1999, 3, pin_none),
169
177
new Register(1998, 2, pin_none),
170
{alu_last_instr, alu_src1_neg, alu_update_exec});
178
{alu_last_instr, alu_update_exec});
179
expect.set_source_mod(1, AluInstr::mod_neg);
171
180
check("ALU SETNE __.y : R1999.w -R1998.z {LE}", expect);
179
188
new Register(2000, 1, pin_none),
180
189
new Register(1999, 3, pin_none),
181
190
new Register(1998, 2, pin_none),
182
{alu_write, alu_last_instr, alu_src1_abs});
191
{alu_write, alu_last_instr});
192
expect.set_source_mod(1, AluInstr::mod_abs);
183
193
check("ALU ADD R2000.y : R1999.w |R1998.z| {WL}", expect);
191
201
new Register(2000, 1, pin_none),
192
202
new Register(1999, 3, pin_none),
193
203
new Register(1998, 2, pin_none),
194
{alu_write, alu_last_instr, alu_src1_abs, alu_src1_neg});
204
{alu_write, alu_last_instr});
205
expect.set_source_mod(1, AluInstr::mod_neg);
206
expect.set_source_mod(1, AluInstr::mod_abs);
195
208
check("ALU ADD R2000.y : R1999.w -|R1998.z| {WL}", expect);
219
232
new Register(1999, 3, pin_none),
220
233
new Register(1998, 2, pin_none),
221
234
new Register(2000, 1, pin_none),
222
{alu_last_instr, alu_src2_neg});
223
236
check("ALU MULADD_IEEE __.y : R1999.w R1998.z -R2000.y {L}", expect);
268
281
check(init, expect);
284
TEST_F(TestInstrFromString, test_alu_dot4_with_mods)
286
add_dest_from_string("R199.x");
287
add_dest_from_string("R199.y");
288
add_dest_from_string("R199.z");
289
add_dest_from_string("R199.w");
290
add_dest_from_string("R198.x");
291
add_dest_from_string("R198.y");
292
add_dest_from_string("R198.z");
293
add_dest_from_string("R198.w");
294
auto init = std::string("ALU DOT4_IEEE R2000.y : -R199.x R198.w + R199.y |R198.z| + "
295
"-|R199.z| R198.y + -R199.w R198.x {WL}");
297
AluInstr expect(op2_dot4_ieee,
298
new Register(2000, 1, pin_none),
299
{new Register(199, 0, pin_none),
300
new Register(198, 3, pin_none),
301
new Register(199, 1, pin_none),
302
new Register(198, 2, pin_none),
303
new Register(199, 2, pin_none),
304
new Register(198, 1, pin_none),
305
new Register(199, 3, pin_none),
306
new Register(198, 0, pin_none)},
307
{alu_write, alu_last_instr},
310
expect.set_source_mod(0, AluInstr::mod_neg);
311
expect.set_source_mod(3, AluInstr::mod_abs);
312
expect.set_source_mod(4, AluInstr::mod_neg);
313
expect.set_source_mod(4, AluInstr::mod_abs);
314
expect.set_source_mod(7, AluInstr::mod_neg);
317
auto instr = from_string(init);
319
std::ostringstream print_str;
321
EXPECT_EQ(print_str.str(), init);
271
326
TEST_F(TestInstrFromString, test_alu_mov_cf)
273
328
add_dest_from_string("R1999.x");