riscv / riscv-v-spec

Working draft of the proposed RISC-V V vector extension
https://jira.riscv.org/browse/RVG-122
Creative Commons Attribution 4.0 International
958 stars 272 forks source link

Best way to load/store a mask register? #315

Closed kito-cheng closed 4 years ago

kito-cheng commented 4 years ago

Does here any better way to load / store a mask register without changing vl and vtype?

li t0, -1
vsetvli x0, t0, e32 # Set VL to VLMAX
vle.v  v0, (t1) # Load masking to v0

Compiler need that operation to spill a mask register.

aswaterman commented 4 years ago

I think that’s it. Or, in prologue/epilogue code, you spill/fill it as part of a larger block of registers (e.g. spill all of v0-v7).

On many machines, the extra vsetvli won’t matter too much, and spilling mask registers shouldn’t be super common, so I think this is OK.

On Mon, Nov 4, 2019 at 12:57 AM Kito Cheng notifications@github.com wrote:

Does here any better way to load / store a mask register without changing vl and vtype?

li t0, -1 vsetvli x0, t0, e32 # Set VL to VLMAX vle.v v0, (t1) # Load masking to v0

Compiler need that operation to spill a mask register.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/riscv/riscv-v-spec/issues/315?email_source=notifications&email_token=AAH3XQQ67X7PCW7WUYDO2VTQR7PXDA5CNFSM4JIQSJU2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HWRDUWA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH3XQSI4URAJNWXTHGOCOLQR7PXDANCNFSM4JIQSJUQ .