summaryrefslogtreecommitdiffstats
path: root/Tests/ISPC
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/ISPC')
-rw-r--r--Tests/ISPC/CMakeLists.txt3
-rw-r--r--Tests/ISPC/Defines/CMakeLists.txt12
-rw-r--r--Tests/ISPC/Defines/main.cxx2
-rw-r--r--Tests/ISPC/ObjectLibrary/CMakeLists.txt11
-rw-r--r--Tests/ISPC/ObjectLibrary/extra.cxx17
-rw-r--r--Tests/ISPC/ObjectLibrary/extra.ispc12
-rw-r--r--Tests/ISPC/ObjectLibrary/main.cxx2
-rw-r--r--Tests/ISPC/ResponseAndDefine/CMakeLists.txt28
-rw-r--r--Tests/ISPC/ResponseAndDefine/main.cxx2
-rw-r--r--Tests/ISPC/ResponseAndDefine/simple.ispc2
-rw-r--r--Tests/ISPC/StaticLibrary/CMakeLists.txt7
-rw-r--r--Tests/ISPC/StaticLibrary/main.cxx2
12 files changed, 71 insertions, 29 deletions
diff --git a/Tests/ISPC/CMakeLists.txt b/Tests/ISPC/CMakeLists.txt
index c8d58fd..ca5a79b 100644
--- a/Tests/ISPC/CMakeLists.txt
+++ b/Tests/ISPC/CMakeLists.txt
@@ -6,9 +6,8 @@ macro (add_ispc_test_macro name)
PROPERTY LABELS "ISPC")
endmacro ()
-# set (ISPC_IA_TARGETS "sse2-i32x4,sse4-i32x4,avx1-i32x8,avx2-i32x8,avx512knl-i32x16,avx512skx-i32x16")
-
add_ispc_test_macro(ISPC.Defines ISPCDefines)
add_ispc_test_macro(ISPC.ObjectLibrary ISPCObjectLibrary)
+add_ispc_test_macro(ISPC.ResponseAndDefine ISPCResponseAndDefine)
add_ispc_test_macro(ISPC.StaticLibrary ISPCStaticLibrary)
add_ispc_test_macro(ISPC.TryCompile ISPCTryCompile)
diff --git a/Tests/ISPC/Defines/CMakeLists.txt b/Tests/ISPC/Defines/CMakeLists.txt
index 2c9f4c3..5155106 100644
--- a/Tests/ISPC/Defines/CMakeLists.txt
+++ b/Tests/ISPC/Defines/CMakeLists.txt
@@ -1,11 +1,15 @@
cmake_minimum_required(VERSION 3.18)
project(ISPCDefines CXX ISPC)
-set(CMAKE_ISPC_FLAGS -DM_PI=3.1415926535f [==[-DSTRUCT_DEFINE=struct{uniform int a]==])
+set(CMAKE_ISPC_FLAGS -DM_PI=3.1415926535f)
+add_compile_definitions([==[STRUCT_DEFINE=struct{uniform int a]==])
-add_executable(ISPCResponseFile
+add_executable(ISPCDefines
main.cxx
simple.ispc
)
-set_target_properties(ISPCResponseFile PROPERTIES POSITION_INDEPENDENT_CODE ON)
-target_include_directories(ISPCResponseFile PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
+
+set_target_properties(ISPCDefines PROPERTIES POSITION_INDEPENDENT_CODE ON)
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set_source_files_properties(simple.ispc PROPERTIES COMPILE_OPTIONS "--arch=x86")
+endif()
diff --git a/Tests/ISPC/Defines/main.cxx b/Tests/ISPC/Defines/main.cxx
index a6b91a6..4f1c9be 100644
--- a/Tests/ISPC/Defines/main.cxx
+++ b/Tests/ISPC/Defines/main.cxx
@@ -1,6 +1,6 @@
#include <stdio.h>
-#include "simple_ispc.h"
+#include "simple.ispc.h"
int main()
{
diff --git a/Tests/ISPC/ObjectLibrary/CMakeLists.txt b/Tests/ISPC/ObjectLibrary/CMakeLists.txt
index edfbdd8..333ad66 100644
--- a/Tests/ISPC/ObjectLibrary/CMakeLists.txt
+++ b/Tests/ISPC/ObjectLibrary/CMakeLists.txt
@@ -3,12 +3,15 @@ cmake_minimum_required(VERSION 3.18)
project(ISPCObjectLibrary CXX ISPC)
set(CMAKE_NINJA_FORCE_RESPONSE_FILE ON)
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(CMAKE_ISPC_FLAGS "--arch=x86")
+endif()
-add_library(ispc_objects OBJECT simple.ispc)
+add_library(ispc_objects OBJECT simple.ispc extra.ispc)
+
+target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
-target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4;--arch=x86-64>")
-target_include_directories(ispc_objects INTERFACE "${CMAKE_CURRENT_BINARY_DIR}")
set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
-add_executable(ISPCObjectLibrary main.cxx)
+add_executable(ISPCObjectLibrary main.cxx extra.cxx)
target_link_libraries(ISPCObjectLibrary PRIVATE ispc_objects)
diff --git a/Tests/ISPC/ObjectLibrary/extra.cxx b/Tests/ISPC/ObjectLibrary/extra.cxx
new file mode 100644
index 0000000..88ef3a7
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/extra.cxx
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+#include "extra.ispc.h"
+
+int extra()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::extra(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: extra(%f) = %f\n", i, vin[i], vout[i]);
+
+ return 0;
+}
diff --git a/Tests/ISPC/ObjectLibrary/extra.ispc b/Tests/ISPC/ObjectLibrary/extra.ispc
new file mode 100644
index 0000000..5a4a442
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/extra.ispc
@@ -0,0 +1,12 @@
+
+export void extra(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/ObjectLibrary/main.cxx b/Tests/ISPC/ObjectLibrary/main.cxx
index a6b91a6..4f1c9be 100644
--- a/Tests/ISPC/ObjectLibrary/main.cxx
+++ b/Tests/ISPC/ObjectLibrary/main.cxx
@@ -1,6 +1,6 @@
#include <stdio.h>
-#include "simple_ispc.h"
+#include "simple.ispc.h"
int main()
{
diff --git a/Tests/ISPC/ResponseAndDefine/CMakeLists.txt b/Tests/ISPC/ResponseAndDefine/CMakeLists.txt
index 0dc5320..7539209 100644
--- a/Tests/ISPC/ResponseAndDefine/CMakeLists.txt
+++ b/Tests/ISPC/ResponseAndDefine/CMakeLists.txt
@@ -1,5 +1,5 @@
-
-project(ispc_spaces_in_path)
+cmake_minimum_required(VERSION 3.18)
+project(ispc_spaces_in_path ISPC CXX)
set(CMAKE_NINJA_FORCE_RESPONSE_FILE ON)
@@ -10,15 +10,19 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/path with spaces/simple_include.h"
"
)
-add_executable(SpacesInPath main.cxx simple.ispc)
-set_target_properties(SpacesInPath PROPERTIES POSITION_INDEPENDENT_CODE ON)
-target_include_directories(SpacesInPath PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
+add_executable(ISPCResponseAndDefine main.cxx simple.ispc)
+set_target_properties(ISPCResponseAndDefine PROPERTIES POSITION_INDEPENDENT_CODE ON)
+target_include_directories(ISPCResponseAndDefine PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
+
+target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>")
+endif()
+
-target_compile_options(SpacesInPath PRIVATE
- "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4;--arch=x86-64>")
-target_compile_definitions(SpacesInPath PRIVATE
- "$<$<COMPILE_LANGUAGE:ISPC>:STRUCT_DEFINE=\"struct{uniform int a;varying int b;\";M_PI=3.1415926535f>")
-target_include_directories(SpacesInPath PRIVATE
- "$<$<COMPILE_LANGUAGE:ISPC>:\"fake path with spaces\">""
- "$<$<COMPILE_LANGUAGE:ISPC>:\"path with spaces\">")
+target_compile_definitions(ISPCResponseAndDefine PRIVATE
+ "$<$<COMPILE_LANGUAGE:ISPC>:STRUCT_DEFINE=struct{uniform int a>;M_PI=3.14159f")
+target_include_directories(ISPCResponseAndDefine PRIVATE
+ "$<$<COMPILE_LANGUAGE:ISPC>:${CMAKE_CURRENT_BINARY_DIR}/fake path with spaces>"
+ "$<$<COMPILE_LANGUAGE:ISPC>:${CMAKE_CURRENT_BINARY_DIR}/path with spaces>")
diff --git a/Tests/ISPC/ResponseAndDefine/main.cxx b/Tests/ISPC/ResponseAndDefine/main.cxx
index a6b91a6..4f1c9be 100644
--- a/Tests/ISPC/ResponseAndDefine/main.cxx
+++ b/Tests/ISPC/ResponseAndDefine/main.cxx
@@ -1,6 +1,6 @@
#include <stdio.h>
-#include "simple_ispc.h"
+#include "simple.ispc.h"
int main()
{
diff --git a/Tests/ISPC/ResponseAndDefine/simple.ispc b/Tests/ISPC/ResponseAndDefine/simple.ispc
index 3f32c37..81fd7ca 100644
--- a/Tests/ISPC/ResponseAndDefine/simple.ispc
+++ b/Tests/ISPC/ResponseAndDefine/simple.ispc
@@ -1,5 +1,5 @@
-STRUCT_DEFINE};
+STRUCT_DEFINE;};
#include "simple_include.h"
diff --git a/Tests/ISPC/StaticLibrary/CMakeLists.txt b/Tests/ISPC/StaticLibrary/CMakeLists.txt
index b057544..ebe5960 100644
--- a/Tests/ISPC/StaticLibrary/CMakeLists.txt
+++ b/Tests/ISPC/StaticLibrary/CMakeLists.txt
@@ -4,8 +4,11 @@ project(ISPCStaticLibrary CXX ISPC)
add_library(ispc_objects STATIC simple.ispc)
-target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4;--arch=x86-64>")
-target_include_directories(ispc_objects INTERFACE "${CMAKE_CURRENT_BINARY_DIR}")
+target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>")
+endif()
+
set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_executable(ISPCStaticLibrary main.cxx)
diff --git a/Tests/ISPC/StaticLibrary/main.cxx b/Tests/ISPC/StaticLibrary/main.cxx
index a6b91a6..4f1c9be 100644
--- a/Tests/ISPC/StaticLibrary/main.cxx
+++ b/Tests/ISPC/StaticLibrary/main.cxx
@@ -1,6 +1,6 @@
#include <stdio.h>
-#include "simple_ispc.h"
+#include "simple.ispc.h"
int main()
{