ff4decc35e
This is just like mul(F32,F32) but optimizes 0*x == 0. Use it in SkSLVMGenerator; sksl already applies this optimization. PS2 has a sneaky version using % as a fast_mul() operator, and PS3 has a sneakier version using ** instead. We could of course write this all out using fast_mul() the long way, but I found that quickly became difficult to read. Change-Id: Iae35ce54411abc00e7729e178eb6a10f151a5304 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368838 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
25 lines
595 B
Plaintext
25 lines
595 B
Plaintext
8 registers, 22 instructions:
|
|
0 r0 = uniform32 ptr0 0
|
|
1 r1 = uniform32 ptr0 C
|
|
2 r0 = trunc r0
|
|
3 r1 = mul_i32 r0 r1
|
|
4 r0 = splat 1 (1.4012985e-45)
|
|
5 r2 = splat 2 (2.8025969e-45)
|
|
6 r3 = splat 3 (4.2038954e-45)
|
|
loop:
|
|
7 r4 = index
|
|
8 r4 = trunc r4
|
|
9 r4 = add_i32 r4 r1
|
|
10 r4 = shl_i32 r4 2
|
|
11 r5 = gather32 ptr0 4 r4
|
|
12 r6 = add_i32 r4 r0
|
|
13 r6 = gather32 ptr0 4 r6
|
|
14 r7 = add_i32 r4 r2
|
|
15 r7 = gather32 ptr0 4 r7
|
|
16 r4 = add_i32 r4 r3
|
|
17 r4 = gather32 ptr0 4 r4
|
|
18 store32 ptr1 r5
|
|
19 store32 ptr2 r6
|
|
20 store32 ptr3 r7
|
|
21 store32 ptr4 r4
|