Merge branch 'concept-check'

This commit is contained in:
2017-04-26 11:39:59 -04:00
4 changed files with 226 additions and 0 deletions

23
tests_ispcpp/hello.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include <stdlib.h>
#include <stdio.h>
#include "hello.ispc.h"
int main() {
float A[100];
float B[100];
double result[100];
for (int i=0; i<100; i++) {
A[i] = 100 - i;
B[i] = i*i;
}
ispc::saxpy(100, 3.1415926535, (float*)&A, (float*)&B, (double*)&result);
for (int i=0; i<100; i++) {
printf("%.6f\n", result[i]);
}
return 0;
}

11
tests_ispcpp/hello.ispc Normal file
View File

@@ -0,0 +1,11 @@
export void saxpy(uniform int N,
uniform floating<0> scale,
uniform floating<1> X[],
uniform floating<1> Y[],
uniform floating<2> result[])
{
foreach (i = 0 ... N) {
floating<2> tmp = scale * X[i] + Y[i];
result[i] = tmp;
}
}