/*!
[config]
name: Vector store_half local double2,3,4,8,16
clc_version_min: 11

dimensions: 1
global_size: 1 0 0
require_device_extensions: cl_khr_fp64
[test]
name: vector store_half local double
kernel_name: vstore_half_local
arg_out: 0 buffer half[3] 0 68 0xdeadp1
arg_in: 0 buffer half[3] 0 0  0xdeadp1
arg_in:  1 buffer double[1] 68

[test]
name: vector store_half local offset double
kernel_name: vstore_half_local_offset
arg_out: 0 buffer half[4] 0  68  68 0xdeadp1
arg_in: 0 buffer half[4] 0 0 0  0xdeadp1
arg_in: 1 buffer double[1] 68

[test]
name: vector store_half local double2
kernel_name: vstore_half2_local
arg_out: 0 buffer half[4] 0 28 46 0xdeadp1
arg_in: 0 buffer half[4] 0 0 0  0xdeadp1
arg_in:  1 buffer double2[1] 28 46

[test]
name: vector store_half local offset double2
kernel_name: vstore_half2_local_offset
arg_out: 0 buffer half[6] 0  28 46  28 46 0xdeadp1
arg_in: 0 buffer half[6] 0 0 0 0 0  0xdeadp1
arg_in: 1 buffer double2[1] 28 46

[test]
name: vector store_half local double3
kernel_name: vstore_half3_local
arg_out: 0 buffer half[5] 0 121 66 189 0xdeadp1
arg_in: 0 buffer half[5] 0 0 0 0  0xdeadp1
arg_in:  1 buffer double3[1] 121 66 189

[test]
name: vector store_half local offset double3
kernel_name: vstore_half3_local_offset
arg_out: 0 buffer half[8] 0  121 66 189  121 66 189 0xdeadp1
arg_in: 0 buffer half[8] 0 0 0 0 0 0 0  0xdeadp1
arg_in: 1 buffer double3[1] 121 66 189

[test]
name: vector store_half local double4
kernel_name: vstore_half4_local
arg_out: 0 buffer half[6] 0 120 155 52 202 0xdeadp1
arg_in: 0 buffer half[6] 0 0 0 0 0  0xdeadp1
arg_in:  1 buffer double4[1] 120 155 52 202

[test]
name: vector store_half local offset double4
kernel_name: vstore_half4_local_offset
arg_out: 0 buffer half[10] 0  120 155 52 202  120 155 52 202 0xdeadp1
arg_in: 0 buffer half[10] 0 0 0 0 0 0 0 0 0  0xdeadp1
arg_in: 1 buffer double4[1] 120 155 52 202

[test]
name: vector store_half local double8
kernel_name: vstore_half8_local
arg_out: 0 buffer half[10] 0 116 189 192 64 98 22 43 70 0xdeadp1
arg_in: 0 buffer half[10] 0 0 0 0 0 0 0 0 0  0xdeadp1
arg_in:  1 buffer double8[1] 116 189 192 64 98 22 43 70

[test]
name: vector store_half local offset double8
kernel_name: vstore_half8_local_offset
arg_out: 0 buffer half[18] 0  116 189 192 64 98 22 43 70  116 189 192 64 98 22 43 70 0xdeadp1
arg_in: 0 buffer half[18] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  0xdeadp1
arg_in: 1 buffer double8[1] 116 189 192 64 98 22 43 70

[test]
name: vector store_half local double16
kernel_name: vstore_half16_local
arg_out: 0 buffer half[18] 0 185 240 246 145 213 116 228 2 209 132 121 113 5 151 154 171 0xdeadp1
arg_in: 0 buffer half[18] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  0xdeadp1
arg_in:  1 buffer double16[1] 185 240 246 145 213 116 228 2 209 132 121 113 5 151 154 171

[test]
name: vector store_half local offset double16
kernel_name: vstore_half16_local_offset
arg_out: 0 buffer half[34] 0  185 240 246 145 213 116 228 2 209 132 121 113 5 151 154 171  185 240 246 145 213 116 228 2 209 132 121 113 5 151 154 171 0xdeadp1
arg_in: 0 buffer half[34] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  0xdeadp1
arg_in: 1 buffer double16[1] 185 240 246 145 213 116 228 2 209 132 121 113 5 151 154 171

!*/

#pragma OPENCL EXTENSION cl_khr_fp64: enable

kernel void vstore_half_local(global half *out,
                             global double *in) {
    double tmp = in[0];
    volatile local short loc[2];
    for (int i = 0; i < 2; ++i)
        loc[i] = 0;

    vstore_half(tmp, 0, (local half*)loc + 1);

    for (int i = 0; i < 2; ++i)
        ((global short *)out)[i] = loc[i];
}

