mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
pan/bi: Constant fold swizzles on constants
This lets us avoid generating SWZ instructions. Those instructions could be constant folded but that complicates the replication analysis introduced in the next commit. Almost no shader-db changes. quadwords HURT: shaders/glmark/1-22.shader_test MESA_SHADER_FRAGMENT: 718 -> 722 (0.56%) total quadwords in shared programs: 68169 -> 68173 (<.01%) quadwords in affected programs: 718 -> 722 (0.56%) helped: 0 HURT: 1 Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14576>
This commit is contained in:
parent
62533a6e64
commit
35ff537814
1 changed files with 15 additions and 1 deletions
|
|
@ -108,7 +108,21 @@ bi_lower_swizzle_16(bi_context *ctx, bi_instr *ins, unsigned src)
|
|||
return;
|
||||
}
|
||||
|
||||
/* If the instruction is scalar we can ignore the other component */
|
||||
/* First, try to apply a given swizzle to a constant to clear the
|
||||
* runtime swizzle. This is less heavy-handed than ignoring the
|
||||
* swizzle for scalar destinations, since it maintains
|
||||
* replication of the destination.
|
||||
*/
|
||||
if (ins->src[src].type == BI_INDEX_CONSTANT) {
|
||||
ins->src[src].value = bi_apply_swizzle(ins->src[src].value,
|
||||
ins->src[src].swizzle);
|
||||
ins->src[src].swizzle = BI_SWIZZLE_H01;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Even if the source does not replicate, if the consuming instruction
|
||||
* produces a 16-bit scalar, we can ignore the other component.
|
||||
*/
|
||||
if (ins->dest[0].swizzle == BI_SWIZZLE_H00 &&
|
||||
ins->src[src].swizzle == BI_SWIZZLE_H00)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue