summaryrefslogtreecommitdiffstats
path: root/Tests/ISPC/SystemIncludes
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/ISPC/SystemIncludes')
-rw-r--r--Tests/ISPC/SystemIncludes/CMakeLists.txt12
-rw-r--r--Tests/ISPC/SystemIncludes/main.cxx15
-rw-r--r--Tests/ISPC/SystemIncludes/simple.ispc9
3 files changed, 36 insertions, 0 deletions
diff --git a/Tests/ISPC/SystemIncludes/CMakeLists.txt b/Tests/ISPC/SystemIncludes/CMakeLists.txt
new file mode 100644
index 0000000..95959b2
--- /dev/null
+++ b/Tests/ISPC/SystemIncludes/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.18)
+project(ispc_spaces_in_path ISPC CXX)
+
+
+add_executable(ISPCSystemIncludes main.cxx simple.ispc)
+set_target_properties(ISPCSystemIncludes PROPERTIES POSITION_INDEPENDENT_CODE ON)
+target_include_directories(ISPCSystemIncludes SYSTEM PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
+
+target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>")
+endif()
diff --git a/Tests/ISPC/SystemIncludes/main.cxx b/Tests/ISPC/SystemIncludes/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/SystemIncludes/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/SystemIncludes/simple.ispc b/Tests/ISPC/SystemIncludes/simple.ispc
new file mode 100644
index 0000000..d539bbe
--- /dev/null
+++ b/Tests/ISPC/SystemIncludes/simple.ispc
@@ -0,0 +1,9 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}