skia2/tests/sksl/runtime/SwitchWithFallthrough.skvm
John Stiles 059d34594e Optimize SkVM bit-clears.
SkVM has a `bit_clear` opcode dedicated to the operation `x & ~y`, but
the optimizer was not smart enough to combine a bit-and with a bit-not
and replace it with a bit-clear. Now, it can.

Change-Id: Ida5345c3def0a4bf7afa08bb7f7835e1e2e37677
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524225
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
2022-03-24 21:04:23 +00:00

44 lines
1.0 KiB
Plaintext

14 registers, 41 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 = splat 1 (1.4012985e-45)
14 r12 = eq_i32 r10 r12
15 r13 = bit_clear r12 r11
16 r8 = eq_i32 r10 r8
17 r13 = bit_or r13 r8
18 r13 = bit_clear r13 r11
19 r8 = bit_and r8 r13
20 r12 = bit_and r12 r13
21 r12 = bit_clear r12 r8
22 r11 = bit_or r11 r12
23 r11 = bit_and r13 r11
24 r11 = bit_clear r11 r8
25 r12 = select r11 r9 r12
26 r9 = splat 3 (4.2038954e-45)
27 r9 = eq_i32 r10 r9
28 r9 = bit_or r12 r9
29 r9 = bit_and r13 r9
30 r8 = bit_clear r9 r8
31 r8 = bit_and r13 r8
32 r8 = bit_and r13 r8
33 r4 = select r8 r0 r4
34 r5 = select r8 r1 r5
35 r6 = select r8 r2 r6
36 r7 = select r8 r3 r7
loop:
37 store32 ptr1 r4
38 store32 ptr2 r5
39 store32 ptr3 r6
40 store32 ptr4 r7