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

Reduce cost of branching #1241

Open
Schaeff opened this issue Oct 25, 2022 · 0 comments
Open

Reduce cost of branching #1241

Schaeff opened this issue Oct 25, 2022 · 0 comments

Comments

@Schaeff
Copy link
Member

Schaeff commented Oct 25, 2022

Abstract

Reduce the cost of c ? l : r

Motivation

Constraint count for branching is not optimal

Specification

Change code generation for c ? l : r from

ll == c * l
rr == (1 - c) * r
res == ll + rr

to

# res := c ? l : r
res - r = c * (l - r)

Backwards Compatibility

This is backwards compatible, though we need to check that there are no regressions in any of the optimiser steps

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

Successfully merging a pull request may close this issue.

1 participant