[Piglit] [PATCH 2/2] cl: Add convert_long(float) test

Tom Stellard thomas.stellard at amd.com
Mon May 5 23:55:45 PDT 2014


---
 tests/cl.py                                        |  1 +
 .../execute/builtin/convert/float-convert_long.cl  | 30 ++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 tests/cl/program/execute/builtin/convert/float-convert_long.cl

diff --git a/tests/cl.py b/tests/cl.py
index 0b1e8be..33b9b93 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -114,6 +114,7 @@ add_program_test_dir(program_build, 'tests/cl/program/build')
 add_program_test_dir(program_build_fail, 'tests/cl/program/build/fail')
 add_program_test_dir(program_execute, 'tests/cl/program/execute')
 add_program_test_dir(program_execute, 'tests/cl/program/execute/builtin/atomic')
+add_program_test_dir(program_execute, 'tests/cl/program/execute/builtin/convert')
 
 #Run generated built-in tests
 program_execute_builtin = Group()
diff --git a/tests/cl/program/execute/builtin/convert/float-convert_long.cl b/tests/cl/program/execute/builtin/convert/float-convert_long.cl
new file mode 100644
index 0000000..3d6930a
--- /dev/null
+++ b/tests/cl/program/execute/builtin/convert/float-convert_long.cl
@@ -0,0 +1,30 @@
+/*!
+[config]
+name: convert_long(float)
+dimensions: 1
+global_size: 1 1 1
+local_size: 1 1 1
+kernel_name: test
+
+[test]
+arg_out: 0 buffer long[8] 0 36864 -47104 41943040 -35651584 131 5000000000 -6000000000
+# These values were choosen to exercise all code paths in the generic
+# implementation of __fixsfdi in compiler-rt:
+# https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/fixsfdi.c
+arg_in:  1 buffer float[8] 0x1.2p-5      \ # exp < 0
+                           0x1.2p+15     \ # pos exp <= 23
+                           -0x1.7p+15    \ # neg exp <= 23
+                           0x1.4p25      \ # pos exp > 23
+                           -0x1.1p25     \ # neg exp > 23
+                           131.35        \ # Random non-integer value
+                           5000000000.0  \ # Positive value requiring more than 32-bits
+                           -6000000000.0   # Negative value requiring more than 32-bits
+
+!*/
+
+kernel void test(global long *out, global float *in) {
+	unsigned i;
+	for (i = 0; i < 8; i++) {
+		out[i] = convert_long(in[i]);
+	}
+}
-- 
1.8.1.5



More information about the Piglit mailing list