skia2/tests/sksl/runtime/SwitchWithFallthrough.skvm
John Stiles c809e5ba9f Optimize commutative operations in SkVM.
We now canonicalize commutative operations by ordering their value IDs.
The lower-numbered value ID is always placed first into a commutative
instruction. In other words, this instruction:
   bit_and result, v7, v5

Would be silently converted to this:
   bit_and result, v5, v7

This will allow these two logically-equivalent instructions to be
deduplicated:
   bit_and result, v7, v5
   bit_and result, v5, v7

Of course, deduplicating these ops can unlock additional free CSE/DCE.
The affected instructions are listed in http://review.skia.org/473238

Change-Id: Ib9beb79d6b72d7903184aaa9a53e8e5a02ae126d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473239
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2021-11-18 21:27:17 +00:00

52 lines
1.2 KiB
Plaintext

16 registers, 49 instructions:
0 r0 = uniform32 ptr0 4
1 r1 = uniform32 ptr0 8
2 r2 = uniform32 ptr0 C
3 r3 = uniform32 ptr0 10
4 r4 = uniform32 ptr0 14
5 r5 = uniform32 ptr0 18
6 r6 = uniform32 ptr0 1C
7 r7 = uniform32 ptr0 20
8 r8 = splat 0 (0)
9 r9 = splat FFFFFFFF (nan)
10 r10 = trunc r1
11 r11 = splat 2 (2.8025969e-45)
12 r11 = eq_i32 r10 r11
13 r12 = bit_xor r9 r11
14 r13 = bit_and r11 r12
15 r14 = splat 1 (1.4012985e-45)
16 r14 = eq_i32 r10 r14
17 r15 = bit_or r13 r14
18 r15 = bit_and r12 r15
19 r13 = select r15 r9 r13
20 r8 = eq_i32 r8 r10
21 r13 = bit_or r13 r8
22 r13 = bit_and r12 r13
23 r8 = bit_and r8 r13
24 r12 = bit_xor r9 r8
25 r8 = bit_and r8 r12
26 r14 = bit_or r14 r8
27 r14 = bit_and r13 r14
28 r14 = bit_and r12 r14
29 r8 = select r14 r9 r8
30 r11 = bit_or r11 r8
31 r11 = bit_and r13 r11
32 r11 = bit_and r12 r11
33 r8 = select r11 r9 r8
34 r9 = splat 3 (4.2038954e-45)
35 r9 = eq_i32 r10 r9
36 r9 = bit_or r8 r9
37 r9 = bit_and r13 r9
38 r9 = bit_and r12 r9
39 r9 = bit_and r13 r9
40 r9 = bit_and r13 r9
41 r4 = select r9 r0 r4
42 r5 = select r9 r1 r5
43 r6 = select r9 r2 r6
44 r7 = select r9 r3 r7
loop:
45 store32 ptr1 r4
46 store32 ptr2 r5
47 store32 ptr3 r6
48 store32 ptr4 r7