skia2/tests/sksl/runtime/VectorIndexing.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

22 lines
483 B
Plaintext

9 registers, 19 instructions:
0 r0 = uniform32 ptr0 4
1 r1 = uniform32 ptr0 14
2 r2 = uniform32 ptr0 18
3 r3 = uniform32 ptr0 1C
4 r4 = uniform32 ptr0 20
5 r5 = uniform32 ptr0 24
6 r6 = uniform32 ptr0 2C
7 r7 = uniform32 ptr0 30
8 r8 = uniform32 ptr0 40
9 r2 = add_f32 r1 r2
10 r2 = add_f32 r3 r2
11 r2 = add_f32 r4 r2
12 r5 = mul_f32 r5 r5
13 r5 = mul_f32 r6 r5
14 r5 = mul_f32 r7 r5
loop:
15 store32 ptr1 r0
16 store32 ptr2 r2
17 store32 ptr3 r5
18 store32 ptr4 r8