In the use of RVV1.0 instruction function, I encountered a mask load mismatch problem
uint8_t mask_data[] = {15, 0, 0, 0, 0, 0, 0, 0};
vbool8_t mask = vlm_v_b8(mask_data, vl);
printf("mask:\n");
for(int i=0; i<vl; i++)
{
printf("%d ", mask_data[i]);
}
printf("\n");
// exam mask
uint8_t mask_e[8];
vsm_v_b8(mask_e, mask, vl);
printf("mask_e:\n");
for(int i=0; i<vl; i++)
{
printf("%d ", mask_e[i]);
}
printf("\n");
That is, in this code, when converting mask_data to mask, there is a mismatch problem during application. Here, the elements of mask_data 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, actually will not be written into mask like this.
So, how is it applied;
15 = 0000 1111
Convert 15 into binary, in actual calculation, mask is assigned to 1111 0000.
Then to conclude that the conversion rule is:
- Subscript mask_data array to 0 to represent mask, and set other positions to 0
- The first element is set to: Which bit participates in the calculation position is 0, and if it does not participate in the calculation, it will be set to 1. In this way, the resulting binary is converted into a decimal number.
- maskedoff can follow the original order.