Debian Codegraph @

test/fuzz/transformation_replace_add_sub_mul_with_carrying_extended_test.cpp

raw
1 // Copyright (c) 2020 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "source/fuzz/transformation_replace_add_sub_mul_with_carrying_extended.h"
16
17 #include "gtest/gtest.h"
18 #include "source/fuzz/fuzzer_util.h"
19 #include "test/fuzz/fuzz_test_util.h"
20
21 namespace spvtools {
22 namespace fuzz {
23 namespace {
24
25 TEST(TransformationReplaceAddSubMulWithCarryingExtendedTest,
26 NotApplicableBasicChecks) {
27 // First conditions in IsApplicable() are checked.
28 std::string shader = R"(
29 OpCapability Shader
30 %1 = OpExtInstImport "GLSL.std.450"
31 OpMemoryModel Logical GLSL450
32 OpEntryPoint Fragment %4 "main"
33 OpExecutionMode %4 OriginUpperLeft
34 OpSource ESSL 310
35 OpName %4 "main"
36 OpName %8 "i1"
37 OpName %10 "i2"
38 OpName %12 "i3"
39 %2 = OpTypeVoid
40 %3 = OpTypeFunction %2
41 %6 = OpTypeInt 32 1
42 %7 = OpTypePointer Function %6
43 %9 = OpConstant %6 2
44 %11 = OpConstant %6 3
45 %4 = OpFunction %2 None %3
46 %5 = OpLabel
47 %8 = OpVariable %7 Function
48 %10 = OpVariable %7 Function
49 %12 = OpVariable %7 Function
50 OpStore %8 %9
51 OpStore %10 %11
52 %13 = OpLoad %6 %10
53 %14 = OpLoad %6 %8
54 %15 = OpSDiv %6 %13 %14
55 OpStore %12 %15
56 OpReturn
57 OpFunctionEnd
58 )";
59 const auto env = SPV_ENV_UNIVERSAL_1_4;
60 const auto consumer = nullptr;
61 const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption);
62
63 spvtools::ValidatorOptions validator_options;
64 TransformationContext transformation_context(
65 MakeUnique<FactManager>(context.get()), validator_options);
66 // Bad: |struct_fresh_id| must be fresh.
67 auto transformation_bad_1 =
68 TransformationReplaceAddSubMulWithCarryingExtended(14, 15);
69 ASSERT_FALSE(
70 transformation_bad_1.IsApplicable(context.get(), transformation_context));
71
72 // Bad: The transformation cannot be applied to an instruction OpSDiv.
73 auto transformation_bad_2 =
74 TransformationReplaceAddSubMulWithCarryingExtended(20, 15);
75 ASSERT_FALSE(
76 transformation_bad_2.IsApplicable(context.get(), transformation_context));
77
78 // Bad: The transformation cannot be applied to an nonexistent instruction.
79 auto transformation_bad_3 =
80 TransformationReplaceAddSubMulWithCarryingExtended(20, 21);
81 ASSERT_FALSE(
82 transformation_bad_3.IsApplicable(context.get(), transformation_context));
83 }
84
85 TEST(TransformationReplaceAddSubMulWithCarryingExtendedTest,
86 NotApplicableDifferingSignedTypes) {
87 // Operand types and result types do not match. Not applicable to an operation
88 // on vectors with signed integers and operation on signed integers.
89 std::string shader = R"(
90 OpCapability Shader
91 %1 = OpExtInstImport "GLSL.std.450"
92 OpMemoryModel Logical GLSL450
93 OpEntryPoint Fragment %4 "main"
94 OpExecutionMode %4 OriginUpperLeft
95 OpSource ESSL 310
96 OpName %4 "main"
97 OpName %8 "i1"
98 OpName %10 "i2"
99 OpName %16 "v1"
100 OpName %20 "v2"
101 OpName %25 "v3"
102 OpName %31 "u1"
103 %2 = OpTypeVoid
104 %3 = OpTypeFunction %2
105 %6 = OpTypeInt 32 1
106 %7 = OpTypePointer Function %6
107 %9 = OpConstant %6 1
108 %14 = OpTypeVector %6 3
109 %15 = OpTypePointer Function %14
110 %17 = OpConstant %6 0
111 %18 = OpConstant %6 2
112 %19 = OpConstantComposite %14 %17 %9 %18
113 %21 = OpConstant %6 3
114 %22 = OpConstant %6 4
115 %23 = OpConstant %6 5
116 %24 = OpConstantComposite %14 %21 %22 %23
117 %29 = OpTypeInt 32 0
118 %30 = OpTypePointer Function %29
119 %32 = OpConstant %29 2
120 %4 = OpFunction %2 None %3
121 %5 = OpLabel
122 %8 = OpVariable %7 Function
123 %10 = OpVariable %7 Function
124 %16 = OpVariable %15 Function
125 %20 = OpVariable %15 Function
126 %25 = OpVariable %15 Function
127 %31 = OpVariable %30 Function
128 OpStore %8 %9
129 %11 = OpLoad %6 %8
130 %12 = OpLoad %6 %8
131 %13 = OpISub %6 %11 %12
132 OpStore %10 %13
133 OpStore %16 %19
134 OpStore %20 %24
135 %26 = OpLoad %14 %16
136 %27 = OpLoad %14 %20
137 %28 = OpIAdd %14 %26 %27
138 OpStore %25 %28
139 OpStore %31 %32
140 %40 = OpIMul %6 %32 %18
141 %41 = OpIAdd %6 %32 %32
142 OpReturn
143 OpFunctionEnd
144 )";
145 const auto env = SPV_ENV_UNIVERSAL_1_4;
146 const auto consumer = nullptr;
147 const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption);
148
149 spvtools::ValidatorOptions validator_options;
150 TransformationContext transformation_context(
151 MakeUnique<FactManager>(context.get()), validator_options);
152 // Bad: The transformation cannot be applied to an instruction OpIMul that has
153 // different signedness of the types of operands.
154 auto transformation_bad_1 =
155 TransformationReplaceAddSubMulWithCarryingExtended(50, 40);
156 ASSERT_FALSE(
157 transformation_bad_1.IsApplicable(context.get(), transformation_context));
158
159 // Bad: The transformation cannot be applied to an instruction OpIAdd that has
160 // different signedness of the result type than the signedness of the types of
161 // the operands.
162 auto transformation_bad_2 =
163 TransformationReplaceAddSubMulWithCarryingExtended(50, 41);
164 ASSERT_FALSE(
165 transformation_bad_2.IsApplicable(context.get(), transformation_context));
166
167 // Bad: The transformation cannot be applied to the instruction OpIAdd of two
168 // vectors that have signed components.
169 auto transformation_bad_3 =
170 TransformationReplaceAddSubMulWithCarryingExtended(50, 28);
171 ASSERT_FALSE(
172 transformation_bad_3.IsApplicable(context.get(), transformation_context));
173
174 // Bad: The transformation cannot be applied to the instruction OpISub of two
175 // signed integers
176 auto transformation_bad_4 =
177 TransformationReplaceAddSubMulWithCarryingExtended(50, 13);
178 ASSERT_FALSE(
179 transformation_bad_4.IsApplicable(context.get(), transformation_context));
180 }
181
182 TEST(TransformationReplaceAddSubMulWithCarryingExtendedTest,
183 NotApplicableMissingStructTypes) {
184 // In all cases the required struct types are missing.
185 std::string shader = R"(
186 OpCapability Shader
187 %1 = OpExtInstImport "GLSL.std.450"
188 OpMemoryModel Logical GLSL450
189 OpEntryPoint Fragment %4 "main"
190 OpExecutionMode %4 OriginUpperLeft
191 OpSource ESSL 310
192 OpName %4 "main"
193 OpName %8 "u1"
194 OpName %10 "u2"
195 OpName %12 "u3"
196 OpName %24 "i1"
197 OpName %26 "i2"
198 OpName %28 "i3"
199 %2 = OpTypeVoid
200 %3 = OpTypeFunction %2
201 %6 = OpTypeInt 32 0
202 %7 = OpTypePointer Function %6
203 %9 = OpConstant %6 1
204 %11 = OpConstant %6 2
205 %22 = OpTypeInt 32 1
206 %23 = OpTypePointer Function %22
207 %25 = OpConstant %22 1
208 %27 = OpConstant %22 2
209 %4 = OpFunction %2 None %3
210 %5 = OpLabel
211 %8 = OpVariable %7 Function
212 %10 = OpVariable %7 Function
213 %12 = OpVariable %7 Function
214 %24 = OpVariable %23 Function
215 %26 = OpVariable %23 Function
216 %28 = OpVariable %23 Function
217 OpStore %8 %9
218 OpStore %10 %11
219 %13 = OpLoad %6 %8
220 %14 = OpLoad %6 %10
221 %15 = OpIAdd %6 %13 %14
222 OpStore %12 %15
223 %16 = OpLoad %6 %8
224 %17 = OpLoad %6 %10
225 %18 = OpISub %6 %16 %17
226 OpStore %12 %18
227 %19 = OpLoad %6 %8
228 %20 = OpLoad %6 %10
229 %21 = OpIMul %6 %19 %20
230 OpStore %12 %21
231 OpStore %24 %25
232 OpStore %26 %27
233 %29 = OpLoad %22 %24
234 %30 = OpLoad %22 %26
235 %31 = OpIMul %22 %29 %30
236 OpStore %28 %31
237 OpReturn
238 OpFunctionEnd
239 )";
240 const auto env = SPV_ENV_UNIVERSAL_1_4;
241 const auto consumer = nullptr;
242 const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption);
243
244 spvtools::ValidatorOptions validator_options;
245 TransformationContext transformation_context(
246 MakeUnique<FactManager>(context.get()), validator_options);
247 auto transformation_bad_1 =
248 TransformationReplaceAddSubMulWithCarryingExtended(50, 15);
249 ASSERT_FALSE(
250 transformation_bad_1.IsApplicable(context.get(), transformation_context));
251
252 auto transformation_bad_2 =
253 TransformationReplaceAddSubMulWithCarryingExtended(50, 18);
254 ASSERT_FALSE(
255 transformation_bad_2.IsApplicable(context.get(), transformation_context));
256
257 // Bad: The transformation cannot be applied to the instruction OpIAdd of two
258 // vectors that have signed components.
259 auto transformation_bad_3 =
260 TransformationReplaceAddSubMulWithCarryingExtended(50, 21);
261 ASSERT_FALSE(
262 transformation_bad_3.IsApplicable(context.get(), transformation_context));
263
264 // Bad: The transformation cannot be applied to the instruction OpISub of two
265 // signed integers
266 auto transformation_bad_4 =
267 TransformationReplaceAddSubMulWithCarryingExtended(50, 31);
268 ASSERT_FALSE(
269 transformation_bad_4.IsApplicable(context.get(), transformation_context));
270 }
271
272 TEST(TransformationReplaceAddSubMulWithCarryingExtendedTest,
273 ApplicableScenarios) {
274 // In this test all of the transformations can be applied. The required struct
275 // types are provided.
276 std::string shader = R"(
277 OpCapability Shader
278 %1 = OpExtInstImport "GLSL.std.450"
279 OpMemoryModel Logical GLSL450
280 OpEntryPoint Fragment %4 "main"
281 OpExecutionMode %4 OriginUpperLeft
282 OpSource ESSL 310
283 OpName %4 "main"
284 OpName %8 "u1"
285 OpName %10 "u2"
286 OpName %12 "u3"
287 OpName %24 "i1"
288 OpName %26 "i2"
289 OpName %28 "i3"
290 OpName %34 "uv1"
291 OpName %36 "uv2"
292 OpName %39 "uv3"
293 OpName %51 "v1"
294 OpName %53 "v2"
295 OpName %56 "v3"
296 OpName %60 "pair_uint"
297 OpMemberName %60 0 "u_1"
298 OpMemberName %60 1 "u_2"
299 OpName %62 "p_uint"
300 OpName %63 "pair_uvec2"
301 OpMemberName %63 0 "uv_1"
302 OpMemberName %63 1 "uv_2"
303 OpName %65 "p_uvec2"
304 OpName %66 "pair_ivec2"
305 OpMemberName %66 0 "v_1"
306 OpMemberName %66 1 "v_2"
307 OpName %68 "p_ivec2"
308 OpName %69 "pair_int"
309 OpMemberName %69 0 "i_1"
310 OpMemberName %69 1 "i_2"
311 OpName %71 "p_int"
312 %2 = OpTypeVoid
313 %3 = OpTypeFunction %2
314 %6 = OpTypeInt 32 0
315 %7 = OpTypePointer Function %6
316 %9 = OpConstant %6 1
317 %11 = OpConstant %6 2
318 %22 = OpTypeInt 32 1
319 %23 = OpTypePointer Function %22
320 %25 = OpConstant %22 1
321 %27 = OpConstant %22 2
322 %32 = OpTypeVector %6 2
323 %33 = OpTypePointer Function %32
324 %35 = OpConstantComposite %32 %9 %11
325 %37 = OpConstant %6 3
326 %38 = OpConstantComposite %32 %11 %37
327 %49 = OpTypeVector %22 2
328 %50 = OpTypePointer Function %49
329 %52 = OpConstantComposite %49 %25 %27
330 %54 = OpConstant %22 3
331 %55 = OpConstantComposite %49 %27 %54
332 %60 = OpTypeStruct %6 %6
333 %61 = OpTypePointer Private %60
334 %62 = OpVariable %61 Private
335 %63 = OpTypeStruct %32 %32
336 %64 = OpTypePointer Private %63
337 %65 = OpVariable %64 Private
338 %66 = OpTypeStruct %49 %49
339 %67 = OpTypePointer Private %66
340 %68 = OpVariable %67 Private
341 %69 = OpTypeStruct %22 %22
342 %70 = OpTypePointer Private %69
343 %71 = OpVariable %70 Private
344 %4 = OpFunction %2 None %3
345 %5 = OpLabel
346 %8 = OpVariable %7 Function
347 %10 = OpVariable %7 Function
348 %12 = OpVariable %7 Function
349 %24 = OpVariable %23 Function
350 %26 = OpVariable %23 Function
351 %28 = OpVariable %23 Function
352 %34 = OpVariable %33 Function
353 %36 = OpVariable %33 Function
354 %39 = OpVariable %33 Function
355 %51 = OpVariable %50 Function
356 %53 = OpVariable %50 Function
357 %56 = OpVariable %50 Function
358 OpStore %8 %9
359 OpStore %10 %11
360 %13 = OpLoad %6 %8
361 %14 = OpLoad %6 %10
362 %15 = OpIAdd %6 %13 %14
363 OpStore %12 %15
364 %16 = OpLoad %6 %8
365 %17 = OpLoad %6 %10
366 %18 = OpISub %6 %16 %17
367 OpStore %12 %18
368 %19 = OpLoad %6 %8
369 %20 = OpLoad %6 %10
370 %21 = OpIMul %6 %19 %20
371 OpStore %12 %21
372 OpStore %24 %25
373 OpStore %26 %27
374 %29 = OpLoad %22 %24
375 %30 = OpLoad %22 %26
376 %31 = OpIMul %22 %29 %30
377 OpStore %28 %31
378 OpStore %34 %35
379 OpStore %36 %38
380 %40 = OpLoad %32 %34
381 %41 = OpLoad %32 %36
382 %42 = OpIAdd %32 %40 %41
383 OpStore %39 %42
384 %43 = OpLoad %32 %34
385 %44 = OpLoad %32 %36
386 %45 = OpISub %32 %43 %44
387 OpStore %39 %45
388 %46 = OpLoad %32 %34
389 %47 = OpLoad %32 %36
390 %48 = OpIMul %32 %46 %47
391 OpStore %39 %48
392 OpStore %51 %52
393 OpStore %53 %55
394 %57 = OpLoad %49 %51
395 %58 = OpLoad %49 %53
396 %59 = OpIMul %49 %57 %58
397 OpStore %56 %59
398 OpReturn
399 OpFunctionEnd
400 )";
401 const auto env = SPV_ENV_UNIVERSAL_1_4;
402 const auto consumer = nullptr;
403 const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption);
404
405 spvtools::ValidatorOptions validator_options;
406 TransformationContext transformation_context(
407 MakeUnique<FactManager>(context.get()), validator_options);
408 auto transformation_good_1 =
409 TransformationReplaceAddSubMulWithCarryingExtended(80, 15);
410 ASSERT_TRUE(transformation_good_1.IsApplicable(context.get(),
411 transformation_context));
412 ApplyAndCheckFreshIds(transformation_good_1, context.get(),
413 &transformation_context);
414 ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
415 kConsoleMessageConsumer));
416
417 auto transformation_good_2 =
418 TransformationReplaceAddSubMulWithCarryingExtended(81, 18);
419 ASSERT_TRUE(transformation_good_2.IsApplicable(context.get(),
420 transformation_context));
421 ApplyAndCheckFreshIds(transformation_good_2, context.get(),
422 &transformation_context);
423 ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
424 kConsoleMessageConsumer));
425
426 auto transformation_good_3 =
427 TransformationReplaceAddSubMulWithCarryingExtended(82, 21);
428 ASSERT_TRUE(transformation_good_3.IsApplicable(context.get(),
429 transformation_context));
430 ApplyAndCheckFreshIds(transformation_good_3, context.get(),
431 &transformation_context);
432 ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
433 kConsoleMessageConsumer));
434
435 auto transformation_good_4 =
436 TransformationReplaceAddSubMulWithCarryingExtended(83, 31);
437 ASSERT_TRUE(transformation_good_4.IsApplicable(context.get(),
438 transformation_context));
439 ApplyAndCheckFreshIds(transformation_good_4, context.get(),
440 &transformation_context);
441 ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
442 kConsoleMessageConsumer));
443
444 auto transformation_good_5 =
445 TransformationReplaceAddSubMulWithCarryingExtended(84, 42);
446 ASSERT_TRUE(transformation_good_5.IsApplicable(context.get(),
447 transformation_context));
448 ApplyAndCheckFreshIds(transformation_good_5, context.get(),
449 &transformation_context);
450 ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
451 kConsoleMessageConsumer));
452
453 auto transformation_good_6 =
454 TransformationReplaceAddSubMulWithCarryingExtended(85, 45);
455 ASSERT_TRUE(transformation_good_6.IsApplicable(context.get(),
456 transformation_context));
457 ApplyAndCheckFreshIds(transformation_good_6, context.get(),
458 &transformation_context);
459 ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
460 kConsoleMessageConsumer));
461
462 auto transformation_good_7 =
463 TransformationReplaceAddSubMulWithCarryingExtended(86, 48);
464 ASSERT_TRUE(transformation_good_7.IsApplicable(context.get(),
465 transformation_context));
466 ApplyAndCheckFreshIds(transformation_good_7, context.get(),
467 &transformation_context);
468 ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
469 kConsoleMessageConsumer));
470
471 auto transformation_good_8 =
472 TransformationReplaceAddSubMulWithCarryingExtended(87, 59);
473 ASSERT_TRUE(transformation_good_8.IsApplicable(context.get(),
474 transformation_context));
475 ApplyAndCheckFreshIds(transformation_good_8, context.get(),
476 &transformation_context);
477 ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
478 kConsoleMessageConsumer));
479
480 std::string after_transformation = R"(
481 OpCapability Shader
482 %1 = OpExtInstImport "GLSL.std.450"
483 OpMemoryModel Logical GLSL450
484 OpEntryPoint Fragment %4 "main"
485 OpExecutionMode %4 OriginUpperLeft
486 OpSource ESSL 310
487 OpName %4 "main"
488 OpName %8 "u1"
489 OpName %10 "u2"
490 OpName %12 "u3"
491 OpName %24 "i1"
492 OpName %26 "i2"
493 OpName %28 "i3"
494 OpName %34 "uv1"
495 OpName %36 "uv2"
496 OpName %39 "uv3"
497 OpName %51 "v1"
498 OpName %53 "v2"
499 OpName %56 "v3"
500 OpName %60 "pair_uint"
501 OpMemberName %60 0 "u_1"
502 OpMemberName %60 1 "u_2"
503 OpName %62 "p_uint"
504 OpName %63 "pair_uvec2"
505 OpMemberName %63 0 "uv_1"
506 OpMemberName %63 1 "uv_2"
507 OpName %65 "p_uvec2"
508 OpName %66 "pair_ivec2"
509 OpMemberName %66 0 "v_1"
510 OpMemberName %66 1 "v_2"
511 OpName %68 "p_ivec2"
512 OpName %69 "pair_int"
513 OpMemberName %69 0 "i_1"
514 OpMemberName %69 1 "i_2"
515 OpName %71 "p_int"
516 %2 = OpTypeVoid
517 %3 = OpTypeFunction %2
518 %6 = OpTypeInt 32 0
519 %7 = OpTypePointer Function %6
520 %9 = OpConstant %6 1
521 %11 = OpConstant %6 2
522 %22 = OpTypeInt 32 1
523 %23 = OpTypePointer Function %22
524 %25 = OpConstant %22 1
525 %27 = OpConstant %22 2
526 %32 = OpTypeVector %6 2
527 %33 = OpTypePointer Function %32
528 %35 = OpConstantComposite %32 %9 %11
529 %37 = OpConstant %6 3
530 %38 = OpConstantComposite %32 %11 %37
531 %49 = OpTypeVector %22 2
532 %50 = OpTypePointer Function %49
533 %52 = OpConstantComposite %49 %25 %27
534 %54 = OpConstant %22 3
535 %55 = OpConstantComposite %49 %27 %54
536 %60 = OpTypeStruct %6 %6
537 %61 = OpTypePointer Private %60
538 %62 = OpVariable %61 Private
539 %63 = OpTypeStruct %32 %32
540 %64 = OpTypePointer Private %63
541 %65 = OpVariable %64 Private
542 %66 = OpTypeStruct %49 %49
543 %67 = OpTypePointer Private %66
544 %68 = OpVariable %67 Private
545 %69 = OpTypeStruct %22 %22
546 %70 = OpTypePointer Private %69
547 %71 = OpVariable %70 Private
548 %4 = OpFunction %2 None %3
549 %5 = OpLabel
550 %8 = OpVariable %7 Function
551 %10 = OpVariable %7 Function
552 %12 = OpVariable %7 Function
553 %24 = OpVariable %23 Function
554 %26 = OpVariable %23 Function
555 %28 = OpVariable %23 Function
556 %34 = OpVariable %33 Function
557 %36 = OpVariable %33 Function
558 %39 = OpVariable %33 Function
559 %51 = OpVariable %50 Function
560 %53 = OpVariable %50 Function
561 %56 = OpVariable %50 Function
562 OpStore %8 %9
563 OpStore %10 %11
564 %13 = OpLoad %6 %8
565 %14 = OpLoad %6 %10
566 %80 = OpIAddCarry %60 %13 %14
567 %15 = OpCompositeExtract %6 %80 0
568 OpStore %12 %15
569 %16 = OpLoad %6 %8
570 %17 = OpLoad %6 %10
571 %81 = OpISubBorrow %60 %16 %17
572 %18 = OpCompositeExtract %6 %81 0
573 OpStore %12 %18
574 %19 = OpLoad %6 %8
575 %20 = OpLoad %6 %10
576 %82 = OpUMulExtended %60 %19 %20
577 %21 = OpCompositeExtract %6 %82 0
578 OpStore %12 %21
579 OpStore %24 %25
580 OpStore %26 %27
581 %29 = OpLoad %22 %24
582 %30 = OpLoad %22 %26
583 %83 = OpSMulExtended %69 %29 %30
584 %31 = OpCompositeExtract %22 %83 0
585 OpStore %28 %31
586 OpStore %34 %35
587 OpStore %36 %38
588 %40 = OpLoad %32 %34
589 %41 = OpLoad %32 %36
590 %84 = OpIAddCarry %63 %40 %41
591 %42 = OpCompositeExtract %32 %84 0
592 OpStore %39 %42
593 %43 = OpLoad %32 %34
594 %44 = OpLoad %32 %36
595 %85 = OpISubBorrow %63 %43 %44
596 %45 = OpCompositeExtract %32 %85 0
597 OpStore %39 %45
598 %46 = OpLoad %32 %34
599 %47 = OpLoad %32 %36
600 %86 = OpUMulExtended %63 %46 %47
601 %48 = OpCompositeExtract %32 %86 0
602 OpStore %39 %48
603 OpStore %51 %52
604 OpStore %53 %55
605 %57 = OpLoad %49 %51
606 %58 = OpLoad %49 %53
607 %87 = OpSMulExtended %66 %57 %58
608 %59 = OpCompositeExtract %49 %87 0
609 OpStore %56 %59
610 OpReturn
611 OpFunctionEnd
612 )";
613 ASSERT_TRUE(IsEqual(env, after_transformation, context.get()));
614 }
615
616 } // namespace
617 } // namespace fuzz
618 } // namespace spvtools