kernel void vstore_half_local_offset(global half *out,
                                    global double *in) {
    double tmp = in[0];
    volatile local short loc[3];
    for (int i = 0; i < 3; ++i)
        loc[i] = 0;

    vstore_half(tmp, 0, (local half*)loc + 1);
    vstore_half(tmp, 1, (local half*)loc + 1);

    for (int i = 0; i < 3; ++i)
        ((global short *)out)[i] = loc[i];
}

kernel void vstore_half2_local(global half *out,
                             global double2 *in) {
    double2 tmp = in[0];
    volatile local short loc[3];
    for (int i = 0; i < 3; ++i)
        loc[i] = 0;

    vstore_half2(tmp, 0, (local half*)loc + 1);

    for (int i = 0; i < 3; ++i)
        ((global short *)out)[i] = loc[i];
}

kernel void vstore_half2_local_offset(global half *out,
                                    global double2 *in) {
    double2 tmp = in[0];
    volatile local short loc[5];
    for (int i = 0; i < 5; ++i)
        loc[i] = 0;

    vstore_half2(tmp, 0, (local half*)loc + 1);
    vstore_half2(tmp, 1, (local half*)loc + 1);

    for (int i = 0; i < 5; ++i)
        ((global short *)out)[i] = loc[i];
}

kernel void vstore_half3_local(global half *out,
                             global double3 *in) {
    double3 tmp = in[0];
    volatile local short loc[4];
    for (int i = 0; i < 4; ++i)
        loc[i] = 0;

    vstore_half3(tmp, 0, (local half*)loc + 1);

    for (int i = 0; i < 4; ++i)
        ((global short *)out)[i] = loc[i];
}

kernel void vstore_half3_local_offset(global half *out,
                                    global double3 *in) {
    double3 tmp = in[0];
    volatile local short loc[7];
    for (int i = 0; i < 7; ++i)
        loc[i] = 0;

    vstore_half3(tmp, 0, (local half*)loc + 1);
    vstore_half3(tmp, 1, (local half*)loc + 1);

    for (int i = 0; i < 7; ++i)
        ((global short *)out)[i] = loc[i];
}

kernel void vstore_half4_local(global half *out,
                             global double4 *in) {
    double4 tmp = in[0];
    volatile local short loc[5];
    for (int i = 0; i < 5; ++i)
        loc[i] = 0;

    vstore_half4(tmp, 0, (local half*)loc + 1);

    for (int i = 0; i < 5; ++i)
        ((global short *)out)[i] = loc[i];
}

kernel void vstore_half4_local_offset(global half *out,
                                    global double4 *in) {
    double4 tmp = in[0];
    volatile local short loc[9];
    for (int i = 0; i < 9; ++i)
        loc[i] = 0;

    vstore_half4(tmp, 0, (local half*)loc + 1);
    vstore_half4(tmp, 1, (local half*)loc + 1);

    for (int i = 0; i < 9; ++i)
        ((global short *)out)[i] = loc[i];
}

kernel void vstore_half8_local(global half *out,
                             global double8 *in) {
    double8 tmp = in[0];
    volatile local short loc[9];
    for (int i = 0; i < 9; ++i)
        loc[i] = 0;

    vstore_half8(tmp, 0, (local half*)loc + 1);

    for (int i = 0; i < 9; ++i)
        ((global short *)out)[i] = loc[i];
}

kernel void vstore_half8_local_offset(global half *out,
                                    global double8 *in) {
    double8 tmp = in[0];
    volatile local short loc[17];
    for (int i = 0; i < 17; ++i)
        loc[i] = 0;

    vstore_half8(tmp, 0, (local half*)loc + 1);
    vstore_half8(tmp, 1, (local half*)loc + 1);

    for (int i = 0; i < 17; ++i)
        ((global short *)out)[i] = loc[i];
}

kernel void vstore_half16_local(global half *out,
                             global double16 *in) {
    double16 tmp = in[0];
    volatile local short loc[17];
    for (int i = 0; i < 17; ++i)
        loc[i] = 0;

    vstore_half16(tmp, 0, (local half*)loc + 1);

    for (int i = 0; i < 17; ++i)
        ((global short *)out)[i] = loc[i];
}

kernel void vstore_half16_local_offset(global half *out,
                                    global double16 *in) {
    double16 tmp = in[0];
    volatile local short loc[33];
    for (int i = 0; i < 33; ++i)
        loc[i] = 0;

    vstore_half16(tmp, 0, (local half*)loc + 1);
    vstore_half16(tmp, 1, (local half*)loc + 1);

    for (int i = 0; i < 33; ++i)
        ((global short *)out)[i] = loc[i];
}
