6b43c30cd7
At some point adding more and more complex instructions reduces to the absurdity of SolveTheWholeProblem-The-Instruction, but I think this one will come up often enough to still make sense. mad() makes sense for unorm8 just about everywhere mad() makes sense for f32. This instruction won't matter to a JIT, but helps the interpreter. Change-Id: Iace92296cffbb6fbc3acd1f853cb01c51792f796 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218716 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
324 lines
6.2 KiB
Plaintext
324 lines
6.2 KiB
Plaintext
A8 over A8
|
|
7 registers, 15 instructions:
|
|
r0 = splat 3B808081 (0.0039215689)
|
|
r1 = splat 3F800000 (1)
|
|
r2 = splat 437F0000 (255)
|
|
r3 = splat 3F000000 (0.5)
|
|
loop:
|
|
r4 = load8 arg(0)
|
|
r4 = to_f32 r4
|
|
r4 = mul_f32 r0 r4
|
|
r5 = load8 arg(1)
|
|
r5 = to_f32 r5
|
|
r5 = mul_f32 r0 r5
|
|
r6 = sub_f32 r1 r4
|
|
r6 = mad_f32 r5 r6 r4
|
|
r6 = mad_f32 r6 r2 r3
|
|
r6 = to_i32 r6
|
|
store8 arg(1) r6
|
|
|
|
A8 over G8
|
|
9 registers, 21 instructions:
|
|
r0 = splat 3B808081 (0.0039215689)
|
|
r1 = splat 3F800000 (1)
|
|
r2 = splat 3E59B3D0 (0.21259999)
|
|
r3 = splat 3F371759 (0.71520001)
|
|
r4 = splat 3D93DD98 (0.0722)
|
|
r5 = splat 437F0000 (255)
|
|
r6 = splat 3F000000 (0.5)
|
|
loop:
|
|
r7 = load8 arg(0)
|
|
r7 = to_f32 r7
|
|
r7 = mul_f32 r0 r7
|
|
r8 = load8 arg(1)
|
|
r8 = to_f32 r8
|
|
r8 = mul_f32 r0 r8
|
|
r7 = sub_f32 r1 r7
|
|
r7 = mul_f32 r8 r7
|
|
r8 = mul_f32 r7 r4
|
|
r8 = mad_f32 r7 r3 r8
|
|
r8 = mad_f32 r7 r2 r8
|
|
r8 = mad_f32 r8 r5 r6
|
|
r8 = to_i32 r8
|
|
store8 arg(1) r8
|
|
|
|
A8 over RGBA_8888
|
|
10 registers, 37 instructions:
|
|
r0 = splat 3B808081 (0.0039215689)
|
|
r1 = splat 3F800000 (1)
|
|
r2 = splat 437F0000 (255)
|
|
r3 = splat 3F000000 (0.5)
|
|
loop:
|
|
r4 = load8 arg(0)
|
|
r4 = to_f32 r4
|
|
r4 = mul_f32 r0 r4
|
|
r5 = load32 arg(1)
|
|
r6 = extract r5 FF
|
|
r6 = to_f32 r6
|
|
r6 = mul_f32 r0 r6
|
|
r7 = extract r5 FF00
|
|
r7 = to_f32 r7
|
|
r7 = mul_f32 r0 r7
|
|
r8 = extract r5 FF0000
|
|
r8 = to_f32 r8
|
|
r8 = mul_f32 r0 r8
|
|
r5 = shr r5 24
|
|
r5 = to_f32 r5
|
|
r5 = mul_f32 r0 r5
|
|
r9 = sub_f32 r1 r4
|
|
r6 = mul_f32 r6 r9
|
|
r7 = mul_f32 r7 r9
|
|
r8 = mul_f32 r8 r9
|
|
r9 = mad_f32 r5 r9 r4
|
|
r6 = mad_f32 r6 r2 r3
|
|
r6 = to_i32 r6
|
|
r7 = mad_f32 r7 r2 r3
|
|
r7 = to_i32 r7
|
|
r8 = mad_f32 r8 r2 r3
|
|
r8 = to_i32 r8
|
|
r9 = mad_f32 r9 r2 r3
|
|
r9 = to_i32 r9
|
|
r7 = pack r6 r7 8
|
|
r9 = pack r8 r9 8
|
|
r9 = pack r7 r9 16
|
|
store32 arg(1) r9
|
|
|
|
G8 over A8
|
|
6 registers, 12 instructions:
|
|
r0 = splat 3B808081 (0.0039215689)
|
|
r1 = splat 3F800000 (1)
|
|
r2 = sub_f32 r1 r1
|
|
r3 = splat 437F0000 (255)
|
|
r4 = splat 3F000000 (0.5)
|
|
loop:
|
|
r5 = load8 arg(1)
|
|
r5 = to_f32 r5
|
|
r5 = mul_f32 r0 r5
|
|
r5 = mad_f32 r5 r2 r1
|
|
r5 = mad_f32 r5 r3 r4
|
|
r5 = to_i32 r5
|
|
store8 arg(1) r5
|
|
|
|
G8 over G8
|
|
10 registers, 21 instructions:
|
|
r0 = splat 3B808081 (0.0039215689)
|
|
r1 = splat 3F800000 (1)
|
|
r2 = sub_f32 r1 r1
|
|
r3 = splat 3E59B3D0 (0.21259999)
|
|
r4 = splat 3F371759 (0.71520001)
|
|
r5 = splat 3D93DD98 (0.0722)
|
|
r6 = splat 437F0000 (255)
|
|
r7 = splat 3F000000 (0.5)
|
|
loop:
|
|
r8 = load8 arg(0)
|
|
r8 = to_f32 r8
|
|
r8 = mul_f32 r0 r8
|
|
r9 = load8 arg(1)
|
|
r9 = to_f32 r9
|
|
r9 = mul_f32 r0 r9
|
|
r9 = mad_f32 r9 r2 r8
|
|
r8 = mul_f32 r9 r5
|
|
r8 = mad_f32 r9 r4 r8
|
|
r8 = mad_f32 r9 r3 r8
|
|
r8 = mad_f32 r8 r6 r7
|
|
r8 = to_i32 r8
|
|
store8 arg(1) r8
|
|
|
|
G8 over RGBA_8888
|
|
10 registers, 37 instructions:
|
|
r0 = splat 3B808081 (0.0039215689)
|
|
r1 = splat 3F800000 (1)
|
|
r2 = sub_f32 r1 r1
|
|
r3 = splat 437F0000 (255)
|
|
r4 = splat 3F000000 (0.5)
|
|
loop:
|
|
r5 = load8 arg(0)
|
|
r5 = to_f32 r5
|
|
r5 = mul_f32 r0 r5
|
|
r6 = load32 arg(1)
|
|
r7 = extract r6 FF
|
|
r7 = to_f32 r7
|
|
r7 = mul_f32 r0 r7
|
|
r8 = extract r6 FF00
|
|
r8 = to_f32 r8
|
|
r8 = mul_f32 r0 r8
|
|
r9 = extract r6 FF0000
|
|
r9 = to_f32 r9
|
|
r9 = mul_f32 r0 r9
|
|
r6 = shr r6 24
|
|
r6 = to_f32 r6
|
|
r6 = mul_f32 r0 r6
|
|
r7 = mad_f32 r7 r2 r5
|
|
r8 = mad_f32 r8 r2 r5
|
|
r9 = mad_f32 r9 r2 r5
|
|
r6 = mad_f32 r6 r2 r1
|
|
r7 = mad_f32 r7 r3 r4
|
|
r7 = to_i32 r7
|
|
r8 = mad_f32 r8 r3 r4
|
|
r8 = to_i32 r8
|
|
r9 = mad_f32 r9 r3 r4
|
|
r9 = to_i32 r9
|
|
r6 = mad_f32 r6 r3 r4
|
|
r6 = to_i32 r6
|
|
r8 = pack r7 r8 8
|
|
r6 = pack r9 r6 8
|
|
r6 = pack r8 r6 16
|
|
store32 arg(1) r6
|
|
|
|
RGBA_8888 over A8
|
|
7 registers, 16 instructions:
|
|
r0 = splat 3B808081 (0.0039215689)
|
|
r1 = splat 3F800000 (1)
|
|
r2 = splat 437F0000 (255)
|
|
r3 = splat 3F000000 (0.5)
|
|
loop:
|
|
r4 = load32 arg(0)
|
|
r4 = shr r4 24
|
|
r4 = to_f32 r4
|
|
r4 = mul_f32 r0 r4
|
|
r5 = load8 arg(1)
|
|
r5 = to_f32 r5
|
|
r5 = mul_f32 r0 r5
|
|
r6 = sub_f32 r1 r4
|
|
r6 = mad_f32 r5 r6 r4
|
|
r6 = mad_f32 r6 r2 r3
|
|
r6 = to_i32 r6
|
|
store8 arg(1) r6
|
|
|
|
RGBA_8888 over G8
|
|
12 registers, 33 instructions:
|
|
r0 = splat 3B808081 (0.0039215689)
|
|
r1 = splat 3F800000 (1)
|
|
r2 = splat 3E59B3D0 (0.21259999)
|
|
r3 = splat 3F371759 (0.71520001)
|
|
r4 = splat 3D93DD98 (0.0722)
|
|
r5 = splat 437F0000 (255)
|
|
r6 = splat 3F000000 (0.5)
|
|
loop:
|
|
r7 = load32 arg(0)
|
|
r8 = extract r7 FF
|
|
r8 = to_f32 r8
|
|
r8 = mul_f32 r0 r8
|
|
r9 = extract r7 FF00
|
|
r9 = to_f32 r9
|
|
r9 = mul_f32 r0 r9
|
|
r10 = extract r7 FF0000
|
|
r10 = to_f32 r10
|
|
r10 = mul_f32 r0 r10
|
|
r7 = shr r7 24
|
|
r7 = to_f32 r7
|
|
r7 = mul_f32 r0 r7
|
|
r11 = load8 arg(1)
|
|
r11 = to_f32 r11
|
|
r11 = mul_f32 r0 r11
|
|
r7 = sub_f32 r1 r7
|
|
r8 = mad_f32 r11 r7 r8
|
|
r9 = mad_f32 r11 r7 r9
|
|
r7 = mad_f32 r11 r7 r10
|
|
r7 = mul_f32 r7 r4
|
|
r7 = mad_f32 r9 r3 r7
|
|
r7 = mad_f32 r8 r2 r7
|
|
r7 = mad_f32 r7 r5 r6
|
|
r7 = to_i32 r7
|
|
store8 arg(1) r7
|
|
|
|
RGBA_8888 over RGBA_8888
|
|
13 registers, 47 instructions:
|
|
r0 = splat 3B808081 (0.0039215689)
|
|
r1 = splat 3F800000 (1)
|
|
r2 = splat 437F0000 (255)
|
|
r3 = splat 3F000000 (0.5)
|
|
loop:
|
|
r4 = load32 arg(0)
|
|
r5 = extract r4 FF
|
|
r5 = to_f32 r5
|
|
r5 = mul_f32 r0 r5
|
|
r6 = extract r4 FF00
|
|
r6 = to_f32 r6
|
|
r6 = mul_f32 r0 r6
|
|
r7 = extract r4 FF0000
|
|
r7 = to_f32 r7
|
|
r7 = mul_f32 r0 r7
|
|
r4 = shr r4 24
|
|
r4 = to_f32 r4
|
|
r4 = mul_f32 r0 r4
|
|
r8 = load32 arg(1)
|
|
r9 = extract r8 FF
|
|
r9 = to_f32 r9
|
|
r9 = mul_f32 r0 r9
|
|
r10 = extract r8 FF00
|
|
r10 = to_f32 r10
|
|
r10 = mul_f32 r0 r10
|
|
r11 = extract r8 FF0000
|
|
r11 = to_f32 r11
|
|
r11 = mul_f32 r0 r11
|
|
r8 = shr r8 24
|
|
r8 = to_f32 r8
|
|
r8 = mul_f32 r0 r8
|
|
r12 = sub_f32 r1 r4
|
|
r9 = mad_f32 r9 r12 r5
|
|
r10 = mad_f32 r10 r12 r6
|
|
r11 = mad_f32 r11 r12 r7
|
|
r12 = mad_f32 r8 r12 r4
|
|
r9 = mad_f32 r9 r2 r3
|
|
r9 = to_i32 r9
|
|
r10 = mad_f32 r10 r2 r3
|
|
r10 = to_i32 r10
|
|
r11 = mad_f32 r11 r2 r3
|
|
r11 = to_i32 r11
|
|
r12 = mad_f32 r12 r2 r3
|
|
r12 = to_i32 r12
|
|
r10 = pack r9 r10 8
|
|
r12 = pack r11 r12 8
|
|
r12 = pack r10 r12 16
|
|
store32 arg(1) r12
|
|
|
|
I32 8888 over 8888
|
|
10 registers, 20 instructions:
|
|
r0 = splat FF (3.5733111e-43)
|
|
loop:
|
|
r1 = load32 arg(0)
|
|
r2 = extract r1 FF
|
|
r3 = extract r1 FF00
|
|
r4 = extract r1 FF0000
|
|
r1 = shr r1 24
|
|
r5 = load32 arg(1)
|
|
r6 = extract r5 FF
|
|
r7 = extract r5 FF00
|
|
r8 = extract r5 FF0000
|
|
r5 = shr r5 24
|
|
r9 = sub_i32 r0 r1
|
|
r6 = mad_unorm8 r6 r9 r2
|
|
r7 = mad_unorm8 r7 r9 r3
|
|
r8 = mad_unorm8 r8 r9 r4
|
|
r9 = mad_unorm8 r5 r9 r1
|
|
r7 = pack r6 r7 8
|
|
r9 = pack r8 r9 8
|
|
r9 = pack r7 r9 16
|
|
store32 arg(1) r9
|
|
|
|
I32 (SWAR) 8888 over 8888
|
|
7 registers, 20 instructions:
|
|
r0 = splat FF (3.5733111e-43)
|
|
r1 = splat FF00FF (2.3418409e-38)
|
|
loop:
|
|
r2 = load32 arg(0)
|
|
r3 = extract r2 FF00FF
|
|
r2 = extract r2 FF00FF00
|
|
r4 = load32 arg(1)
|
|
r5 = extract r4 FF00FF
|
|
r4 = extract r4 FF00FF00
|
|
r6 = shr r2 16
|
|
r6 = sub_i32 r0 r6
|
|
r5 = mul_i32 r5 r6
|
|
r5 = add_i32 r5 r1
|
|
r5 = extract r5 FF00FF00
|
|
r5 = add_i32 r3 r5
|
|
r6 = mul_i32 r4 r6
|
|
r6 = add_i32 r6 r1
|
|
r6 = extract r6 FF00FF00
|
|
r6 = add_i32 r2 r6
|
|
r6 = pack r5 r6 8
|
|
store32 arg(1) r6
|
|
|