[Piglit] [PATCH 1/2] cl: Add tests for stored fneg
arsenm2 at gmail.com
arsenm2 at gmail.com
Mon Jan 16 19:02:26 UTC 2017
From: Matt Arsenault <arsenm2 at gmail.com>
Make sure fneg that can't be folded into a use operand is
executed correctly.
---
tests/cl/program/execute/fneg-f32.cl | 31 +++++++++++++++++++++++++++++++
tests/cl/program/execute/fneg-f64.cl | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+)
create mode 100644 tests/cl/program/execute/fneg-f32.cl
create mode 100644 tests/cl/program/execute/fneg-f64.cl
diff --git a/tests/cl/program/execute/fneg-f32.cl b/tests/cl/program/execute/fneg-f32.cl
new file mode 100644
index 000000000..2950cffab
--- /dev/null
+++ b/tests/cl/program/execute/fneg-f32.cl
@@ -0,0 +1,31 @@
+/*!
+[config]
+name: fneg f32
+clc_version_min: 10
+
+dimensions: 1
+global_size: 15 0 0
+
+[test]
+name: fneg
+kernel_name: fneg_f32
+global_size: 15 0 0
+
+arg_out: 0 buffer float[15] \
+ -0.0 0.0 -0.5 0.5 \
+ -1.0 1.0 -2.0 2.0 \
+ -4.0 4.0 -10.0 10.0 \
+ -inf inf nan
+
+arg_in: 1 buffer float[15] \
+ 0.0 -0.0 0.5 -0.5 \
+ 1.0 -1.0 2.0 -2.0 \
+ 4.0 -4.0 10.0 -10.0 \
+ inf -inf nan
+!*/
+
+kernel void fneg_f32(global float* out, global float* in)
+{
+ int id = get_global_id(0);
+ out[id] = -in[id];
+}
diff --git a/tests/cl/program/execute/fneg-f64.cl b/tests/cl/program/execute/fneg-f64.cl
new file mode 100644
index 000000000..3b1f9e06e
--- /dev/null
+++ b/tests/cl/program/execute/fneg-f64.cl
@@ -0,0 +1,34 @@
+/*!
+[config]
+name: fneg f64
+clc_version_min: 10
+require_device_extensions: cl_khr_fp64
+
+dimensions: 1
+global_size: 15 0 0
+
+[test]
+name: fneg
+kernel_name: fneg
+global_size: 15 0 0
+
+arg_out: 0 buffer double[15] \
+ -0.0 0.0 -0.5 0.5 \
+ -1.0 1.0 -2.0 2.0 \
+ -4.0 4.0 -10.0 10.0 \
+ -inf inf nan
+
+arg_in: 1 buffer double[15] \
+ 0.0 -0.0 0.5 -0.5 \
+ 1.0 -1.0 2.0 -2.0 \
+ 4.0 -4.0 10.0 -10.0 \
+ inf -inf nan
+!*/
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+kernel void fneg(global double* out, global double* in)
+{
+ int id = get_global_id(0);
+ out[id] = -in[id];
+}
--
2.11.0
More information about the Piglit
mailing list