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

Zero masked arithmetic operations #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mazimkhan
Copy link
Member

@mazimkhan mazimkhan commented Nov 18, 2024

Introduces:

  • MaskedMaxOrZero(m, a, b): returns Max(a, b)[i] or zero if m[i] is false
  • MaskedAddOrZero(m, a, b): returns a[i] + b[i] or 0 if m[i] is false.
  • MaskedSubOrZero(m, a, b): returns a[i] - b[i] or 0 if m[i] is false.
  • MaskedMulOrZero( m, a, b): returns a[i] * b[i] or 0 if m[i] is false.
  • MaskedDivideOrZero(m, a, b): returns a[i] / b[i] or 0 if m[i] is false.
  • MaskedSaturatedAddOrZero(m, a, b): returns a[i] + b[i] saturated to the minimum/maximum representable value, or 0 if m[i]` is false.
  • MaskedSaturatedSubOrZero(m, a, b): returns a[i] - b[i] saturated to the minimum/maximum representable value, or 0 if m[i]` is false.
  • MaskedMulFixedPoint15OrZero(m, a): returns returns the result of multiplying two Q1.15 fixed-point numbers, or 0 if m[i] is false.
  • MaskedMulAddOrZero(m, a, b, c): returns a[i] * b[i] + c[i] or 0 if m[i] is false.
  • MaskedNegMulAddOrZero(m, a, b, c): returns -a[i] * b[i] + c[i] or 0 if m[i] is false.
  • MaskedWidenMulPairwiseAddOrZero(d, m, a, b): widens a and b to TFromD<D> and computes a[2*i+1]*b[2*i+1] + a[2*i+0]*b[2*i+0], or 0 if m[i] is false.

Testing is included for all operations where both the masking and the underlying operation is tested.

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 this pull request may close these issues.

1 participant