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

25 lines
599 B
Plaintext

9 registers, 22 instructions:
0 r0 = uniform32 ptr0 0
1 r1 = uniform32 ptr0 C
2 r0 = trunc r0
3 r2 = splat 1 (1.4012985e-45)
4 r3 = splat 2 (2.8025969e-45)
5 r4 = splat 3 (4.2038954e-45)
loop:
6 r5 = index
7 r5 = trunc r5
8 r5 = mul_i32 r1 r5
9 r5 = add_i32 r0 r5
10 r5 = shl_i32 r5 2
11 r6 = gather32 ptr0 4 r5
12 r7 = add_i32 r5 r2
13 r7 = gather32 ptr0 4 r7
14 r8 = add_i32 r5 r3
15 r8 = gather32 ptr0 4 r8
16 r5 = add_i32 r5 r4
17 r5 = gather32 ptr0 4 r5
18 store32 ptr1 r6
19 store32 ptr2 r7
20 store32 ptr3 r8
21 store32 ptr4 r5