aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadesh Ramanathan <nadeshramanathan88@gmail.com>2020-06-13 12:36:53 +0100
committerNadesh Ramanathan <nadeshramanathan88@gmail.com>2020-06-13 12:36:53 +0100
commit9ee43ea5cd1b637a27743a451f697001f07bf47a (patch)
tree270c1ae722cff9689ea8ed858feea68b0287231e
parent679425c10f48c89433fb4de06c1363b737baa9ae (diff)
downloadvericert-kvx-9ee43ea5cd1b637a27743a451f697001f07bf47a.tar.gz
vericert-kvx-9ee43ea5cd1b637a27743a451f697001f07bf47a.zip
test on indirect addressing
-rw-r--r--test/array-indirect.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/array-indirect.c b/test/array-indirect.c
new file mode 100644
index 0000000..0315da1
--- /dev/null
+++ b/test/array-indirect.c
@@ -0,0 +1,13 @@
+int main() {
+ int index[2] = {1, 0};
+ int x[2] = {5, 10};
+ int y[2] = {0, 0};
+ for(int i=0; i<2;i++){
+ y[i] = x[index[i]] * (i+1);
+ }
+
+ int sum = 0;
+ for(int j=0; j <2; j++)
+ sum += y[j];
+ return sum;
+}