//
// Copyright (C) 2009-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT
//
//

// LSC Loads
// uchar
uint load_uchar_to_uint_L1UC_L3UC(global uchar* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_uchar_to_uint_L1UC_L3C(global uchar* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_uchar_to_uint_L1C_L3UC(global uchar* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_uchar_to_uint_L1C_L3C(global uchar* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_uchar_to_uint_L1S_L3UC(global uchar* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_uchar_to_uint_L1S_L3C(global uchar* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_uchar_to_uint_L1IAR_L3C(global uchar* it, int offset)
{
    return (uint)(it[offset]);
}

// ushort
uint load_ushort_to_uint_L1UC_L3UC(global ushort* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_ushort_to_uint_L1UC_L3C(global ushort* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_ushort_to_uint_L1C_L3UC(global ushort* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_ushort_to_uint_L1C_L3C(global ushort* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_ushort_to_uint_L1S_L3UC(global ushort* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_ushort_to_uint_L1S_L3C(global ushort* it, int offset)
{
    return (uint)(it[offset]);
}

uint load_ushort_to_uint_L1IAR_L3C(global ushort* it, int offset)
{
    return (uint)(it[offset]);
}

// uint
uint load_uint_L1UC_L3UC(global uint* it, int offset)
{
    return it[offset];
}

uint load_uint_L1UC_L3C(global uint* it, int offset)
{
    return it[offset];
}

uint load_uint_L1C_L3UC(global uint* it, int offset)
{
    return it[offset];
}

uint load_uint_L1C_L3C(global uint* it, int offset)
{
    return it[offset];
}

uint load_uint_L1S_L3UC(global uint* it, int offset)
{
    return it[offset];
}

uint load_uint_L1S_L3C(global uint* it, int offset)
{
    return it[offset];
}

uint load_uint_L1IAR_L3C(global uint* it, int offset)
{
    return it[offset];
}

// uint2
uint2 load_uint2_L1UC_L3UC(global uint2* it, int offset)
{
    return it[offset];
}

uint2 load_uint2_L1UC_L3C(global uint2* it, int offset)
{
    return it[offset];
}

uint2 load_uint2_L1C_L3UC(global uint2* it, int offset)
{
    return it[offset];
}

uint2 load_uint2_L1C_L3C(global uint2* it, int offset)
{
    return it[offset];
}

uint2 load_uint2_L1S_L3UC(global uint2* it, int offset)
{
    return it[offset];
}

uint2 load_uint2_L1S_L3C(global uint2* it, int offset)
{
    return it[offset];
}

uint2 load_uint2_L1IAR_L3C(global uint2* it, int offset)
{
    return it[offset];
}

// uint3
uint3 load_uint3_L1UC_L3UC(global uint3* it, int offset)
{
    return it[offset];
}

uint3 load_uint3_L1UC_L3C(global uint3* it, int offset)
{
    return it[offset];
}

uint3 load_uint3_L1C_L3UC(global uint3* it, int offset)
{
    return it[offset];
}

uint3 load_uint3_L1C_L3C(global uint3* it, int offset)
{
    return it[offset];
}

uint3 load_uint3_L1S_L3UC(global uint3* it, int offset)
{
    return it[offset];
}

uint3 load_uint3_L1S_L3C(global uint3* it, int offset)
{
    return it[offset];
}

uint3 load_uint3_L1IAR_L3C(global uint3* it, int offset)
{
    return it[offset];
}

// uint4
uint4 load_uint4_L1UC_L3UC(global uint4* it, int offset)
{
    return it[offset];
}

uint4 load_uint4_L1UC_L3C(global uint4* it, int offset)
{
    return it[offset];
}

uint4 load_uint4_L1C_L3UC(global uint4* it, int offset)
{
    return it[offset];
}

uint4 load_uint4_L1C_L3C(global uint4* it, int offset)
{
    return it[offset];
}

uint4 load_uint4_L1S_L3UC(global uint4* it, int offset)
{
    return it[offset];
}

uint4 load_uint4_L1S_L3C(global uint4* it, int offset)
{
    return it[offset];
}

uint4 load_uint4_L1IAR_L3C(global uint4* it, int offset)
{
    return it[offset];
}

// uint8
uint8 load_uint8_L1UC_L3UC(global uint8* it, int offset)
{
    return it[offset];
}

uint8 load_uint8_L1UC_L3C(global uint8* it, int offset)
{
    return it[offset];
}

uint8 load_uint8_L1C_L3UC(global uint8* it, int offset)
{
    return it[offset];
}

uint8 load_uint8_L1C_L3C(global uint8* it, int offset)
{
    return it[offset];
}

uint8 load_uint8_L1S_L3UC(global uint8* it, int offset)
{
    return it[offset];
}

uint8 load_uint8_L1S_L3C(global uint8* it, int offset)
{
    return it[offset];
}

uint8 load_uint8_L1IAR_L3C(global uint8* it, int offset)
{
    return it[offset];
}

// ulong
ulong load_ulong_L1UC_L3UC(global ulong* it, int offset)
{
    return it[offset];
}

ulong load_ulong_L1UC_L3C(global ulong* it, int offset)
{
    return it[offset];
}

ulong load_ulong_L1C_L3UC(global ulong* it, int offset)
{
    return it[offset];
}

ulong load_ulong_L1C_L3C(global ulong* it, int offset)
{
    return it[offset];
}

ulong load_ulong_L1S_L3UC(global ulong* it, int offset)
{
    return it[offset];
}

ulong load_ulong_L1S_L3C(global ulong* it, int offset)
{
    return it[offset];
}

ulong load_ulong_L1IAR_L3C(global ulong* it, int offset)
{
    return it[offset];
}

// ulong2
ulong2 load_ulong2_L1UC_L3UC(global ulong2* it, int offset)
{
    return it[offset];
}

ulong2 load_ulong2_L1UC_L3C(global ulong2* it, int offset)
{
    return it[offset];
}

ulong2 load_ulong2_L1C_L3UC(global ulong2* it, int offset)
{
    return it[offset];
}

ulong2 load_ulong2_L1C_L3C(global ulong2* it, int offset)
{
    return it[offset];
}

ulong2 load_ulong2_L1S_L3UC(global ulong2* it, int offset)
{
    return it[offset];
}

ulong2 load_ulong2_L1S_L3C(global ulong2* it, int offset)
{
    return it[offset];
}

ulong2 load_ulong2_L1IAR_L3C(global ulong2* it, int offset)
{
    return it[offset];
}

// ulong3
ulong3 load_ulong3_L1UC_L3UC(global ulong3* it, int offset)
{
    return it[offset];
}

ulong3 load_ulong3_L1UC_L3C(global ulong3* it, int offset)
{
    return it[offset];
}

ulong3 load_ulong3_L1C_L3UC(global ulong3* it, int offset)
{
    return it[offset];
}

ulong3 load_ulong3_L1C_L3C(global ulong3* it, int offset)
{
    return it[offset];
}

ulong3 load_ulong3_L1S_L3UC(global ulong3* it, int offset)
{
    return it[offset];
}

ulong3 load_ulong3_L1S_L3C(global ulong3* it, int offset)
{
    return it[offset];
}

ulong3 load_ulong3_L1IAR_L3C(global ulong3* it, int offset)
{
    return it[offset];
}

// ulong4
ulong4 load_ulong4_L1UC_L3UC(global ulong4* it, int offset)
{
    return it[offset];
}

ulong4 load_ulong4_L1UC_L3C(global ulong4* it, int offset)
{
    return it[offset];
}

ulong4 load_ulong4_L1C_L3UC(global ulong4* it, int offset)
{
    return it[offset];
}

ulong4 load_ulong4_L1C_L3C(global ulong4* it, int offset)
{
    return it[offset];
}

ulong4 load_ulong4_L1S_L3UC(global ulong4* it, int offset)
{
    return it[offset];
}

ulong4 load_ulong4_L1S_L3C(global ulong4* it, int offset)
{
    return it[offset];
}

ulong4 load_ulong4_L1IAR_L3C(global ulong4* it, int offset)
{
    return it[offset];
}

// ulong8
ulong8 load_ulong8_L1UC_L3UC(global ulong8* it, int offset)
{
    return it[offset];
}

ulong8 load_ulong8_L1UC_L3C(global ulong8* it, int offset)
{
    return it[offset];
}

ulong8 load_ulong8_L1C_L3UC(global ulong8* it, int offset)
{
    return it[offset];
}

ulong8 load_ulong8_L1C_L3C(global ulong8* it, int offset)
{
    return it[offset];
}

ulong8 load_ulong8_L1S_L3UC(global ulong8* it, int offset)
{
    return it[offset];
}

ulong8 load_ulong8_L1S_L3C(global ulong8* it, int offset)
{
    return it[offset];
}

ulong8 load_ulong8_L1IAR_L3C(global ulong8* it, int offset)
{
    return it[offset];
}

// LSC Stores
// uchar
void store_uchar_from_uint_L1UC_L3UC(global uchar* it, int offset, uint value)
{
    it[offset] = (uchar)(value);
}

void store_uchar_from_uint_L1UC_L3WB(global uchar* it, int offset, uint value)
{
    it[offset] = (uchar)(value);
}

void store_uchar_from_uint_L1WT_L3UC(global uchar* it, int offset, uint value)
{
    it[offset] = (uchar)(value);
}

void store_uchar_from_uint_L1WT_L3WB(global uchar* it, int offset, uint value)
{
    it[offset] = (uchar)(value);
}

void store_uchar_from_uint_L1S_L3UC(global uchar* it, int offset, uint value)
{
    it[offset] = (uchar)(value);
}

void store_uchar_from_uint_L1S_L3WB(global uchar* it, int offset, uint value)
{
    it[offset] = (uchar)(value);
}

void store_uchar_from_uint_L1WB_L3WB(global uchar* it, int offset, uint value)
{
    it[offset] = (uchar)(value);
}

// ushort
void store_ushort_from_uint_L1UC_L3UC(global ushort* it, int offset, uint value)
{
    it[offset] = (ushort)(value);
}

void store_ushort_from_uint_L1UC_L3WB(global ushort* it, int offset, uint value)
{
    it[offset] = (ushort)(value);
}

void store_ushort_from_uint_L1WT_L3UC(global ushort* it, int offset, uint value)
{
    it[offset] = (ushort)(value);
}

void store_ushort_from_uint_L1WT_L3WB(global ushort* it, int offset, uint value)
{
    it[offset] = (ushort)(value);
}

void store_ushort_from_uint_L1S_L3UC(global ushort* it, int offset, uint value)
{
    it[offset] = (ushort)(value);
}

void store_ushort_from_uint_L1S_L3WB(global ushort* it, int offset, uint value)
{
    it[offset] = (ushort)(value);
}

void store_ushort_from_uint_L1WB_L3WB(global ushort* it, int offset, uint value)
{
    it[offset] = (ushort)(value);
}

// uint
void store_uint_L1UC_L3UC(global uint* it, int offset, uint value)
{
    it[offset] = value;
}

void store_uint_L1UC_L3WB(global uint* it, int offset, uint value)
{
    it[offset] = value;
}

void store_uint_L1WT_L3UC(global uint* it, int offset, uint value)
{
    it[offset] = value;
}

void store_uint_L1WT_L3WB(global uint* it, int offset, uint value)
{
    it[offset] = value;
}

void store_uint_L1S_L3UC(global uint* it, int offset, uint value)
{
    it[offset] = value;
}

void store_uint_L1S_L3WB(global uint* it, int offset, uint value)
{
    it[offset] = value;
}

void store_uint_L1WB_L3WB(global uint* it, int offset, uint value)
{
    it[offset] = value;
}

// uint2
void store_uint2_L1UC_L3UC(global uint2* it, int offset, uint2 value)
{
    it[offset] = value;
}

void store_uint2_L1UC_L3WB(global uint2* it, int offset, uint2 value)
{
    it[offset] = value;
}

void store_uint2_L1WT_L3UC(global uint2* it, int offset, uint2 value)
{
    it[offset] = value;
}

void store_uint2_L1WT_L3WB(global uint2* it, int offset, uint2 value)
{
    it[offset] = value;
}

void store_uint2_L1S_L3UC(global uint2* it, int offset, uint2 value)
{
    it[offset] = value;
}

void store_uint2_L1S_L3WB(global uint2* it, int offset, uint2 value)
{
    it[offset] = value;
}

void store_uint2_L1WB_L3WB(global uint2* it, int offset, uint2 value)
{
    it[offset] = value;
}

// uint3
void store_uint3_L1UC_L3UC(global uint3* it, int offset, uint3 value)
{
    it[offset] = value;
}

void store_uint3_L1UC_L3WB(global uint3* it, int offset, uint3 value)
{
    it[offset] = value;
}

void store_uint3_L1WT_L3UC(global uint3* it, int offset, uint3 value)
{
    it[offset] = value;
}

void store_uint3_L1WT_L3WB(global uint3* it, int offset, uint3 value)
{
    it[offset] = value;
}

void store_uint3_L1S_L3UC(global uint3* it, int offset, uint3 value)
{
    it[offset] = value;
}

void store_uint3_L1S_L3WB(global uint3* it, int offset, uint3 value)
{
    it[offset] = value;
}

void store_uint3_L1WB_L3WB(global uint3* it, int offset, uint3 value)
{
    it[offset] = value;
}

// uint4
void store_uint4_L1UC_L3UC(global uint4* it, int offset, uint4 value)
{
    it[offset] = value;
}

void store_uint4_L1UC_L3WB(global uint4* it, int offset, uint4 value)
{
    it[offset] = value;
}

void store_uint4_L1WT_L3UC(global uint4* it, int offset, uint4 value)
{
    it[offset] = value;
}

void store_uint4_L1WT_L3WB(global uint4* it, int offset, uint4 value)
{
    it[offset] = value;
}

void store_uint4_L1S_L3UC(global uint4* it, int offset, uint4 value)
{
    it[offset] = value;
}

void store_uint4_L1S_L3WB(global uint4* it, int offset, uint4 value)
{
    it[offset] = value;
}

void store_uint4_L1WB_L3WB(global uint4* it, int offset, uint4 value)
{
    it[offset] = value;
}

// uint8
void store_uint8_L1UC_L3UC(global uint8* it, int offset, uint8 value)
{
    it[offset] = value;
}

void store_uint8_L1UC_L3WB(global uint8* it, int offset, uint8 value)
{
    it[offset] = value;
}

void store_uint8_L1WT_L3UC(global uint8* it, int offset, uint8 value)
{
    it[offset] = value;
}

void store_uint8_L1WT_L3WB(global uint8* it, int offset, uint8 value)
{
    it[offset] = value;
}

void store_uint8_L1S_L3UC(global uint8* it, int offset, uint8 value)
{
    it[offset] = value;
}

void store_uint8_L1S_L3WB(global uint8* it, int offset, uint8 value)
{
    it[offset] = value;
}

void store_uint8_L1WB_L3WB(global uint8* it, int offset, uint8 value)
{
    it[offset] = value;
}

// ulong
void store_ulong_L1UC_L3UC(global ulong* it, int offset, ulong value)
{
    it[offset] = value;
}

void store_ulong_L1UC_L3WB(global ulong* it, int offset, ulong value)
{
    it[offset] = value;
}

void store_ulong_L1WT_L3UC(global ulong* it, int offset, ulong value)
{
    it[offset] = value;
}

void store_ulong_L1WT_L3WB(global ulong* it, int offset, ulong value)
{
    it[offset] = value;
}

void store_ulong_L1S_L3UC(global ulong* it, int offset, ulong value)
{
    it[offset] = value;
}

void store_ulong_L1S_L3WB(global ulong* it, int offset, ulong value)
{
    it[offset] = value;
}

void store_ulong_L1WB_L3WB(global ulong* it, int offset, ulong value)
{
    it[offset] = value;
}

// ulong2
void store_ulong2_L1UC_L3UC(global ulong2* it, int offset, ulong2 value)
{
    it[offset] = value;
}

void store_ulong2_L1UC_L3WB(global ulong2* it, int offset, ulong2 value)
{
    it[offset] = value;
}

void store_ulong2_L1WT_L3UC(global ulong2* it, int offset, ulong2 value)
{
    it[offset] = value;
}

void store_ulong2_L1WT_L3WB(global ulong2* it, int offset, ulong2 value)
{
    it[offset] = value;
}

void store_ulong2_L1S_L3UC(global ulong2* it, int offset, ulong2 value)
{
    it[offset] = value;
}

void store_ulong2_L1S_L3WB(global ulong2* it, int offset, ulong2 value)
{
    it[offset] = value;
}

void store_ulong2_L1WB_L3WB(global ulong2* it, int offset, ulong2 value)
{
    it[offset] = value;
}

// ulong3
void store_ulong3_L1UC_L3UC(global ulong3* it, int offset, ulong3 value)
{
    it[offset] = value;
}

void store_ulong3_L1UC_L3WB(global ulong3* it, int offset, ulong3 value)
{
    it[offset] = value;
}

void store_ulong3_L1WT_L3UC(global ulong3* it, int offset, ulong3 value)
{
    it[offset] = value;
}

void store_ulong3_L1WT_L3WB(global ulong3* it, int offset, ulong3 value)
{
    it[offset] = value;
}

void store_ulong3_L1S_L3UC(global ulong3* it, int offset, ulong3 value)
{
    it[offset] = value;
}

void store_ulong3_L1S_L3WB(global ulong3* it, int offset, ulong3 value)
{
    it[offset] = value;
}

void store_ulong3_L1WB_L3WB(global ulong3* it, int offset, ulong3 value)
{
    it[offset] = value;
}

// ulong4
void store_ulong4_L1UC_L3UC(global ulong4* it, int offset, ulong4 value)
{
    it[offset] = value;
}

void store_ulong4_L1UC_L3WB(global ulong4* it, int offset, ulong4 value)
{
    it[offset] = value;
}

void store_ulong4_L1WT_L3UC(global ulong4* it, int offset, ulong4 value)
{
    it[offset] = value;
}

void store_ulong4_L1WT_L3WB(global ulong4* it, int offset, ulong4 value)
{
    it[offset] = value;
}

void store_ulong4_L1S_L3UC(global ulong4* it, int offset, ulong4 value)
{
    it[offset] = value;
}

void store_ulong4_L1S_L3WB(global ulong4* it, int offset, ulong4 value)
{
    it[offset] = value;
}

void store_ulong4_L1WB_L3WB(global ulong4* it, int offset, ulong4 value)
{
    it[offset] = value;
}

// ulong8
void store_ulong8_L1UC_L3UC(global ulong8* it, int offset, ulong8 value)
{
    it[offset] = value;
}

void store_ulong8_L1UC_L3WB(global ulong8* it, int offset, ulong8 value)
{
    it[offset] = value;
}

void store_ulong8_L1WT_L3UC(global ulong8* it, int offset, ulong8 value)
{
    it[offset] = value;
}

void store_ulong8_L1WT_L3WB(global ulong8* it, int offset, ulong8 value)
{
    it[offset] = value;
}

void store_ulong8_L1S_L3UC(global ulong8* it, int offset, ulong8 value)
{
    it[offset] = value;
}

void store_ulong8_L1S_L3WB(global ulong8* it, int offset, ulong8 value)
{
    it[offset] = value;
}

void store_ulong8_L1WB_L3WB(global ulong8* it, int offset, ulong8 value)
{
    it[offset] = value;
}

// LSC Fence support
void mem_fence_gpu_default()
{
    write_mem_fence(CLK_GLOBAL_MEM_FENCE);
}

void mem_fence_workgroup_default()
{
    write_mem_fence( CLK_GLOBAL_MEM_FENCE );
}

void mem_fence_gpu_invalidate()
{
    read_mem_fence(CLK_GLOBAL_MEM_FENCE);
}

void mem_fence_gpu_evict()
{
    read_mem_fence(CLK_GLOBAL_MEM_FENCE);
}

void mem_fence_evict_to_memory()
{
    mem_fence(CLK_GLOBAL_MEM_FENCE);
}
