~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/drivers/r600/sfn/tests/sfn_instrfromstring_test.cpp

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
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);
76
77
 
77
78
   check("ALU MOV R2000.y : -R1999.x {WL}", expect);
78
79
}
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);
87
89
 
88
90
   check("ALU MOV R2000.y : |R1999.x| {WL}", expect);
89
91
}
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});
 
99
                   {alu_write});
 
100
   expect.set_source_mod(0, AluInstr::mod_abs);
 
101
   expect.set_source_mod(0, AluInstr::mod_neg);
 
102
 
98
103
   check("ALU MOV R2000.y : -|R1999.x| {W}", expect);
99
104
}
100
105
 
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});
 
139
                   {alu_last_instr});
 
140
   expect.set_source_mod(1, AluInstr::mod_neg);
 
141
 
135
142
   check("ALU ADD __.y : R1999.w -R1998.z {L}", expect);
136
143
}
137
144
 
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);
148
156
}
149
157
 
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);
172
181
}
173
182
 
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);
184
194
}
185
195
 
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);
 
207
 
195
208
   check("ALU ADD R2000.y : R1999.w -|R1998.z| {WL}", expect);
196
209
}
197
210
 
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});
 
235
                   {alu_last_instr});
223
236
   check("ALU MULADD_IEEE __.y : R1999.w R1998.z -R2000.y {L}", expect);
224
237
}
225
238
 
268
281
   check(init, expect);
269
282
}
270
283
 
 
284
TEST_F(TestInstrFromString, test_alu_dot4_with_mods)
 
285
{
 
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}");
 
296
 
 
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},
 
308
                   4);
 
309
 
 
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);
 
315
 
 
316
   check(init, expect);
 
317
   auto instr = from_string(init);
 
318
 
 
319
   std::ostringstream print_str;
 
320
   print_str << *instr;
 
321
   EXPECT_EQ(print_str.str(), init);
 
322
 
 
323
}
 
324
 
 
325
 
271
326
TEST_F(TestInstrFromString, test_alu_mov_cf)
272
327
{
273
328
   add_dest_from_string("R1999.x");