Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anholt opened this issue Jan 16, 2018 · 0 comments
Open

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

anholt opened this issue Jan 16, 2018 · 0 comments

Comments

@anholt
Copy link
Owner

anholt commented Jan 16, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant