basic rvvector example

This commit is contained in:
fares
2019-11-21 11:22:20 -05:00
parent 17465603ea
commit 7a9a1efc46
10 changed files with 86692 additions and 4386 deletions

View File

@@ -7,7 +7,7 @@
extern "C" {
#endif
void vx_vec_test();
void vx_vec_test(int *);
#ifdef __cplusplus

View File

@@ -4,21 +4,27 @@
.type vx_vec_test, @function
.global vx_vec_test
vx_vec_test:
slli a0, a0, 2
add a0, a0, a3
vmv.v.x vv0, a2
# vsplat4 vv0, a2
stripmine_loop:
vlb4 vv1, (a1)
vcmpez4 vp0, vv1
!vp0 vlw4 vv1, (a3)
!vp0 vlw4 vv2, (a4)
!vp0 vfma4 vv1, vv0, vv1, vv2
!vp0 vsw4 vv1, (a4)
addi a1, a1, 4
addi a3, a3, 16
addi a4, a4, 16
bleu a3, a0, stripmine_loop
li a1, 7
sw a1, 0(a0)
ret
# slli a0, a0, 2
# add a0, a0, a3
# vmv.v.x vv0, a2
# # vsplat4 vv0, a2
# stripmine_loop:
# vlb4 vv1, (a1)
# vcmpez4 vp0, vv1
# !vp0 vlw4 vv1, (a3)
# !vp0 vlw4 vv2, (a4)
# !vp0 vfma4 vv1, vv0, vv1, vv2
# !vp0 vsw4 vv1, (a4)
# addi a1, a1, 4
# addi a3, a3, 16
# addi a4, a4, 16
# bleu a3, a0, stripmine_loop
# handle edge cases
# when (n % 4) != 0 ...
ret

View File

@@ -5,6 +5,28 @@
int main()
{
vx_tmc(1);
vx_vec_test();
// int * a = malloc(4);
// int * b = malloc(4);
// int * c = malloc(4);
int * a = malloc(4);
*a = 5;
printf("Value of a: %d\n", *a);
vx_vec_test(a);
printf("Value of a: %d\n", *a);
// for (int i = 0; i < 4; i++)
// {
// if (c[i] != (a[i] + b[i]))
// {
// printf("Fail\n");
// break;
// }
// }
vx_tmc(0);
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff