Skip to content

Conversation

luismgsilva
Copy link
Member

The arcv_vmv RTL patterns were not generating vsetvli instructions because they lacked the proper RVV predication structure. This caused the vector configuration to not be set up before executing the arcv.vmv.v.s and arcv.vmv.s.v instructions.

This patch restructures the arcv_vmv patterns to follow the standard RVV predicated instruction format by:

  • Wrapping the instruction in an if_then_else with UNSPEC_VPREDICATE.
  • Adding VL_REGNUM and VTYPE_REGNUM registers to the predication.
  • Moving the actual instruction logic to an inner unspec.

This structure matches other ARCV vector instructions (like vnorm) and enables the vsetvl pass to properly insert vsetvli instructions before the arcv_vmv operations.

@luismgsilva luismgsilva self-assigned this Oct 10, 2025
@luismgsilva luismgsilva marked this pull request as draft October 10, 2025 12:40
@luismgsilva luismgsilva marked this pull request as ready for review October 10, 2025 12:46
Copy link
Contributor

@MichielDerhaeg MichielDerhaeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add tests, check that the mode is correct

@MichielDerhaeg
Copy link
Contributor

Add tests, check that the mode is correct

And the other tests?

@luismgsilva
Copy link
Member Author

Add tests, check that the mode is correct

And the other tests?

I've also updated the arcv-vdsp-vmvi_v_s-compile-1.c. Is there anything else I'm missing?

@MichielDerhaeg
Copy link
Contributor

Add tests, check that the mode is correct

And the other tests?

I've also updated the arcv-vdsp-vmvi_v_s-compile-1.c. Is there anything else I'm missing?

There is also vmv(i)_s_v

@luismgsilva
Copy link
Member Author

Add tests, check that the mode is correct

And the other tests?

I've also updated the arcv-vdsp-vmvi_v_s-compile-1.c. Is there anything else I'm missing?

There is also vmv(i)_s_v

Both tests have been updated. Also rebased on top of the new changes on arc-2025.09 branch

The arcv_vmv RTL patterns were not generating vsetvli instructions
because they lacked the proper RVV predication structure.  This caused
the vector configuration to not be set up before executing the
arcv.vmv.v.s and arcv.vmv.s.v instructions.

This patch restructures the arcv_vmv patterns to follow the standard
RVV predicated instruction format by:
- Wrapping the instruction in an if_then_else with UNSPEC_VPREDICATE.
- Adding VL_REGNUM and VTYPE_REGNUM registers to the predication.
- Moving the actual instruction logic to an inner unspec.

This structure matches other ARCV vector instructions (like vnorm)
and enables the vsetvl pass to properly insert vsetvli instructions
before the arcv_vmv operations.

Signed-off-by: Luis Silva <[email protected]>
@luismgsilva luismgsilva merged commit 533a77f into arc-2025.09 Oct 21, 2025
@luismgsilva luismgsilva deleted the luis/fix-vmv-vl branch October 21, 2025 12:36
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.

2 participants