[llvm-dev] Is the RVV used correctly?
liao via llvm-dev
llvm-dev at lists.llvm.org
Mon Jun 14 20:25:43 PDT 2021
Is RVV used correctly in this way? If so, are there any suggestions for code implementation?
testcase:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<riscv_vector.h>
int main(){
int input1[5] = {0,1,2,4,6};
int input2[5] = {0,1,2,4,6};
vint32m1_t *a1 = (vint32m1_t *)input1;
vint32m1_t *a2 = (vint32m1_t *)input2;
vint32m1_t bb;
int vl = vsetvl_e32m1(10000);
bb = vadd_vv_i32m1( *a1, *a2, vl);
for (int i=0;i<5;i++)
printf("%d\n",bb[i]);
return 1;
}
error:
clang --target=riscv64-unknown-linux-gnu -march=rv64gcv0p10 -menable-experimental-extensions --sysroot=xxx --gcc-toolchain=xxx test.c
Error:
test.c:14:20: error: subscripted value is not an array, pointer, or vector
printf("%d\n",bb[i]);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210615/f3af4d5b/attachment.html>
More information about the llvm-dev
mailing list