Skip to content

Add vblend vector operation #7729

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

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

Conversation

gita-omr
Copy link
Contributor

@gita-omr gita-omr commented Apr 15, 2025

  • similar to vbitselect but works on lanes and under control of the mask (third child)
  • if lane is not set in the mask the value from the first vector is chosen
  • the lane from the second vector is chosen otherwise

@gita-omr
Copy link
Contributor Author

@gita-omr
Copy link
Contributor Author

Jenkins build all

@gita-omr
Copy link
Contributor Author

Fixed build errors.

@gita-omr
Copy link
Contributor Author

Jenkins build all

@gita-omr
Copy link
Contributor Author

RISC build failed due to unrelated reasons (machine is offline).

@0xdaryl
Copy link
Contributor

0xdaryl commented Apr 16, 2025

What is the type and semantics of the "mask" child? i.e., how does it describe how the the first and second children are blended?

@gita-omr
Copy link
Contributor Author

All three arguments have the same number of elements. Mask element is a boolean value. If it's true, corresponding element of the first vector is chosen. If it's false, element from the second argument is chosen.

@gita-omr gita-omr changed the title Add vblend vector operation WIP: Add vblend vector operation Apr 17, 2025
@gita-omr
Copy link
Contributor Author

Actually, it's a good question. Let me think what the exact semantic should be.

@hzongaro
Copy link
Contributor

vblend is similar to vselect

What is vselect? Or did you mean select?

All three arguments have the same number of elements. Mask element is a boolean value. If it's true, corresponding element of the first vector is chosen. If it's false, element from the second argument is chosen.

If this is meant to be analogous to select, should the first argument be the mask, rather than the third?

- similar to vbitselect but works on lanes and under control of the mask (third child)
- if lane is not set in the mask the value from the first vector is chosen
- the lane from the second vector is chosen otherwise
@gita-omr gita-omr changed the title WIP: Add vblend vector operation Add vblend vector operation Apr 17, 2025
@gita-omr
Copy link
Contributor Author

Updated with expected semantics.

@BradleyWood

@gita-omr
Copy link
Contributor Author

gita-omr commented Apr 17, 2025

If this is meant to be analogous to select, should the first argument be the mask, rather than the third?

We have vbitselect vector operation. It selects bits from the second vector if corresponding bit in the third vector is set. Otherwise, the bit from the first vector is selected.

@hzongaro
Copy link
Contributor

We have vbitselect vector operation. It selects bits from the second vector if corresponding bit in the third vector is set. Otherwise, the bit from the first vector is selected.

I see. It's unfortunate that the order of the operands differs from those of iselect, et al.

@BradleyWood
Copy link
Contributor

Thanks for doing this @gita-omr. Did you find out the reason that the vbitselect opcode had a strange extra operand?

@gita-omr
Copy link
Contributor Author

We have vbitselect vector operation. It selects bits from the second vector if corresponding bit in the third vector is set. Otherwise, the bit from the first vector is selected.

I see. It's unfortunate that the order of the operands differs from those of iselect, et al.

This is a common meaning for vector blend operations and that's how corresponding instructions work at least on Intel ans Power. Essentially, we blend second vector into the first one based on the third vector or mask.

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.

4 participants