Skip to content

vc4: Emit a single compare for NIR comparison functions #86

Open
@anholt

Description

@anholt

This common NIR sequence:

        vec1 32 ssa_3 = fge ssa_1, ssa_2
        vec1 32 ssa_4 = b2f ssa_3

generates:

# fge
fsub.sf null, t0, u2 (0x41f00000 / 30.000000)
mov t13, 0
mov.ns t13, -1
# b2f
and t15, t13, 1.000000

This is silly -- we could have just done:

fsub.sf null, t0, u2 (0x41f00000 / 30.000000)
mov t15, 0
mov.ns t15, 1.0000000

We have some logic for doing this kind of trick in ntq_emit_comparison() that could extend to b2f, but if statements, discard_ifintrinsics, and probably others could use similar treatment.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions