// Scalar is easy. We neednot build register tuples
if (isScalarType(llvmType) == true) {
const ir::Type type = getType(ctx, llvmType);
- //if(type == ir::TYPE_DOUBLE) // 64bit-float load(store) don't support SIMD16
- // OCL_SIMD_WIDTH = 8;
const ir::Register values = this->getRegister(llvmValues);
if (isLoad)
ctx.LOAD(type, ptr, addrSpace, dwAligned, values);
/* test OpenCL 1.1 Vector Data Load/Store Functions (section 6.11.7) */
-
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#define OFFSET2(type) (type ##2) {(type)1, (type)2}
#define OFFSET3(type) (type ##3) {(type)1, (type)2, (type)3}
#define OFFSET4(type) (type ##4) {(type)1, (type)2, (type)3, (type)4}
TEST_TYPE(ushort,n)\
TEST_TYPE(int,n) \
TEST_TYPE(uint,n) \
- TEST_TYPE(float,n)
+ TEST_TYPE(float,n) \
+ TEST_TYPE(double,n)
#if 0
- TEST_TYPE(double,n)
TEST_TYPE(long,n)
TEST_TYPE(ulong,n)
TEST_TYPE(half,n)
#include "utest_helper.hpp"
+#include <string.h>
template<typename T>
static void compiler_vector_load_store(int elemNum, const char *kernelName)
{
buf_data[0] = (T*) malloc(sizeof(T) * n);
for (uint32_t i = 0; i < n; ++i)
((T*)buf_data[0])[i] = i;
- OCL_CREATE_BUFFER(buf[0], CL_MEM_COPY_HOST_PTR, n * sizeof(float), buf_data[0]);
- OCL_CREATE_BUFFER(buf[1], 0, n * sizeof(float), NULL);
+ OCL_CREATE_BUFFER(buf[0], CL_MEM_COPY_HOST_PTR, n * sizeof(T), buf_data[0]);
+ OCL_CREATE_BUFFER(buf[1], 0, n * sizeof(T), NULL);
free(buf_data[0]);
buf_data[0] = NULL;
for (uint32_t i = 0; i < n; ++i)
{
int shift = ((i % elemNum) + 1);
- OCL_ASSERT(((T*)buf_data[1])[i] == (T)(((T*)buf_data[0])[i] + shift));
+ if (strstr(kernelName, "double") == NULL)
+ OCL_ASSERT(((T*)buf_data[1])[i] == (T)(((T*)buf_data[0])[i] + shift));
+ else
+ OCL_ASSERT((((T*)buf_data[1])[i] - ((T)((T*)buf_data[0])[i] + shift)) < 1e-5);
}
OCL_UNMAP_BUFFER(0);
OCL_UNMAP_BUFFER(1);
test_all_vector(int32_t, int)
test_all_vector(uint32_t, uint)
test_all_vector(float, float)
-//test_all_vector(double, double)
+test_all_vector(double, double)
//test_all_vector(int64_t, long)
//test_all_vector(uint64_t, ulong)