Use packed contexts for ternary ops in SkRP.
This saves an alloc when multi-slot ternary ops are used. In
practice, we don't have many cases where this applies in ES2.
Only mix and smoothstep currently take this path, and I don't
think we have any tests which use a wide mix (although a ternary
that results in a matrix might generate one).
For some reason, I needed to restructure the inner loop of
`apply_adjacent_ternary` to get good codegen from Clang (on ARM64).
The do-while loop mysteriously generated larger code than before.
Out of curiosity, I attempted the same rewrite with
`apply_adjacent_binary` and it made the codegen worse. I don't
quite understand this.
Original codegen: https://godbolt.org/z/8Y7E9GKjn
Before restructuring: https://godbolt.org/z/ME4x9r5re
After restructuring: https://godbolt.org/z/9eGrP9GEd
Change-Id: I6391c95f2dedcbe523671b89386bca3cfc78d28c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/693059
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
5 files changed