From 95252e29c6a333c4a1fb46322ab35adcde0d1331 Mon Sep 17 00:00:00 2001 From: "Maronas, Marcos" Date: Wed, 27 Nov 2024 18:03:37 +0100 Subject: [PATCH 01/11] [SPIR-V] Add support for cl_khr_extended_bit_ops extension --- llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp | 45 +++++++ llvm/lib/Target/SPIRV/SPIRVBuiltins.td | 7 ++ .../cl_khr_extended_bit_ops.ll | 114 ++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp index 73dce230575d8..d64d9177b4921 100644 --- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp @@ -983,6 +983,38 @@ static bool buildBarrierInst(const SPIRV::IncomingCall *Call, unsigned Opcode, return true; } +/// Helper function for building extended bit operations. +static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call, unsigned Opcode, + MachineIRBuilder &MIRBuilder, + SPIRVGlobalRegistry *GR) { + const SPIRV::DemangledBuiltin *Builtin = Call->Builtin; + const auto *ST = + static_cast(&MIRBuilder.getMF().getSubtarget()); + if ((Opcode == SPIRV::OpBitFieldInsert || + Opcode == SPIRV::OpBitFieldSExtract || + Opcode == SPIRV::OpBitFieldUExtract || + Opcode == SPIRV::OpBitReverse) && + !ST->canUseExtension(SPIRV::Extension::SPV_KHR_bit_instructions)) { + std::string DiagMsg = std::string(Builtin->Name) + + ": the builtin requires the following SPIR-V " + "extension: SPV_KHR_bit_instructions"; + report_fatal_error(DiagMsg.c_str(), false); + } + + // Generate SPIRV instruction accordingly. + if (Call->isSpirvOp()) + return buildOpFromWrapper(MIRBuilder, Opcode, Call, Register(0)); + + // Generate the instruction. + auto MIB = MIRBuilder.buildInstr(Opcode) + .addDef(Call->ReturnRegister) + .addUse(GR->getSPIRVTypeID(Call->ReturnType)); + for (unsigned i = 0; i < Call->Arguments.size(); ++i) + MIB.addUse(Call->Arguments[i]); + + return true; +} + static unsigned getNumComponentsForDim(SPIRV::Dim::Dim dim) { switch (dim) { case SPIRV::Dim::DIM_1D: @@ -2041,6 +2073,17 @@ static bool generateSpecConstantInst(const SPIRV::IncomingCall *Call, } } +static bool generateExtendedBitOpsInst(const SPIRV::IncomingCall *Call, + MachineIRBuilder &MIRBuilder, + SPIRVGlobalRegistry *GR) { + // Lookup the instruction opcode in the TableGen records. + const SPIRV::DemangledBuiltin *Builtin = Call->Builtin; + unsigned Opcode = + SPIRV::lookupNativeBuiltin(Builtin->Name, Builtin->Set)->Opcode; + + return buildExtendedBitOpsInst(Call, Opcode, MIRBuilder, GR); +} + static bool buildNDRange(const SPIRV::IncomingCall *Call, MachineIRBuilder &MIRBuilder, SPIRVGlobalRegistry *GR) { @@ -2628,6 +2671,8 @@ std::optional lowerBuiltin(const StringRef DemangledCall, return generateKernelClockInst(Call.get(), MIRBuilder, GR); case SPIRV::CoopMatr: return generateCoopMatrInst(Call.get(), MIRBuilder, GR); + case SPIRV::ExtendedBitOps: + return generateExtendedBitOpsInst(Call.get(), MIRBuilder, GR); } return false; } diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.td b/llvm/lib/Target/SPIRV/SPIRVBuiltins.td index e0dfc25723b0c..9cc16ea8c9183 100644 --- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.td +++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.td @@ -64,6 +64,7 @@ def CastToPtr : BuiltinGroup; def Construct : BuiltinGroup; def CoopMatr : BuiltinGroup; def ICarryBorrow : BuiltinGroup; +def ExtendedBitOps : BuiltinGroup; //===----------------------------------------------------------------------===// // Class defining a demangled builtin record. The information in the record @@ -1441,6 +1442,12 @@ defm : DemangledNativeBuiltin<"__spirv_SatConvertSToU", OpenCL_std, Convert, 1, defm : DemangledNativeBuiltin<"__spirv_SatConvertUToS", OpenCL_std, Convert, 1, 1, OpSatConvertUToS>; defm : DemangledNativeBuiltin<"__spirv_ConvertUToPtr", OpenCL_std, Convert, 1, 1, OpConvertUToPtr>; +// cl_khr_extended_bit_ops / SPV_KHR_bit_instructions +defm : DemangledNativeBuiltin<"bitfield_insert", OpenCL_std, ExtendedBitOps, 4, 4, OpBitFieldInsert>; +defm : DemangledNativeBuiltin<"bitfield_extract_signed", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldSExtract>; +defm : DemangledNativeBuiltin<"bitfield_extract_unsigned", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldUExtract>; +defm : DemangledNativeBuiltin<"bit_reverse", OpenCL_std, ExtendedBitOps, 1, 1, OpBitReverse>; + // cl_intel_bfloat16_conversions / SPV_INTEL_bfloat16_conversion // Multiclass used to define at the same time both a demangled builtin records // and a corresponding convert builtin records. diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll new file mode 100644 index 0000000000000..e447bdf11616e --- /dev/null +++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll @@ -0,0 +1,114 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-EXTENSION +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTENSION +; ModuleID = 'cl_khr_extended_bit_ops.cl.tmp.bc' +source_filename = "cl_khr_extended_bit_ops.cl" +target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1" +target triple = "spir-unknown-unknown" + +; CHECK-EXTENSION: Capability BitInstructions +; CHECK-EXTENSION: Extension "SPV_KHR_bit_instructions" +; CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase]] %[[#insertinsert]] +; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) +define dso_local spir_kernel void @testInsert(<2 x i32> noundef %b, <2 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !5 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 { +entry: + %call = tail call spir_func <2 x i32> @_Z15bitfield_insertDv2_iS_jj(<2 x i32> noundef %b, <2 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <2 x i32> %call, ptr addrspace(1) %res, align 8, !tbaa !9 + ret void +} + +; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) +declare spir_func <2 x i32> @_Z15bitfield_insertDv2_iS_jj(<2 x i32> noundef, <2 x i32> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) +define dso_local spir_kernel void @testExtractS(i16 noundef signext %b, i16 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 2 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !12 !kernel_arg_base_type !12 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 { +entry: + %call = tail call spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i16 %call1, %call + store i16 %add, ptr addrspace(1) %res, align 2, !tbaa !13 + ret void +} + +; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) +declare spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext, i32 noundef, i32 noundef) local_unnamed_addr #1 + +; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) +declare spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext, i32 noundef, i32 noundef) local_unnamed_addr #1 + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) +define dso_local spir_kernel void @testExtractU(<8 x i8> noundef %b, <8 x i8> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !15 !kernel_arg_base_type !16 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 { +entry: + %call = tail call spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_cjj(<8 x i8> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_hjj(<8 x i8> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <8 x i8> %call1, %call + store <8 x i8> %add, ptr addrspace(1) %res, align 8, !tbaa !9 + ret void +} + +; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) +declare spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_cjj(<8 x i8> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 + +; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) +declare spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_hjj(<8 x i8> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) +define dso_local spir_kernel void @testBitReverse(<4 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 %res) local_unnamed_addr #0 !kernel_arg_addr_space !17 !kernel_arg_access_qual !18 !kernel_arg_type !19 !kernel_arg_base_type !20 !kernel_arg_type_qual !21 !kernel_arg_host_accessible !22 !kernel_arg_pipe_depth !23 !kernel_arg_pipe_io !21 !kernel_arg_buffer_location !21 { +entry: + %call = tail call spir_func <4 x i64> @_Z11bit_reverseDv4_m(<4 x i64> noundef %b) #2 + store <4 x i64> %call, ptr addrspace(1) %res, align 32, !tbaa !9 + ret void +} + +; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) +declare spir_func <4 x i64> @_Z11bit_reverseDv4_m(<4 x i64> noundef) local_unnamed_addr #1 + +attributes #0 = { convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="false" } +attributes #1 = { convergent mustprogress nofree nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" } +attributes #2 = { convergent nounwind willreturn memory(none) } + +!opencl.ocl.version = !{!0} +!opencl.spir.version = !{!0} +!llvm.ident = !{!1} + +!0 = !{i32 2, i32 0} +!1 = !{!"Intel(R) oneAPI DPC++/C++ Compiler 2025.1.0 (2025.x.0.YYYYMMDD)"} +!2 = !{i32 0, i32 0, i32 1} +!3 = !{!"none", !"none", !"none"} +!4 = !{!"int2", !"int2", !"int2*"} +!5 = !{!"int __attribute__((ext_vector_type(2)))", !"int __attribute__((ext_vector_type(2)))", !"int __attribute__((ext_vector_type(2)))*"} +!6 = !{!"", !"", !""} +!7 = !{i1 false, i1 false, i1 false} +!8 = !{i32 0, i32 0, i32 0} +!9 = !{!10, !10, i64 0} +!10 = !{!"omnipotent char", !11, i64 0} +!11 = !{!"Simple C/C++ TBAA"} +!12 = !{!"short", !"ushort", !"short*"} +!13 = !{!14, !14, i64 0} +!14 = !{!"short", !10, i64 0} +!15 = !{!"char8", !"uchar8", !"uchar8*"} +!16 = !{!"char __attribute__((ext_vector_type(8)))", !"uchar __attribute__((ext_vector_type(8)))", !"uchar __attribute__((ext_vector_type(8)))*"} +!17 = !{i32 0, i32 1} +!18 = !{!"none", !"none"} +!19 = !{!"ulong4", !"ulong4*"} +!20 = !{!"ulong __attribute__((ext_vector_type(4)))", !"ulong __attribute__((ext_vector_type(4)))*"} +!21 = !{!"", !""} +!22 = !{i1 false, i1 false} +!23 = !{i32 0, i32 0} \ No newline at end of file From debfc1f5ef682cbf2b44ddcacc0b1a7c6bda5599 Mon Sep 17 00:00:00 2001 From: "Maronas, Marcos" Date: Wed, 18 Dec 2024 13:14:09 +0100 Subject: [PATCH 02/11] Change test from .ll file to .cl file. --- .../cl_khr_extended_bit_ops.cl | 909 ++++++++++++++++++ .../cl_khr_extended_bit_ops.ll | 114 --- llvm/test/lit.cfg.py | 4 +- 3 files changed, 912 insertions(+), 115 deletions(-) create mode 100644 llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl delete mode 100644 llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl new file mode 100644 index 0000000000000..4788c4c9f1251 --- /dev/null +++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl @@ -0,0 +1,909 @@ +// RUN: %clang_cc1 -triple spir-unknown-unknown -O1 -cl-std=CL2.0 -fdeclare-opencl-builtins -finclude-default-header -emit-llvm-bc %s -o %t.bc +// RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %t.bc --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-EXTENSION +// RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %t.bc -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTENSION + +// CHECK-SPIRV: Capability BitInstructions +// CHECK-SPIRV: Extension "SPV_KHR_bit_instructions" +// CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_long:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long]] %[[#insertinsert_long]]kernel void testInsert_long(long b, long i, global long *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ulong:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong]] %[[#insertinsert_ulong]]kernel void testInsert_ulong(ulong b, ulong i, global ulong *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_int:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int]] %[[#insertinsert_int]]kernel void testInsert_int(int b, int i, global int *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_uint:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint]] %[[#insertinsert_uint]]kernel void testInsert_uint(uint b, uint i, global uint *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_short:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short]] %[[#insertinsert_short]]kernel void testInsert_short(short b, short i, global short *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ushort:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort]] %[[#insertinsert_ushort]]kernel void testInsert_ushort(ushort b, ushort i, global ushort *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_long2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long2]] %[[#insertinsert_long2]]kernel void testInsert_long2(long2 b, long2 i, global long2 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ulong2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong2]] %[[#insertinsert_ulong2]]kernel void testInsert_ulong2(ulong2 b, ulong2 i, global ulong2 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_int2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int2]] %[[#insertinsert_int2]]kernel void testInsert_int2(int2 b, int2 i, global int2 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_uint2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint2]] %[[#insertinsert_uint2]]kernel void testInsert_uint2(uint2 b, uint2 i, global uint2 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_short2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short2]] %[[#insertinsert_short2]]kernel void testInsert_short2(short2 b, short2 i, global short2 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ushort2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort2]] %[[#insertinsert_ushort2]]kernel void testInsert_ushort2(ushort2 b, ushort2 i, global ushort2 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_char2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char2]] %[[#insertinsert_char2]]kernel void testInsert_char2(char2 b, char2 i, global char2 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_uchar2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar2]] %[[#insertinsert_uchar2]]kernel void testInsert_uchar2(uchar2 b, uchar2 i, global uchar2 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_long3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long3]] %[[#insertinsert_long3]]kernel void testInsert_long3(long3 b, long3 i, global long3 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ulong3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong3]] %[[#insertinsert_ulong3]]kernel void testInsert_ulong3(ulong3 b, ulong3 i, global ulong3 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_int3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int3]] %[[#insertinsert_int3]]kernel void testInsert_int3(int3 b, int3 i, global int3 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_uint3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint3]] %[[#insertinsert_uint3]]kernel void testInsert_uint3(uint3 b, uint3 i, global uint3 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_short3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short3]] %[[#insertinsert_short3]]kernel void testInsert_short3(short3 b, short3 i, global short3 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ushort3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort3]] %[[#insertinsert_ushort3]]kernel void testInsert_ushort3(ushort3 b, ushort3 i, global ushort3 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_char3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char3]] %[[#insertinsert_char3]]kernel void testInsert_char3(char3 b, char3 i, global char3 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_uchar3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar3]] %[[#insertinsert_uchar3]]kernel void testInsert_uchar3(uchar3 b, uchar3 i, global uchar3 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_long4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long4]] %[[#insertinsert_long4]]kernel void testInsert_long4(long4 b, long4 i, global long4 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ulong4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong4]] %[[#insertinsert_ulong4]]kernel void testInsert_ulong4(ulong4 b, ulong4 i, global ulong4 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_int4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int4]] %[[#insertinsert_int4]]kernel void testInsert_int4(int4 b, int4 i, global int4 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_uint4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint4]] %[[#insertinsert_uint4]]kernel void testInsert_uint4(uint4 b, uint4 i, global uint4 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_short4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short4]] %[[#insertinsert_short4]]kernel void testInsert_short4(short4 b, short4 i, global short4 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ushort4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort4]] %[[#insertinsert_ushort4]]kernel void testInsert_ushort4(ushort4 b, ushort4 i, global ushort4 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_char4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char4]] %[[#insertinsert_char4]]kernel void testInsert_char4(char4 b, char4 i, global char4 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_uchar4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar4]] %[[#insertinsert_uchar4]]kernel void testInsert_uchar4(uchar4 b, uchar4 i, global uchar4 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_long8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long8]] %[[#insertinsert_long8]]kernel void testInsert_long8(long8 b, long8 i, global long8 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ulong8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong8]] %[[#insertinsert_ulong8]]kernel void testInsert_ulong8(ulong8 b, ulong8 i, global ulong8 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_int8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int8]] %[[#insertinsert_int8]]kernel void testInsert_int8(int8 b, int8 i, global int8 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_uint8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint8]] %[[#insertinsert_uint8]]kernel void testInsert_uint8(uint8 b, uint8 i, global uint8 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_short8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short8]] %[[#insertinsert_short8]]kernel void testInsert_short8(short8 b, short8 i, global short8 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ushort8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort8]] %[[#insertinsert_ushort8]]kernel void testInsert_ushort8(ushort8 b, ushort8 i, global ushort8 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_char8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char8]] %[[#insertinsert_char8]]kernel void testInsert_char8(char8 b, char8 i, global char8 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_uchar8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar8]] %[[#insertinsert_uchar8]]kernel void testInsert_uchar8(uchar8 b, uchar8 i, global uchar8 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_long16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long16]] %[[#insertinsert_long16]]kernel void testInsert_long16(long16 b, long16 i, global long16 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ulong16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong16]] %[[#insertinsert_ulong16]]kernel void testInsert_ulong16(ulong16 b, ulong16 i, global ulong16 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_int16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int16]] %[[#insertinsert_int16]]kernel void testInsert_int16(int16 b, int16 i, global int16 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_uint16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint16]] %[[#insertinsert_uint16]]kernel void testInsert_uint16(uint16 b, uint16 i, global uint16 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_short16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short16]] %[[#insertinsert_short16]]kernel void testInsert_short16(short16 b, short16 i, global short16 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_ushort16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort16]] %[[#insertinsert_ushort16]]kernel void testInsert_ushort16(ushort16 b, ushort16 i, global ushort16 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_char16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char16]] %[[#insertinsert_char16]]kernel void testInsert_char16(char16 b, char16 i, global char16 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#insertbase_uchar16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar16]] %[[#insertinsert_uchar16]]kernel void testInsert_uchar16(uchar16 b, uchar16 i, global uchar16 *res) { + *res = bitfield_insert(b, i, 4, 2); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_long(long b, ulong bu, global long *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_int(int b, uint bu, global int *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_short(short b, ushort bu, global short *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_char(char b, uchar bu, global char *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_long2(long b, ulong bu, global long *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_int2(int b, uint bu, global int *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_short2(short b, ushort bu, global short *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_char2(char b, uchar bu, global char *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_long3(long b, ulong bu, global long *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_int3(int b, uint bu, global int *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_short3(short b, ushort bu, global short *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_char3(char b, uchar bu, global char *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_long4(long b, ulong bu, global long *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_int4(int b, uint bu, global int *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_short4(short b, ushort bu, global short *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_char4(char b, uchar bu, global char *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_long8(long b, ulong bu, global long *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_int8(int b, uint bu, global int *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_short8(short b, ushort bu, global short *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_char8(char b, uchar bu, global char *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_long16(long b, ulong bu, global long *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_int16(int b, uint bu, global int *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_short16(short b, ushort bu, global short *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +kernel void testExtractS_char16(char b, uchar bu, global char *res) { + *res = bitfield_extract_signed(b, 5, 4); + *res += bitfield_extract_signed(bu, 5, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_long(long b, ulong bu, global ulong *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_int(int b, uint bu, global uint *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_short(short b, ushort bu, global ushort *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_char(char b, uchar bu, global uchar *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_long2(long2 b, ulong2 bu, global ulong2 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_int2(int2 b, uint2 bu, global uint2 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_short2(short2 b, ushort2 bu, global ushort2 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_char2(char2 b, uchar2 bu, global uchar2 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_long3(long3 b, ulong3 bu, global ulong3 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_int3(int3 b, uint3 bu, global uint3 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_short3(short3 b, ushort3 bu, global ushort3 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_char3(char3 b, uchar3 bu, global uchar3 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_long4(long4 b, ulong4 bu, global ulong4 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_int4(int4 b, uint4 bu, global uint4 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_short4(short4 b, ushort4 bu, global ushort4 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_char4(char4 b, uchar4 bu, global uchar4 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_long8(long8 b, ulong8 bu, global ulong8 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_int8(int8 b, uint8 bu, global uint8 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_short8(short8 b, ushort8 bu, global ushort8 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_char8(char8 b, uchar8 bu, global uchar8 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_long16(long16 b, ulong16 bu, global ulong16 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_int16(int16 b, uint16 bu, global uint16 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_short16(short16 b, ushort16 bu, global ushort16 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +kernel void testExtractU_char16(char16 b, uchar16 bu, global uchar16 *res) { + *res = bitfield_extract_unsigned(b, 3, 4); + *res += bitfield_extract_unsigned(bu, 3, 4); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_long(long b, global long *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ulong(ulong b, global ulong *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_int(int b, global int *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uint(uint b, global uint *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_short(short b, global short *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ushort(ushort b, global ushort *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_char(char b, global char *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uchar(uchar b, global uchar *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_long2(long2 b, global long2 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ulong2(ulong2 b, global ulong2 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_int2(int2 b, global int2 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uint2(uint2 b, global uint2 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_short2(short2 b, global short2 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ushort2(ushort2 b, global ushort2 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_char2(char2 b, global char2 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uchar2(uchar2 b, global uchar2 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_long3(long3 b, global long3 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ulong3(ulong3 b, global ulong3 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_int3(int3 b, global int3 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uint3(uint3 b, global uint3 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_short3(short3 b, global short3 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ushort3(ushort3 b, global ushort3 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_char3(char3 b, global char3 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uchar3(uchar3 b, global uchar3 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_long4(long4 b, global long4 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ulong4(ulong4 b, global ulong4 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_int4(int4 b, global int4 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uint4(uint4 b, global uint4 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_short4(short4 b, global short4 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ushort4(ushort4 b, global ushort4 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_char4(char4 b, global char4 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uchar4(uchar4 b, global uchar4 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_long8(long8 b, global long8 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ulong8(ulong8 b, global ulong8 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_int8(int8 b, global int8 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uint8(uint8 b, global uint8 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_short8(short8 b, global short8 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ushort8(ushort8 b, global ushort8 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_char8(char8 b, global char8 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uchar8(uchar8 b, global uchar8 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_long16(long16 b, global long16 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ulong16(ulong16 b, global ulong16 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_int16(int16 b, global int16 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uint16(uint16 b, global uint16 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_short16(short16 b, global short16 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_ushort16(ushort16 b, global ushort16 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_char16(char16 b, global char16 *res) { + *res = bit_reverse(b); +} + +// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +kernel void testBitReverse_uchar16(uchar16 b, global uchar16 *res) { + *res = bit_reverse(b); +} diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll deleted file mode 100644 index e447bdf11616e..0000000000000 --- a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll +++ /dev/null @@ -1,114 +0,0 @@ -; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-EXTENSION -; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTENSION -; ModuleID = 'cl_khr_extended_bit_ops.cl.tmp.bc' -source_filename = "cl_khr_extended_bit_ops.cl" -target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1" -target triple = "spir-unknown-unknown" - -; CHECK-EXTENSION: Capability BitInstructions -; CHECK-EXTENSION: Extension "SPV_KHR_bit_instructions" -; CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions - -; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -; CHECK-EXTENSION: %[[#insertbase:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#insertinsert:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase]] %[[#insertinsert]] -; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) -define dso_local spir_kernel void @testInsert(<2 x i32> noundef %b, <2 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !5 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 { -entry: - %call = tail call spir_func <2 x i32> @_Z15bitfield_insertDv2_iS_jj(<2 x i32> noundef %b, <2 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 - store <2 x i32> %call, ptr addrspace(1) %res, align 8, !tbaa !9 - ret void -} - -; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) -declare spir_func <2 x i32> @_Z15bitfield_insertDv2_iS_jj(<2 x i32> noundef, <2 x i32> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 - -; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) -define dso_local spir_kernel void @testExtractS(i16 noundef signext %b, i16 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 2 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !12 !kernel_arg_base_type !12 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 { -entry: - %call = tail call spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 - %call1 = tail call spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 - %add = add i16 %call1, %call - store i16 %add, ptr addrspace(1) %res, align 2, !tbaa !13 - ret void -} - -; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) -declare spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext, i32 noundef, i32 noundef) local_unnamed_addr #1 - -; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) -declare spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext, i32 noundef, i32 noundef) local_unnamed_addr #1 - -; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) -define dso_local spir_kernel void @testExtractU(<8 x i8> noundef %b, <8 x i8> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !15 !kernel_arg_base_type !16 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 { -entry: - %call = tail call spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_cjj(<8 x i8> noundef %b, i32 noundef 3, i32 noundef 4) #2 - %call1 = tail call spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_hjj(<8 x i8> noundef %bu, i32 noundef 3, i32 noundef 4) #2 - %add = add <8 x i8> %call1, %call - store <8 x i8> %add, ptr addrspace(1) %res, align 8, !tbaa !9 - ret void -} - -; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) -declare spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_cjj(<8 x i8> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 - -; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) -declare spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_hjj(<8 x i8> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 - -; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) -define dso_local spir_kernel void @testBitReverse(<4 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 %res) local_unnamed_addr #0 !kernel_arg_addr_space !17 !kernel_arg_access_qual !18 !kernel_arg_type !19 !kernel_arg_base_type !20 !kernel_arg_type_qual !21 !kernel_arg_host_accessible !22 !kernel_arg_pipe_depth !23 !kernel_arg_pipe_io !21 !kernel_arg_buffer_location !21 { -entry: - %call = tail call spir_func <4 x i64> @_Z11bit_reverseDv4_m(<4 x i64> noundef %b) #2 - store <4 x i64> %call, ptr addrspace(1) %res, align 32, !tbaa !9 - ret void -} - -; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) -declare spir_func <4 x i64> @_Z11bit_reverseDv4_m(<4 x i64> noundef) local_unnamed_addr #1 - -attributes #0 = { convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="false" } -attributes #1 = { convergent mustprogress nofree nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" } -attributes #2 = { convergent nounwind willreturn memory(none) } - -!opencl.ocl.version = !{!0} -!opencl.spir.version = !{!0} -!llvm.ident = !{!1} - -!0 = !{i32 2, i32 0} -!1 = !{!"Intel(R) oneAPI DPC++/C++ Compiler 2025.1.0 (2025.x.0.YYYYMMDD)"} -!2 = !{i32 0, i32 0, i32 1} -!3 = !{!"none", !"none", !"none"} -!4 = !{!"int2", !"int2", !"int2*"} -!5 = !{!"int __attribute__((ext_vector_type(2)))", !"int __attribute__((ext_vector_type(2)))", !"int __attribute__((ext_vector_type(2)))*"} -!6 = !{!"", !"", !""} -!7 = !{i1 false, i1 false, i1 false} -!8 = !{i32 0, i32 0, i32 0} -!9 = !{!10, !10, i64 0} -!10 = !{!"omnipotent char", !11, i64 0} -!11 = !{!"Simple C/C++ TBAA"} -!12 = !{!"short", !"ushort", !"short*"} -!13 = !{!14, !14, i64 0} -!14 = !{!"short", !10, i64 0} -!15 = !{!"char8", !"uchar8", !"uchar8*"} -!16 = !{!"char __attribute__((ext_vector_type(8)))", !"uchar __attribute__((ext_vector_type(8)))", !"uchar __attribute__((ext_vector_type(8)))*"} -!17 = !{i32 0, i32 1} -!18 = !{!"none", !"none"} -!19 = !{!"ulong4", !"ulong4*"} -!20 = !{!"ulong __attribute__((ext_vector_type(4)))", !"ulong __attribute__((ext_vector_type(4)))*"} -!21 = !{!"", !""} -!22 = !{i1 false, i1 false} -!23 = !{i32 0, i32 0} \ No newline at end of file diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index 5a03a85386e0a..0d2e414d1d9f8 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -22,7 +22,7 @@ # suffixes: A list of file extensions to treat as test files. This is overriden # by individual lit.local.cfg files in the test subdirectories. -config.suffixes = [".ll", ".c", ".test", ".txt", ".s", ".mir", ".yaml", ".spv"] +config.suffixes = [".ll", ".c", ".test", ".txt", ".s", ".mir", ".yaml", ".spv", ".cl"] # excludes: A list of directories to exclude from the testsuite. The 'Inputs' # subdirectories contain auxiliary inputs for various tests in their parent @@ -35,6 +35,8 @@ # test_exec_root: The root path where tests should be run. config.test_exec_root = os.path.join(config.llvm_obj_root, "test") +llvm_config.use_clang() + # Tweak the PATH to include the tools dir. llvm_config.with_environment("PATH", config.llvm_tools_dir, append_path=True) From cc61409d353a40f62d3a137f3c7436aa00df779d Mon Sep 17 00:00:00 2001 From: "Maronas, Marcos" Date: Wed, 18 Dec 2024 13:15:36 +0100 Subject: [PATCH 03/11] Add __spirv_CODE wrappers for extended bit instructions. --- llvm/lib/Target/SPIRV/SPIRVBuiltins.td | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.td b/llvm/lib/Target/SPIRV/SPIRVBuiltins.td index 9cc16ea8c9183..9a146b331ffc1 100644 --- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.td +++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.td @@ -1444,9 +1444,13 @@ defm : DemangledNativeBuiltin<"__spirv_ConvertUToPtr", OpenCL_std, Convert, 1, 1 // cl_khr_extended_bit_ops / SPV_KHR_bit_instructions defm : DemangledNativeBuiltin<"bitfield_insert", OpenCL_std, ExtendedBitOps, 4, 4, OpBitFieldInsert>; +defm : DemangledNativeBuiltin<"__spirv_BitFieldInsert", OpenCL_std, ExtendedBitOps, 4, 4, OpBitFieldInsert>; defm : DemangledNativeBuiltin<"bitfield_extract_signed", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldSExtract>; +defm : DemangledNativeBuiltin<"__spirv_BitFieldSExtract", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldSExtract>; defm : DemangledNativeBuiltin<"bitfield_extract_unsigned", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldUExtract>; +defm : DemangledNativeBuiltin<"__spirv_BitFieldUExtract", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldUExtract>; defm : DemangledNativeBuiltin<"bit_reverse", OpenCL_std, ExtendedBitOps, 1, 1, OpBitReverse>; +defm : DemangledNativeBuiltin<"__spirv_BitReverse", OpenCL_std, ExtendedBitOps, 1, 1, OpBitReverse>; // cl_intel_bfloat16_conversions / SPV_INTEL_bfloat16_conversion // Multiclass used to define at the same time both a demangled builtin records From 8a11b979ce6f8788e968e89ace6463200f091119 Mon Sep 17 00:00:00 2001 From: "Maronas, Marcos" Date: Thu, 19 Dec 2024 13:36:01 +0100 Subject: [PATCH 04/11] Undo changes on higher level directory LIT config. --- .../cl_khr_extended_bit_ops.cl | 566 +++++++++++++----- llvm/test/CodeGen/SPIRV/lit.local.cfg | 6 + llvm/test/lit.cfg.py | 4 +- 3 files changed, 431 insertions(+), 145 deletions(-) diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl index 4788c4c9f1251..4f7fd131f6f9a 100644 --- a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl +++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl @@ -7,237 +7,377 @@ // CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long]] %[[#insertinsert_long]]kernel void testInsert_long(long b, long i, global long *res) { +// CHECK-EXTENSION: %[[#insertbase_long:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_long:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long]] %[[#insertinsert_long]] +kernel void testInsert_long(long b, long i, global long *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong]] %[[#insertinsert_ulong]]kernel void testInsert_ulong(ulong b, ulong i, global ulong *res) { +// CHECK-EXTENSION: %[[#insertbase_ulong:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ulong:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong]] %[[#insertinsert_ulong]] +kernel void testInsert_ulong(ulong b, ulong i, global ulong *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int]] %[[#insertinsert_int]]kernel void testInsert_int(int b, int i, global int *res) { +// CHECK-EXTENSION: %[[#insertbase_int:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_int:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int]] %[[#insertinsert_int]] +kernel void testInsert_int(int b, int i, global int *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint]] %[[#insertinsert_uint]]kernel void testInsert_uint(uint b, uint i, global uint *res) { +// CHECK-EXTENSION: %[[#insertbase_uint:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_uint:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint]] %[[#insertinsert_uint]] +kernel void testInsert_uint(uint b, uint i, global uint *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short]] %[[#insertinsert_short]]kernel void testInsert_short(short b, short i, global short *res) { +// CHECK-EXTENSION: %[[#insertbase_short:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_short:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short]] %[[#insertinsert_short]] +kernel void testInsert_short(short b, short i, global short *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort]] %[[#insertinsert_ushort]]kernel void testInsert_ushort(ushort b, ushort i, global ushort *res) { +// CHECK-EXTENSION: %[[#insertbase_ushort:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ushort:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort]] %[[#insertinsert_ushort]] +kernel void testInsert_ushort(ushort b, ushort i, global ushort *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long2]] %[[#insertinsert_long2]]kernel void testInsert_long2(long2 b, long2 i, global long2 *res) { +// CHECK-EXTENSION: %[[#insertbase_long2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_long2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long2]] %[[#insertinsert_long2]] +kernel void testInsert_long2(long2 b, long2 i, global long2 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong2]] %[[#insertinsert_ulong2]]kernel void testInsert_ulong2(ulong2 b, ulong2 i, global ulong2 *res) { +// CHECK-EXTENSION: %[[#insertbase_ulong2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ulong2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong2]] %[[#insertinsert_ulong2]] +kernel void testInsert_ulong2(ulong2 b, ulong2 i, global ulong2 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int2]] %[[#insertinsert_int2]]kernel void testInsert_int2(int2 b, int2 i, global int2 *res) { +// CHECK-EXTENSION: %[[#insertbase_int2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_int2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int2]] %[[#insertinsert_int2]] +kernel void testInsert_int2(int2 b, int2 i, global int2 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint2]] %[[#insertinsert_uint2]]kernel void testInsert_uint2(uint2 b, uint2 i, global uint2 *res) { +// CHECK-EXTENSION: %[[#insertbase_uint2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_uint2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint2]] %[[#insertinsert_uint2]] +kernel void testInsert_uint2(uint2 b, uint2 i, global uint2 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short2]] %[[#insertinsert_short2]]kernel void testInsert_short2(short2 b, short2 i, global short2 *res) { +// CHECK-EXTENSION: %[[#insertbase_short2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_short2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short2]] %[[#insertinsert_short2]] +kernel void testInsert_short2(short2 b, short2 i, global short2 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort2]] %[[#insertinsert_ushort2]]kernel void testInsert_ushort2(ushort2 b, ushort2 i, global ushort2 *res) { +// CHECK-EXTENSION: %[[#insertbase_ushort2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ushort2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort2]] %[[#insertinsert_ushort2]] +kernel void testInsert_ushort2(ushort2 b, ushort2 i, global ushort2 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_char2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char2]] %[[#insertinsert_char2]]kernel void testInsert_char2(char2 b, char2 i, global char2 *res) { +// CHECK-EXTENSION: %[[#insertbase_char2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_char2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char2]] %[[#insertinsert_char2]] +kernel void testInsert_char2(char2 b, char2 i, global char2 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uchar2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar2]] %[[#insertinsert_uchar2]]kernel void testInsert_uchar2(uchar2 b, uchar2 i, global uchar2 *res) { +// CHECK-EXTENSION: %[[#insertbase_uchar2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_uchar2:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar2]] %[[#insertinsert_uchar2]] +kernel void testInsert_uchar2(uchar2 b, uchar2 i, global uchar2 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long3]] %[[#insertinsert_long3]]kernel void testInsert_long3(long3 b, long3 i, global long3 *res) { +// CHECK-EXTENSION: %[[#insertbase_long3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_long3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long3]] %[[#insertinsert_long3]] +kernel void testInsert_long3(long3 b, long3 i, global long3 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong3]] %[[#insertinsert_ulong3]]kernel void testInsert_ulong3(ulong3 b, ulong3 i, global ulong3 *res) { +// CHECK-EXTENSION: %[[#insertbase_ulong3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ulong3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong3]] %[[#insertinsert_ulong3]] +kernel void testInsert_ulong3(ulong3 b, ulong3 i, global ulong3 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int3]] %[[#insertinsert_int3]]kernel void testInsert_int3(int3 b, int3 i, global int3 *res) { +// CHECK-EXTENSION: %[[#insertbase_int3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_int3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int3]] %[[#insertinsert_int3]] +kernel void testInsert_int3(int3 b, int3 i, global int3 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint3]] %[[#insertinsert_uint3]]kernel void testInsert_uint3(uint3 b, uint3 i, global uint3 *res) { +// CHECK-EXTENSION: %[[#insertbase_uint3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_uint3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint3]] %[[#insertinsert_uint3]] +kernel void testInsert_uint3(uint3 b, uint3 i, global uint3 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short3]] %[[#insertinsert_short3]]kernel void testInsert_short3(short3 b, short3 i, global short3 *res) { +// CHECK-EXTENSION: %[[#insertbase_short3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_short3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short3]] %[[#insertinsert_short3]] +kernel void testInsert_short3(short3 b, short3 i, global short3 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort3]] %[[#insertinsert_ushort3]]kernel void testInsert_ushort3(ushort3 b, ushort3 i, global ushort3 *res) { +// CHECK-EXTENSION: %[[#insertbase_ushort3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ushort3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort3]] %[[#insertinsert_ushort3]] +kernel void testInsert_ushort3(ushort3 b, ushort3 i, global ushort3 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_char3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char3]] %[[#insertinsert_char3]]kernel void testInsert_char3(char3 b, char3 i, global char3 *res) { +// CHECK-EXTENSION: %[[#insertbase_char3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_char3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char3]] %[[#insertinsert_char3]] +kernel void testInsert_char3(char3 b, char3 i, global char3 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uchar3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar3]] %[[#insertinsert_uchar3]]kernel void testInsert_uchar3(uchar3 b, uchar3 i, global uchar3 *res) { +// CHECK-EXTENSION: %[[#insertbase_uchar3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_uchar3:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar3]] %[[#insertinsert_uchar3]] +kernel void testInsert_uchar3(uchar3 b, uchar3 i, global uchar3 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long4]] %[[#insertinsert_long4]]kernel void testInsert_long4(long4 b, long4 i, global long4 *res) { +// CHECK-EXTENSION: %[[#insertbase_long4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_long4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long4]] %[[#insertinsert_long4]] +kernel void testInsert_long4(long4 b, long4 i, global long4 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong4]] %[[#insertinsert_ulong4]]kernel void testInsert_ulong4(ulong4 b, ulong4 i, global ulong4 *res) { +// CHECK-EXTENSION: %[[#insertbase_ulong4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ulong4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong4]] %[[#insertinsert_ulong4]] +kernel void testInsert_ulong4(ulong4 b, ulong4 i, global ulong4 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int4]] %[[#insertinsert_int4]]kernel void testInsert_int4(int4 b, int4 i, global int4 *res) { +// CHECK-EXTENSION: %[[#insertbase_int4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_int4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int4]] %[[#insertinsert_int4]] +kernel void testInsert_int4(int4 b, int4 i, global int4 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint4]] %[[#insertinsert_uint4]]kernel void testInsert_uint4(uint4 b, uint4 i, global uint4 *res) { +// CHECK-EXTENSION: %[[#insertbase_uint4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_uint4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint4]] %[[#insertinsert_uint4]] +kernel void testInsert_uint4(uint4 b, uint4 i, global uint4 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short4]] %[[#insertinsert_short4]]kernel void testInsert_short4(short4 b, short4 i, global short4 *res) { +// CHECK-EXTENSION: %[[#insertbase_short4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_short4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short4]] %[[#insertinsert_short4]] +kernel void testInsert_short4(short4 b, short4 i, global short4 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort4]] %[[#insertinsert_ushort4]]kernel void testInsert_ushort4(ushort4 b, ushort4 i, global ushort4 *res) { +// CHECK-EXTENSION: %[[#insertbase_ushort4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ushort4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort4]] %[[#insertinsert_ushort4]] +kernel void testInsert_ushort4(ushort4 b, ushort4 i, global ushort4 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_char4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char4]] %[[#insertinsert_char4]]kernel void testInsert_char4(char4 b, char4 i, global char4 *res) { +// CHECK-EXTENSION: %[[#insertbase_char4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_char4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char4]] %[[#insertinsert_char4]] +kernel void testInsert_char4(char4 b, char4 i, global char4 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uchar4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar4]] %[[#insertinsert_uchar4]]kernel void testInsert_uchar4(uchar4 b, uchar4 i, global uchar4 *res) { +// CHECK-EXTENSION: %[[#insertbase_uchar4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_uchar4:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar4]] %[[#insertinsert_uchar4]] +kernel void testInsert_uchar4(uchar4 b, uchar4 i, global uchar4 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long8]] %[[#insertinsert_long8]]kernel void testInsert_long8(long8 b, long8 i, global long8 *res) { +// CHECK-EXTENSION: %[[#insertbase_long8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_long8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long8]] %[[#insertinsert_long8]] +kernel void testInsert_long8(long8 b, long8 i, global long8 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong8]] %[[#insertinsert_ulong8]]kernel void testInsert_ulong8(ulong8 b, ulong8 i, global ulong8 *res) { +// CHECK-EXTENSION: %[[#insertbase_ulong8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ulong8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong8]] %[[#insertinsert_ulong8]] +kernel void testInsert_ulong8(ulong8 b, ulong8 i, global ulong8 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int8]] %[[#insertinsert_int8]]kernel void testInsert_int8(int8 b, int8 i, global int8 *res) { +// CHECK-EXTENSION: %[[#insertbase_int8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_int8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int8]] %[[#insertinsert_int8]] +kernel void testInsert_int8(int8 b, int8 i, global int8 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint8]] %[[#insertinsert_uint8]]kernel void testInsert_uint8(uint8 b, uint8 i, global uint8 *res) { +// CHECK-EXTENSION: %[[#insertbase_uint8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_uint8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint8]] %[[#insertinsert_uint8]] +kernel void testInsert_uint8(uint8 b, uint8 i, global uint8 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short8]] %[[#insertinsert_short8]]kernel void testInsert_short8(short8 b, short8 i, global short8 *res) { +// CHECK-EXTENSION: %[[#insertbase_short8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_short8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short8]] %[[#insertinsert_short8]] +kernel void testInsert_short8(short8 b, short8 i, global short8 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort8]] %[[#insertinsert_ushort8]]kernel void testInsert_ushort8(ushort8 b, ushort8 i, global ushort8 *res) { +// CHECK-EXTENSION: %[[#insertbase_ushort8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ushort8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort8]] %[[#insertinsert_ushort8]] +kernel void testInsert_ushort8(ushort8 b, ushort8 i, global ushort8 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_char8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char8]] %[[#insertinsert_char8]]kernel void testInsert_char8(char8 b, char8 i, global char8 *res) { +// CHECK-EXTENSION: %[[#insertbase_char8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_char8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char8]] %[[#insertinsert_char8]] +kernel void testInsert_char8(char8 b, char8 i, global char8 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uchar8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar8]] %[[#insertinsert_uchar8]]kernel void testInsert_uchar8(uchar8 b, uchar8 i, global uchar8 *res) { +// CHECK-EXTENSION: %[[#insertbase_uchar8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_uchar8:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar8]] %[[#insertinsert_uchar8]] +kernel void testInsert_uchar8(uchar8 b, uchar8 i, global uchar8 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long16]] %[[#insertinsert_long16]]kernel void testInsert_long16(long16 b, long16 i, global long16 *res) { +// CHECK-EXTENSION: %[[#insertbase_long16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_long16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long16]] %[[#insertinsert_long16]] +kernel void testInsert_long16(long16 b, long16 i, global long16 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong16]] %[[#insertinsert_ulong16]]kernel void testInsert_ulong16(ulong16 b, ulong16 i, global ulong16 *res) { +// CHECK-EXTENSION: %[[#insertbase_ulong16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ulong16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong16]] %[[#insertinsert_ulong16]] +kernel void testInsert_ulong16(ulong16 b, ulong16 i, global ulong16 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int16]] %[[#insertinsert_int16]]kernel void testInsert_int16(int16 b, int16 i, global int16 *res) { +// CHECK-EXTENSION: %[[#insertbase_int16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_int16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int16]] %[[#insertinsert_int16]] +kernel void testInsert_int16(int16 b, int16 i, global int16 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint16]] %[[#insertinsert_uint16]]kernel void testInsert_uint16(uint16 b, uint16 i, global uint16 *res) { +// CHECK-EXTENSION: %[[#insertbase_uint16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_uint16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint16]] %[[#insertinsert_uint16]] +kernel void testInsert_uint16(uint16 b, uint16 i, global uint16 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short16]] %[[#insertinsert_short16]]kernel void testInsert_short16(short16 b, short16 i, global short16 *res) { +// CHECK-EXTENSION: %[[#insertbase_short16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_short16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short16]] %[[#insertinsert_short16]] +kernel void testInsert_short16(short16 b, short16 i, global short16 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort16]] %[[#insertinsert_ushort16]]kernel void testInsert_ushort16(ushort16 b, ushort16 i, global ushort16 *res) { +// CHECK-EXTENSION: %[[#insertbase_ushort16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_ushort16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort16]] %[[#insertinsert_ushort16]] +kernel void testInsert_ushort16(ushort16 b, ushort16 i, global ushort16 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_char16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char16]] %[[#insertinsert_char16]]kernel void testInsert_char16(char16 b, char16 i, global char16 *res) { +// CHECK-EXTENSION: %[[#insertbase_char16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_char16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char16]] %[[#insertinsert_char16]] +kernel void testInsert_char16(char16 b, char16 i, global char16 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uchar16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar16]] %[[#insertinsert_uchar16]]kernel void testInsert_uchar16(uchar16 b, uchar16 i, global uchar16 *res) { +// CHECK-EXTENSION: %[[#insertbase_uchar16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#insertinsert_uchar16:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar16]] %[[#insertinsert_uchar16]] +kernel void testInsert_uchar16(uchar16 b, uchar16 i, global uchar16 *res) { *res = bitfield_insert(b, i, 4, 2); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_long(long b, ulong bu, global long *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -245,7 +385,9 @@ kernel void testExtractS_long(long b, ulong bu, global long *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_int(int b, uint bu, global int *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -253,7 +395,9 @@ kernel void testExtractS_int(int b, uint bu, global int *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_short(short b, ushort bu, global short *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -261,7 +405,9 @@ kernel void testExtractS_short(short b, ushort bu, global short *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_char(char b, uchar bu, global char *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -269,7 +415,9 @@ kernel void testExtractS_char(char b, uchar bu, global char *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_long2(long b, ulong bu, global long *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -277,7 +425,9 @@ kernel void testExtractS_long2(long b, ulong bu, global long *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_int2(int b, uint bu, global int *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -285,7 +435,9 @@ kernel void testExtractS_int2(int b, uint bu, global int *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_short2(short b, ushort bu, global short *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -293,7 +445,9 @@ kernel void testExtractS_short2(short b, ushort bu, global short *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_char2(char b, uchar bu, global char *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -301,7 +455,9 @@ kernel void testExtractS_char2(char b, uchar bu, global char *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_long3(long b, ulong bu, global long *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -309,7 +465,9 @@ kernel void testExtractS_long3(long b, ulong bu, global long *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_int3(int b, uint bu, global int *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -317,7 +475,9 @@ kernel void testExtractS_int3(int b, uint bu, global int *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_short3(short b, ushort bu, global short *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -325,7 +485,9 @@ kernel void testExtractS_short3(short b, ushort bu, global short *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_char3(char b, uchar bu, global char *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -333,7 +495,9 @@ kernel void testExtractS_char3(char b, uchar bu, global char *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_long4(long b, ulong bu, global long *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -341,7 +505,9 @@ kernel void testExtractS_long4(long b, ulong bu, global long *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_int4(int b, uint bu, global int *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -349,7 +515,9 @@ kernel void testExtractS_int4(int b, uint bu, global int *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_short4(short b, ushort bu, global short *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -357,7 +525,9 @@ kernel void testExtractS_short4(short b, ushort bu, global short *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_char4(char b, uchar bu, global char *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -365,7 +535,9 @@ kernel void testExtractS_char4(char b, uchar bu, global char *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_long8(long b, ulong bu, global long *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -373,7 +545,9 @@ kernel void testExtractS_long8(long b, ulong bu, global long *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_int8(int b, uint bu, global int *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -381,7 +555,9 @@ kernel void testExtractS_int8(int b, uint bu, global int *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_short8(short b, ushort bu, global short *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -389,7 +565,9 @@ kernel void testExtractS_short8(short b, ushort bu, global short *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_char8(char b, uchar bu, global char *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -397,7 +575,9 @@ kernel void testExtractS_char8(char b, uchar bu, global char *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_long16(long b, ulong bu, global long *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -405,7 +585,9 @@ kernel void testExtractS_long16(long b, ulong bu, global long *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_int16(int b, uint bu, global int *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -413,7 +595,9 @@ kernel void testExtractS_int16(int b, uint bu, global int *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_short16(short b, ushort bu, global short *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -421,7 +605,9 @@ kernel void testExtractS_short16(short b, ushort bu, global short *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] kernel void testExtractS_char16(char b, uchar bu, global char *res) { *res = bitfield_extract_signed(b, 5, 4); @@ -429,7 +615,9 @@ kernel void testExtractS_char16(char b, uchar bu, global char *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_long(long b, ulong bu, global ulong *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -437,7 +625,9 @@ kernel void testExtractU_long(long b, ulong bu, global ulong *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_int(int b, uint bu, global uint *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -445,7 +635,9 @@ kernel void testExtractU_int(int b, uint bu, global uint *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_short(short b, ushort bu, global ushort *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -453,7 +645,9 @@ kernel void testExtractU_short(short b, ushort bu, global ushort *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_char(char b, uchar bu, global uchar *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -461,7 +655,9 @@ kernel void testExtractU_char(char b, uchar bu, global uchar *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_long2(long2 b, ulong2 bu, global ulong2 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -469,7 +665,9 @@ kernel void testExtractU_long2(long2 b, ulong2 bu, global ulong2 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_int2(int2 b, uint2 bu, global uint2 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -477,7 +675,9 @@ kernel void testExtractU_int2(int2 b, uint2 bu, global uint2 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_short2(short2 b, ushort2 bu, global ushort2 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -485,7 +685,9 @@ kernel void testExtractU_short2(short2 b, ushort2 bu, global ushort2 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_char2(char2 b, uchar2 bu, global uchar2 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -493,7 +695,9 @@ kernel void testExtractU_char2(char2 b, uchar2 bu, global uchar2 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_long3(long3 b, ulong3 bu, global ulong3 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -501,7 +705,9 @@ kernel void testExtractU_long3(long3 b, ulong3 bu, global ulong3 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_int3(int3 b, uint3 bu, global uint3 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -509,7 +715,9 @@ kernel void testExtractU_int3(int3 b, uint3 bu, global uint3 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_short3(short3 b, ushort3 bu, global ushort3 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -517,7 +725,9 @@ kernel void testExtractU_short3(short3 b, ushort3 bu, global ushort3 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_char3(char3 b, uchar3 bu, global uchar3 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -525,7 +735,9 @@ kernel void testExtractU_char3(char3 b, uchar3 bu, global uchar3 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_long4(long4 b, ulong4 bu, global ulong4 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -533,7 +745,9 @@ kernel void testExtractU_long4(long4 b, ulong4 bu, global ulong4 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_int4(int4 b, uint4 bu, global uint4 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -541,7 +755,9 @@ kernel void testExtractU_int4(int4 b, uint4 bu, global uint4 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_short4(short4 b, ushort4 bu, global ushort4 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -549,7 +765,9 @@ kernel void testExtractU_short4(short4 b, ushort4 bu, global ushort4 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_char4(char4 b, uchar4 bu, global uchar4 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -557,7 +775,9 @@ kernel void testExtractU_char4(char4 b, uchar4 bu, global uchar4 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_long8(long8 b, ulong8 bu, global ulong8 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -565,7 +785,9 @@ kernel void testExtractU_long8(long8 b, ulong8 bu, global ulong8 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_int8(int8 b, uint8 bu, global uint8 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -573,7 +795,9 @@ kernel void testExtractU_int8(int8 b, uint8 bu, global uint8 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_short8(short8 b, ushort8 bu, global ushort8 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -581,7 +805,9 @@ kernel void testExtractU_short8(short8 b, ushort8 bu, global ushort8 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_char8(char8 b, uchar8 bu, global uchar8 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -589,7 +815,9 @@ kernel void testExtractU_char8(char8 b, uchar8 bu, global uchar8 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_long16(long16 b, ulong16 bu, global ulong16 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -597,7 +825,9 @@ kernel void testExtractU_long16(long16 b, ulong16 bu, global ulong16 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_int16(int16 b, uint16 bu, global uint16 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -605,7 +835,9 @@ kernel void testExtractU_int16(int16 b, uint16 bu, global uint16 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_short16(short16 b, ushort16 bu, global ushort16 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -613,7 +845,9 @@ kernel void testExtractU_short16(short16 b, ushort16 bu, global ushort16 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] kernel void testExtractU_char16(char16 b, uchar16 bu, global uchar16 *res) { *res = bitfield_extract_unsigned(b, 3, 4); @@ -621,289 +855,337 @@ kernel void testExtractU_char16(char16 b, uchar16 bu, global uchar16 *res) { } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_long(long b, global long *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ulong(ulong b, global ulong *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_int(int b, global int *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uint(uint b, global uint *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_short(short b, global short *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ushort(ushort b, global ushort *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_char(char b, global char *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uchar(uchar b, global uchar *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_long2(long2 b, global long2 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ulong2(ulong2 b, global ulong2 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_int2(int2 b, global int2 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uint2(uint2 b, global uint2 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_short2(short2 b, global short2 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ushort2(ushort2 b, global ushort2 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_char2(char2 b, global char2 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uchar2(uchar2 b, global uchar2 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_long3(long3 b, global long3 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ulong3(ulong3 b, global ulong3 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_int3(int3 b, global int3 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uint3(uint3 b, global uint3 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_short3(short3 b, global short3 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ushort3(ushort3 b, global ushort3 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_char3(char3 b, global char3 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uchar3(uchar3 b, global uchar3 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_long4(long4 b, global long4 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ulong4(ulong4 b, global ulong4 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_int4(int4 b, global int4 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uint4(uint4 b, global uint4 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_short4(short4 b, global short4 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ushort4(ushort4 b, global ushort4 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_char4(char4 b, global char4 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uchar4(uchar4 b, global uchar4 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_long8(long8 b, global long8 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ulong8(ulong8 b, global ulong8 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_int8(int8 b, global int8 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uint8(uint8 b, global uint8 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_short8(short8 b, global short8 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ushort8(ushort8 b, global ushort8 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_char8(char8 b, global char8 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uchar8(uchar8 b, global uchar8 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_long16(long16 b, global long16 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ulong16(ulong16 b, global ulong16 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_int16(int16 b, global int16 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uint16(uint16 b, global uint16 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_short16(short16 b, global short16 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_ushort16(ushort16 b, global ushort16 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_char16(char16 b, global char16 *res) { *res = bit_reverse(b); } // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] kernel void testBitReverse_uchar16(uchar16 b, global uchar16 *res) { *res = bit_reverse(b); } diff --git a/llvm/test/CodeGen/SPIRV/lit.local.cfg b/llvm/test/CodeGen/SPIRV/lit.local.cfg index 4655633a25682..adf1806948183 100644 --- a/llvm/test/CodeGen/SPIRV/lit.local.cfg +++ b/llvm/test/CodeGen/SPIRV/lit.local.cfg @@ -1,6 +1,12 @@ +import lit.llvm + if not "SPIRV" in config.root.targets: config.unsupported = True +lit.llvm.initialize(lit_config, config) +lit.llvm.llvm_config.use_clang() +config.suffixes.add(".cl") + spirv_sim_root = os.path.join(config.llvm_src_root, "utils", "spirv-sim") config.substitutions.append( diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index 0d2e414d1d9f8..5a03a85386e0a 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -22,7 +22,7 @@ # suffixes: A list of file extensions to treat as test files. This is overriden # by individual lit.local.cfg files in the test subdirectories. -config.suffixes = [".ll", ".c", ".test", ".txt", ".s", ".mir", ".yaml", ".spv", ".cl"] +config.suffixes = [".ll", ".c", ".test", ".txt", ".s", ".mir", ".yaml", ".spv"] # excludes: A list of directories to exclude from the testsuite. The 'Inputs' # subdirectories contain auxiliary inputs for various tests in their parent @@ -35,8 +35,6 @@ # test_exec_root: The root path where tests should be run. config.test_exec_root = os.path.join(config.llvm_obj_root, "test") -llvm_config.use_clang() - # Tweak the PATH to include the tools dir. llvm_config.with_environment("PATH", config.llvm_tools_dir, append_path=True) From 54128bbf1dc8d43949fde2f43337a4e372445c1d Mon Sep 17 00:00:00 2001 From: "Maronas, Marcos" Date: Thu, 19 Dec 2024 14:30:55 +0100 Subject: [PATCH 05/11] Fix clang-format issues. --- llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp index d64d9177b4921..24166d31f78b2 100644 --- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp @@ -984,16 +984,16 @@ static bool buildBarrierInst(const SPIRV::IncomingCall *Call, unsigned Opcode, } /// Helper function for building extended bit operations. -static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call, unsigned Opcode, - MachineIRBuilder &MIRBuilder, - SPIRVGlobalRegistry *GR) { +static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call, + unsigned Opcode, + MachineIRBuilder &MIRBuilder, + SPIRVGlobalRegistry *GR) { const SPIRV::DemangledBuiltin *Builtin = Call->Builtin; const auto *ST = static_cast(&MIRBuilder.getMF().getSubtarget()); if ((Opcode == SPIRV::OpBitFieldInsert || Opcode == SPIRV::OpBitFieldSExtract || - Opcode == SPIRV::OpBitFieldUExtract || - Opcode == SPIRV::OpBitReverse) && + Opcode == SPIRV::OpBitFieldUExtract || Opcode == SPIRV::OpBitReverse) && !ST->canUseExtension(SPIRV::Extension::SPV_KHR_bit_instructions)) { std::string DiagMsg = std::string(Builtin->Name) + ": the builtin requires the following SPIR-V " @@ -1007,8 +1007,8 @@ static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call, unsigned Op // Generate the instruction. auto MIB = MIRBuilder.buildInstr(Opcode) - .addDef(Call->ReturnRegister) - .addUse(GR->getSPIRVTypeID(Call->ReturnType)); + .addDef(Call->ReturnRegister) + .addUse(GR->getSPIRVTypeID(Call->ReturnType)); for (unsigned i = 0; i < Call->Arguments.size(); ++i) MIB.addUse(Call->Arguments[i]); @@ -2074,8 +2074,8 @@ static bool generateSpecConstantInst(const SPIRV::IncomingCall *Call, } static bool generateExtendedBitOpsInst(const SPIRV::IncomingCall *Call, - MachineIRBuilder &MIRBuilder, - SPIRVGlobalRegistry *GR) { + MachineIRBuilder &MIRBuilder, + SPIRVGlobalRegistry *GR) { // Lookup the instruction opcode in the TableGen records. const SPIRV::DemangledBuiltin *Builtin = Call->Builtin; unsigned Opcode = From c3fe99965b0cb9159efc18d50bc33e0173508ecb Mon Sep 17 00:00:00 2001 From: "Maronas, Marcos" Date: Fri, 20 Dec 2024 11:49:44 +0100 Subject: [PATCH 06/11] Address code review feedback. --- llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp | 1 - .../cl_khr_extended_bit_ops.cl | 1191 ------- .../cl_khr_extended_bit_ops.ll | 2766 +++++++++++++++++ llvm/test/CodeGen/SPIRV/lit.local.cfg | 6 - 4 files changed, 2766 insertions(+), 1198 deletions(-) delete mode 100644 llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl create mode 100644 llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp index 24166d31f78b2..6a4ec14ad70aa 100644 --- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp @@ -1005,7 +1005,6 @@ static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call, if (Call->isSpirvOp()) return buildOpFromWrapper(MIRBuilder, Opcode, Call, Register(0)); - // Generate the instruction. auto MIB = MIRBuilder.buildInstr(Opcode) .addDef(Call->ReturnRegister) .addUse(GR->getSPIRVTypeID(Call->ReturnType)); diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl deleted file mode 100644 index 4f7fd131f6f9a..0000000000000 --- a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl +++ /dev/null @@ -1,1191 +0,0 @@ -// RUN: %clang_cc1 -triple spir-unknown-unknown -O1 -cl-std=CL2.0 -fdeclare-opencl-builtins -finclude-default-header -emit-llvm-bc %s -o %t.bc -// RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %t.bc --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-EXTENSION -// RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %t.bc -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTENSION - -// CHECK-SPIRV: Capability BitInstructions -// CHECK-SPIRV: Extension "SPV_KHR_bit_instructions" -// CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_long:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long]] %[[#insertinsert_long]] -kernel void testInsert_long(long b, long i, global long *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ulong:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong]] %[[#insertinsert_ulong]] -kernel void testInsert_ulong(ulong b, ulong i, global ulong *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_int:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int]] %[[#insertinsert_int]] -kernel void testInsert_int(int b, int i, global int *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_uint:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint]] %[[#insertinsert_uint]] -kernel void testInsert_uint(uint b, uint i, global uint *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_short:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short]] %[[#insertinsert_short]] -kernel void testInsert_short(short b, short i, global short *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ushort:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort]] %[[#insertinsert_ushort]] -kernel void testInsert_ushort(ushort b, ushort i, global ushort *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_long2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long2]] %[[#insertinsert_long2]] -kernel void testInsert_long2(long2 b, long2 i, global long2 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ulong2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong2]] %[[#insertinsert_ulong2]] -kernel void testInsert_ulong2(ulong2 b, ulong2 i, global ulong2 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_int2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int2]] %[[#insertinsert_int2]] -kernel void testInsert_int2(int2 b, int2 i, global int2 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_uint2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint2]] %[[#insertinsert_uint2]] -kernel void testInsert_uint2(uint2 b, uint2 i, global uint2 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_short2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short2]] %[[#insertinsert_short2]] -kernel void testInsert_short2(short2 b, short2 i, global short2 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ushort2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort2]] %[[#insertinsert_ushort2]] -kernel void testInsert_ushort2(ushort2 b, ushort2 i, global ushort2 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_char2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_char2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char2]] %[[#insertinsert_char2]] -kernel void testInsert_char2(char2 b, char2 i, global char2 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uchar2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_uchar2:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar2]] %[[#insertinsert_uchar2]] -kernel void testInsert_uchar2(uchar2 b, uchar2 i, global uchar2 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_long3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long3]] %[[#insertinsert_long3]] -kernel void testInsert_long3(long3 b, long3 i, global long3 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ulong3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong3]] %[[#insertinsert_ulong3]] -kernel void testInsert_ulong3(ulong3 b, ulong3 i, global ulong3 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_int3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int3]] %[[#insertinsert_int3]] -kernel void testInsert_int3(int3 b, int3 i, global int3 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_uint3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint3]] %[[#insertinsert_uint3]] -kernel void testInsert_uint3(uint3 b, uint3 i, global uint3 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_short3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short3]] %[[#insertinsert_short3]] -kernel void testInsert_short3(short3 b, short3 i, global short3 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ushort3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort3]] %[[#insertinsert_ushort3]] -kernel void testInsert_ushort3(ushort3 b, ushort3 i, global ushort3 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_char3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_char3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char3]] %[[#insertinsert_char3]] -kernel void testInsert_char3(char3 b, char3 i, global char3 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uchar3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_uchar3:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar3]] %[[#insertinsert_uchar3]] -kernel void testInsert_uchar3(uchar3 b, uchar3 i, global uchar3 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_long4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long4]] %[[#insertinsert_long4]] -kernel void testInsert_long4(long4 b, long4 i, global long4 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ulong4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong4]] %[[#insertinsert_ulong4]] -kernel void testInsert_ulong4(ulong4 b, ulong4 i, global ulong4 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_int4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int4]] %[[#insertinsert_int4]] -kernel void testInsert_int4(int4 b, int4 i, global int4 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_uint4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint4]] %[[#insertinsert_uint4]] -kernel void testInsert_uint4(uint4 b, uint4 i, global uint4 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_short4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short4]] %[[#insertinsert_short4]] -kernel void testInsert_short4(short4 b, short4 i, global short4 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ushort4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort4]] %[[#insertinsert_ushort4]] -kernel void testInsert_ushort4(ushort4 b, ushort4 i, global ushort4 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_char4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_char4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char4]] %[[#insertinsert_char4]] -kernel void testInsert_char4(char4 b, char4 i, global char4 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uchar4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_uchar4:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar4]] %[[#insertinsert_uchar4]] -kernel void testInsert_uchar4(uchar4 b, uchar4 i, global uchar4 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_long8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long8]] %[[#insertinsert_long8]] -kernel void testInsert_long8(long8 b, long8 i, global long8 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ulong8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong8]] %[[#insertinsert_ulong8]] -kernel void testInsert_ulong8(ulong8 b, ulong8 i, global ulong8 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_int8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int8]] %[[#insertinsert_int8]] -kernel void testInsert_int8(int8 b, int8 i, global int8 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_uint8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint8]] %[[#insertinsert_uint8]] -kernel void testInsert_uint8(uint8 b, uint8 i, global uint8 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_short8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short8]] %[[#insertinsert_short8]] -kernel void testInsert_short8(short8 b, short8 i, global short8 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ushort8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort8]] %[[#insertinsert_ushort8]] -kernel void testInsert_ushort8(ushort8 b, ushort8 i, global ushort8 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_char8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_char8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char8]] %[[#insertinsert_char8]] -kernel void testInsert_char8(char8 b, char8 i, global char8 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uchar8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_uchar8:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar8]] %[[#insertinsert_uchar8]] -kernel void testInsert_uchar8(uchar8 b, uchar8 i, global uchar8 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_long16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_long16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long16]] %[[#insertinsert_long16]] -kernel void testInsert_long16(long16 b, long16 i, global long16 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ulong16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ulong16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong16]] %[[#insertinsert_ulong16]] -kernel void testInsert_ulong16(ulong16 b, ulong16 i, global ulong16 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_int16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_int16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int16]] %[[#insertinsert_int16]] -kernel void testInsert_int16(int16 b, int16 i, global int16 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uint16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_uint16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint16]] %[[#insertinsert_uint16]] -kernel void testInsert_uint16(uint16 b, uint16 i, global uint16 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_short16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_short16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short16]] %[[#insertinsert_short16]] -kernel void testInsert_short16(short16 b, short16 i, global short16 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_ushort16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_ushort16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort16]] %[[#insertinsert_ushort16]] -kernel void testInsert_ushort16(ushort16 b, ushort16 i, global ushort16 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_char16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_char16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char16]] %[[#insertinsert_char16]] -kernel void testInsert_char16(char16 b, char16 i, global char16 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#insertbase_uchar16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#insertinsert_uchar16:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar16]] %[[#insertinsert_uchar16]] -kernel void testInsert_uchar16(uchar16 b, uchar16 i, global uchar16 *res) { - *res = bitfield_insert(b, i, 4, 2); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_long(long b, ulong bu, global long *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_int(int b, uint bu, global int *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_short(short b, ushort bu, global short *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_char(char b, uchar bu, global char *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_long2(long b, ulong bu, global long *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_int2(int b, uint bu, global int *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_short2(short b, ushort bu, global short *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_char2(char b, uchar bu, global char *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_long3(long b, ulong bu, global long *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_int3(int b, uint bu, global int *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_short3(short b, ushort bu, global short *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_char3(char b, uchar bu, global char *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_long4(long b, ulong bu, global long *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_int4(int b, uint bu, global int *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_short4(short b, ushort bu, global short *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_char4(char b, uchar bu, global char *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_long8(long b, ulong bu, global long *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_int8(int b, uint bu, global int *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_short8(short b, ushort bu, global short *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_char8(char b, uchar bu, global char *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_long16(long b, ulong bu, global long *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_int16(int b, uint bu, global int *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_short16(short b, ushort bu, global short *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -kernel void testExtractS_char16(char b, uchar bu, global char *res) { - *res = bitfield_extract_signed(b, 5, 4); - *res += bitfield_extract_signed(bu, 5, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_long(long b, ulong bu, global ulong *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_int(int b, uint bu, global uint *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_short(short b, ushort bu, global ushort *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_char(char b, uchar bu, global uchar *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_long2(long2 b, ulong2 bu, global ulong2 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_int2(int2 b, uint2 bu, global uint2 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_short2(short2 b, ushort2 bu, global ushort2 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_char2(char2 b, uchar2 bu, global uchar2 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_long3(long3 b, ulong3 bu, global ulong3 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_int3(int3 b, uint3 bu, global uint3 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_short3(short3 b, ushort3 bu, global ushort3 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_char3(char3 b, uchar3 bu, global uchar3 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_long4(long4 b, ulong4 bu, global ulong4 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_int4(int4 b, uint4 bu, global uint4 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_short4(short4 b, ushort4 bu, global ushort4 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_char4(char4 b, uchar4 bu, global uchar4 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_long8(long8 b, ulong8 bu, global ulong8 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_int8(int8 b, uint8 bu, global uint8 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_short8(short8 b, ushort8 bu, global ushort8 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_char8(char8 b, uchar8 bu, global uchar8 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_long16(long16 b, ulong16 bu, global ulong16 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_int16(int16 b, uint16 bu, global uint16 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_short16(short16 b, ushort16 bu, global ushort16 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -kernel void testExtractU_char16(char16 b, uchar16 bu, global uchar16 *res) { - *res = bitfield_extract_unsigned(b, 3, 4); - *res += bitfield_extract_unsigned(bu, 3, 4); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_long(long b, global long *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ulong(ulong b, global ulong *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_int(int b, global int *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uint(uint b, global uint *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_short(short b, global short *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ushort(ushort b, global ushort *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_char(char b, global char *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uchar(uchar b, global uchar *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_long2(long2 b, global long2 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ulong2(ulong2 b, global ulong2 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_int2(int2 b, global int2 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uint2(uint2 b, global uint2 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_short2(short2 b, global short2 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ushort2(ushort2 b, global ushort2 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_char2(char2 b, global char2 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uchar2(uchar2 b, global uchar2 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_long3(long3 b, global long3 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ulong3(ulong3 b, global ulong3 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_int3(int3 b, global int3 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uint3(uint3 b, global uint3 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_short3(short3 b, global short3 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ushort3(ushort3 b, global ushort3 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_char3(char3 b, global char3 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uchar3(uchar3 b, global uchar3 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_long4(long4 b, global long4 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ulong4(ulong4 b, global ulong4 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_int4(int4 b, global int4 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uint4(uint4 b, global uint4 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_short4(short4 b, global short4 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ushort4(ushort4 b, global ushort4 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_char4(char4 b, global char4 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uchar4(uchar4 b, global uchar4 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_long8(long8 b, global long8 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ulong8(ulong8 b, global ulong8 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_int8(int8 b, global int8 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uint8(uint8 b, global uint8 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_short8(short8 b, global short8 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ushort8(ushort8 b, global ushort8 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_char8(char8 b, global char8 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uchar8(uchar8 b, global uchar8 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_long16(long16 b, global long16 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ulong16(ulong16 b, global ulong16 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_int16(int16 b, global int16 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uint16(uint16 b, global uint16 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_short16(short16 b, global short16 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_ushort16(ushort16 b, global ushort16 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_char16(char16 b, global char16 *res) { - *res = bit_reverse(b); -} - -// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -kernel void testBitReverse_uchar16(uchar16 b, global uchar16 *res) { - *res = bit_reverse(b); -} diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll new file mode 100644 index 0000000000000..112d8e66fb415 --- /dev/null +++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll @@ -0,0 +1,2766 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-EXTENSION +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTENSION +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - -filetype=obj | spirv-val %} +; +; CHECK-EXTENSION: Capability BitInstructions +; CHECK-EXTENSION: Extension "SPV_KHR_bit_instructions" +; CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions +; +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_long:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_long:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long]] %[[#insertinsert_long]] +; +; OpenCL equivalent. +; kernel void testInsert_long(long b, long i, global long *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_long(i64 noundef %b, i64 noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z15bitfield_insertlljj(i64 noundef %b, i64 noundef %i, i32 noundef 4, i32 noundef 2) #2 + store i64 %call, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +declare spir_func i64 @_Z15bitfield_insertlljj(i64 noundef, i64 noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ulong:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ulong:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong]] %[[#insertinsert_ulong]] +; OpenCL equivalent. +; kernel void testInsert_ulong(ulong b, ulong i, global ulong *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ulong(i64 noundef %b, i64 noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z15bitfield_insertmmjj(i64 noundef %b, i64 noundef %i, i32 noundef 4, i32 noundef 2) #2 + store i64 %call, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +declare spir_func i64 @_Z15bitfield_insertmmjj(i64 noundef, i64 noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_int:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_int:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int]] %[[#insertinsert_int]] +; OpenCL equivalent. +; kernel void testInsert_int(int b, int i, global int *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_int(i32 noundef %b, i32 noundef %i, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func i32 @_Z15bitfield_insertiijj(i32 noundef %b, i32 noundef %i, i32 noundef 4, i32 noundef 2) #2 + store i32 %call, ptr addrspace(1) %res, align 4, !tbaa !13 + ret void +} + +declare spir_func i32 @_Z15bitfield_insertiijj(i32 noundef, i32 noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_uint:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_uint:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint]] %[[#insertinsert_uint]] +; OpenCL equivalent. +; kernel void testInsert_uint(uint b, uint i, global uint *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_uint(i32 noundef %b, i32 noundef %i, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func i32 @_Z15bitfield_insertjjjj(i32 noundef %b, i32 noundef %i, i32 noundef 4, i32 noundef 2) #2 + store i32 %call, ptr addrspace(1) %res, align 4, !tbaa !13 + ret void +} + +declare spir_func i32 @_Z15bitfield_insertjjjj(i32 noundef, i32 noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_short:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_short:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short]] %[[#insertinsert_short]] +; OpenCL equivalent. +; kernel void testInsert_short(short b, short i, global short *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_short(i16 noundef signext %b, i16 noundef signext %i, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func signext i16 @_Z15bitfield_insertssjj(i16 noundef signext %b, i16 noundef signext %i, i32 noundef 4, i32 noundef 2) #2 + store i16 %call, ptr addrspace(1) %res, align 2, !tbaa !17 + ret void +} + +declare spir_func signext i16 @_Z15bitfield_insertssjj(i16 noundef signext, i16 noundef signext, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ushort:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ushort:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort]] %[[#insertinsert_ushort]] +; OpenCL equivalentxr. +; kernel void testInsert_ushort(ushort b, ushort i, global ushort *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ushort(i16 noundef zeroext %b, i16 noundef zeroext %i, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func zeroext i16 @_Z15bitfield_insertttjj(i16 noundef zeroext %b, i16 noundef zeroext %i, i32 noundef 4, i32 noundef 2) #2 + store i16 %call, ptr addrspace(1) %res, align 2, !tbaa !17 + ret void +} + +declare spir_func zeroext i16 @_Z15bitfield_insertttjj(i16 noundef zeroext, i16 noundef zeroext, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_long2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_long2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long2]] %[[#insertinsert_long2]] +; OpenCL equivalent. +; kernel void testInsert_long2(long2 b, long2 i, global long2 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_long2(<2 x i64> noundef %b, <2 x i64> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <2 x i64> @_Z15bitfield_insertDv2_lS_jj(<2 x i64> noundef %b, <2 x i64> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <2 x i64> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <2 x i64> @_Z15bitfield_insertDv2_lS_jj(<2 x i64> noundef, <2 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ulong2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ulong2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong2]] %[[#insertinsert_ulong2]] +; OpenCL equivalent. +; kernel void testInsert_ulong2(ulong2 b, ulong2 i, global ulong2 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ulong2(<2 x i64> noundef %b, <2 x i64> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <2 x i64> @_Z15bitfield_insertDv2_mS_jj(<2 x i64> noundef %b, <2 x i64> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <2 x i64> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <2 x i64> @_Z15bitfield_insertDv2_mS_jj(<2 x i64> noundef, <2 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_int2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_int2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int2]] %[[#insertinsert_int2]] +; OpenCL equivalent. +; kernel void testInsert_int2(int2 b, int2 i, global int2 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_int2(<2 x i32> noundef %b, <2 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <2 x i32> @_Z15bitfield_insertDv2_iS_jj(<2 x i32> noundef %b, <2 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <2 x i32> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <2 x i32> @_Z15bitfield_insertDv2_iS_jj(<2 x i32> noundef, <2 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_uint2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_uint2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint2]] %[[#insertinsert_uint2]] +; OpenCL equivalent. +; kernel void testInsert_uint2(uint2 b, uint2 i, global uint2 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_uint2(<2 x i32> noundef %b, <2 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <2 x i32> @_Z15bitfield_insertDv2_jS_jj(<2 x i32> noundef %b, <2 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <2 x i32> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <2 x i32> @_Z15bitfield_insertDv2_jS_jj(<2 x i32> noundef, <2 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_short2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_short2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short2]] %[[#insertinsert_short2]] +; OpenCL equivalent. +; kernel void testInsert_short2(short2 b, short2 i, global short2 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_short2(<2 x i16> noundef %b, <2 x i16> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <2 x i16> @_Z15bitfield_insertDv2_sS_jj(<2 x i16> noundef %b, <2 x i16> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <2 x i16> %call, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <2 x i16> @_Z15bitfield_insertDv2_sS_jj(<2 x i16> noundef, <2 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ushort2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ushort2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort2]] %[[#insertinsert_ushort2]] +; OpenCL equivalent. +; kernel void testInsert_ushort2(ushort2 b, ushort2 i, global ushort2 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ushort2(<2 x i16> noundef %b, <2 x i16> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <2 x i16> @_Z15bitfield_insertDv2_tS_jj(<2 x i16> noundef %b, <2 x i16> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <2 x i16> %call, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <2 x i16> @_Z15bitfield_insertDv2_tS_jj(<2 x i16> noundef, <2 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_char2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_char2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char2]] %[[#insertinsert_char2]] +; OpenCL equivalent. +; kernel void testInsert_char2(char2 b, char2 i, global char2 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_char2(<2 x i8> noundef %b, <2 x i8> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func <2 x i8> @_Z15bitfield_insertDv2_cS_jj(<2 x i8> noundef %b, <2 x i8> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <2 x i8> %call, ptr addrspace(1) %res, align 2, !tbaa !22 + ret void +} + +declare spir_func <2 x i8> @_Z15bitfield_insertDv2_cS_jj(<2 x i8> noundef, <2 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_uchar2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_uchar2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar2]] %[[#insertinsert_uchar2]] +; OpenCL equivalent. +; kernel void testInsert_uchar2(uchar2 b, uchar2 i, global uchar2 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_uchar2(<2 x i8> noundef %b, <2 x i8> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func <2 x i8> @_Z15bitfield_insertDv2_hS_jj(<2 x i8> noundef %b, <2 x i8> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <2 x i8> %call, ptr addrspace(1) %res, align 2, !tbaa !22 + ret void +} + +declare spir_func <2 x i8> @_Z15bitfield_insertDv2_hS_jj(<2 x i8> noundef, <2 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_long3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_long3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long3]] %[[#insertinsert_long3]] +; OpenCL equivalent. +; kernel void testInsert_long3(long3 b, long3 i, global long3 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_long3(<3 x i64> noundef %b, <3 x i64> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <3 x i64> @_Z15bitfield_insertDv3_lS_jj(<3 x i64> noundef %b, <3 x i64> noundef %i, i32 noundef 4, i32 noundef 2) #2 + %extractVec5 = shufflevector <3 x i64> %call, <3 x i64> poison, <4 x i32> + store <4 x i64> %extractVec5, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <3 x i64> @_Z15bitfield_insertDv3_lS_jj(<3 x i64> noundef, <3 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ulong3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ulong3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong3]] %[[#insertinsert_ulong3]] +; OpenCL equivalent. +; kernel void testInsert_ulong3(ulong3 b, ulong3 i, global ulong3 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ulong3(<3 x i64> noundef %b, <3 x i64> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <3 x i64> @_Z15bitfield_insertDv3_mS_jj(<3 x i64> noundef %b, <3 x i64> noundef %i, i32 noundef 4, i32 noundef 2) #2 + %extractVec5 = shufflevector <3 x i64> %call, <3 x i64> poison, <4 x i32> + store <4 x i64> %extractVec5, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <3 x i64> @_Z15bitfield_insertDv3_mS_jj(<3 x i64> noundef, <3 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_int3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_int3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int3]] %[[#insertinsert_int3]] +; OpenCL equivalent. +; kernel void testInsert_int3(int3 b, int3 i, global int3 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_int3(<3 x i32> noundef %b, <3 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <3 x i32> @_Z15bitfield_insertDv3_iS_jj(<3 x i32> noundef %b, <3 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 + %extractVec5 = shufflevector <3 x i32> %call, <3 x i32> poison, <4 x i32> + store <4 x i32> %extractVec5, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <3 x i32> @_Z15bitfield_insertDv3_iS_jj(<3 x i32> noundef, <3 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_uint3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_uint3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint3]] %[[#insertinsert_uint3]] +; OpenCL equivalent. +; kernel void testInsert_uint3(uint3 b, uint3 i, global uint3 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_uint3(<3 x i32> noundef %b, <3 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <3 x i32> @_Z15bitfield_insertDv3_jS_jj(<3 x i32> noundef %b, <3 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 + %extractVec5 = shufflevector <3 x i32> %call, <3 x i32> poison, <4 x i32> + store <4 x i32> %extractVec5, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <3 x i32> @_Z15bitfield_insertDv3_jS_jj(<3 x i32> noundef, <3 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_short3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_short3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short3]] %[[#insertinsert_short3]] +; OpenCL equivalent. +; kernel void testInsert_short3(short3 b, short3 i, global short3 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_short3(<3 x i16> noundef %b, <3 x i16> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <3 x i16> @_Z15bitfield_insertDv3_sS_jj(<3 x i16> noundef %b, <3 x i16> noundef %i, i32 noundef 4, i32 noundef 2) #2 + %extractVec5 = shufflevector <3 x i16> %call, <3 x i16> poison, <4 x i32> + store <4 x i16> %extractVec5, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <3 x i16> @_Z15bitfield_insertDv3_sS_jj(<3 x i16> noundef, <3 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ushort3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ushort3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort3]] %[[#insertinsert_ushort3]] +; OpenCL equivalent. +; kernel void testInsert_ushort3(ushort3 b, ushort3 i, global ushort3 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ushort3(<3 x i16> noundef %b, <3 x i16> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <3 x i16> @_Z15bitfield_insertDv3_tS_jj(<3 x i16> noundef %b, <3 x i16> noundef %i, i32 noundef 4, i32 noundef 2) #2 + %extractVec5 = shufflevector <3 x i16> %call, <3 x i16> poison, <4 x i32> + store <4 x i16> %extractVec5, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <3 x i16> @_Z15bitfield_insertDv3_tS_jj(<3 x i16> noundef, <3 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_char3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_char3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char3]] %[[#insertinsert_char3]] +; OpenCL equivalent. +; kernel void testInsert_char3(char3 b, char3 i, global char3 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_char3(<3 x i8> noundef %b, <3 x i8> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <3 x i8> @_Z15bitfield_insertDv3_cS_jj(<3 x i8> noundef %b, <3 x i8> noundef %i, i32 noundef 4, i32 noundef 2) #2 + %extractVec5 = shufflevector <3 x i8> %call, <3 x i8> poison, <4 x i32> + store <4 x i8> %extractVec5, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <3 x i8> @_Z15bitfield_insertDv3_cS_jj(<3 x i8> noundef, <3 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_uchar3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_uchar3:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar3]] %[[#insertinsert_uchar3]] +; OpenCL equivalent. +; kernel void testInsert_uchar3(uchar3 b, uchar3 i, global uchar3 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_uchar3(<3 x i8> noundef %b, <3 x i8> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <3 x i8> @_Z15bitfield_insertDv3_hS_jj(<3 x i8> noundef %b, <3 x i8> noundef %i, i32 noundef 4, i32 noundef 2) #2 + %extractVec5 = shufflevector <3 x i8> %call, <3 x i8> poison, <4 x i32> + store <4 x i8> %extractVec5, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <3 x i8> @_Z15bitfield_insertDv3_hS_jj(<3 x i8> noundef, <3 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_long4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_long4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long4]] %[[#insertinsert_long4]] +; OpenCL equivalent. +; kernel void testInsert_long4(long4 b, long4 i, global long4 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_long4(<4 x i64> noundef %b, <4 x i64> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <4 x i64> @_Z15bitfield_insertDv4_lS_jj(<4 x i64> noundef %b, <4 x i64> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <4 x i64> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <4 x i64> @_Z15bitfield_insertDv4_lS_jj(<4 x i64> noundef, <4 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ulong4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ulong4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong4]] %[[#insertinsert_ulong4]] +; OpenCL equivalent. +; kernel void testInsert_ulong4(ulong4 b, ulong4 i, global ulong4 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ulong4(<4 x i64> noundef %b, <4 x i64> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <4 x i64> @_Z15bitfield_insertDv4_mS_jj(<4 x i64> noundef %b, <4 x i64> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <4 x i64> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <4 x i64> @_Z15bitfield_insertDv4_mS_jj(<4 x i64> noundef, <4 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_int4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_int4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int4]] %[[#insertinsert_int4]] +; OpenCL equivalent. +; kernel void testInsert_int4(int4 b, int4 i, global int4 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_int4(<4 x i32> noundef %b, <4 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <4 x i32> @_Z15bitfield_insertDv4_iS_jj(<4 x i32> noundef %b, <4 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <4 x i32> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <4 x i32> @_Z15bitfield_insertDv4_iS_jj(<4 x i32> noundef, <4 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_uint4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_uint4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint4]] %[[#insertinsert_uint4]] +; OpenCL equivalent. +; kernel void testInsert_uint4(uint4 b, uint4 i, global uint4 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_uint4(<4 x i32> noundef %b, <4 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <4 x i32> @_Z15bitfield_insertDv4_jS_jj(<4 x i32> noundef %b, <4 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <4 x i32> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <4 x i32> @_Z15bitfield_insertDv4_jS_jj(<4 x i32> noundef, <4 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_short4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_short4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short4]] %[[#insertinsert_short4]] +; OpenCL equivalent. +; kernel void testInsert_short4(short4 b, short4 i, global short4 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_short4(<4 x i16> noundef %b, <4 x i16> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <4 x i16> @_Z15bitfield_insertDv4_sS_jj(<4 x i16> noundef %b, <4 x i16> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <4 x i16> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <4 x i16> @_Z15bitfield_insertDv4_sS_jj(<4 x i16> noundef, <4 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ushort4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ushort4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort4]] %[[#insertinsert_ushort4]] +; OpenCL equivalent. +; kernel void testInsert_ushort4(ushort4 b, ushort4 i, global ushort4 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ushort4(<4 x i16> noundef %b, <4 x i16> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <4 x i16> @_Z15bitfield_insertDv4_tS_jj(<4 x i16> noundef %b, <4 x i16> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <4 x i16> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <4 x i16> @_Z15bitfield_insertDv4_tS_jj(<4 x i16> noundef, <4 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_char4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_char4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char4]] %[[#insertinsert_char4]] +; OpenCL equivalent. +; kernel void testInsert_char4(char4 b, char4 i, global char4 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_char4(<4 x i8> noundef %b, <4 x i8> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <4 x i8> @_Z15bitfield_insertDv4_cS_jj(<4 x i8> noundef %b, <4 x i8> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <4 x i8> %call, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <4 x i8> @_Z15bitfield_insertDv4_cS_jj(<4 x i8> noundef, <4 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_uchar4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_uchar4:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar4]] %[[#insertinsert_uchar4]] +; OpenCL equivalent. +; kernel void testInsert_uchar4(uchar4 b, uchar4 i, global uchar4 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_uchar4(<4 x i8> noundef %b, <4 x i8> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <4 x i8> @_Z15bitfield_insertDv4_hS_jj(<4 x i8> noundef %b, <4 x i8> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <4 x i8> %call, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <4 x i8> @_Z15bitfield_insertDv4_hS_jj(<4 x i8> noundef, <4 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_long8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_long8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long8]] %[[#insertinsert_long8]] +; OpenCL equivalent. +; kernel void testInsert_long8(long8 b, long8 i, global long8 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_long8(<8 x i64> noundef %b, <8 x i64> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 64 initializes((0, 64)) %res) { +entry: + %call = tail call spir_func <8 x i64> @_Z15bitfield_insertDv8_lS_jj(<8 x i64> noundef %b, <8 x i64> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <8 x i64> %call, ptr addrspace(1) %res, align 64, !tbaa !22 + ret void +} + +declare spir_func <8 x i64> @_Z15bitfield_insertDv8_lS_jj(<8 x i64> noundef, <8 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ulong8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ulong8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong8]] %[[#insertinsert_ulong8]] +; OpenCL equivalent. +; kernel void testInsert_ulong8(ulong8 b, ulong8 i, global ulong8 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ulong8(<8 x i64> noundef %b, <8 x i64> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 64 initializes((0, 64)) %res) { +entry: + %call = tail call spir_func <8 x i64> @_Z15bitfield_insertDv8_mS_jj(<8 x i64> noundef %b, <8 x i64> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <8 x i64> %call, ptr addrspace(1) %res, align 64, !tbaa !22 + ret void +} + +declare spir_func <8 x i64> @_Z15bitfield_insertDv8_mS_jj(<8 x i64> noundef, <8 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_int8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_int8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int8]] %[[#insertinsert_int8]] +; OpenCL equivalent. +; kernel void testInsert_int8(int8 b, int8 i, global int8 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_int8(<8 x i32> noundef %b, <8 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <8 x i32> @_Z15bitfield_insertDv8_iS_jj(<8 x i32> noundef %b, <8 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <8 x i32> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <8 x i32> @_Z15bitfield_insertDv8_iS_jj(<8 x i32> noundef, <8 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_uint8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_uint8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint8]] %[[#insertinsert_uint8]] +; OpenCL equivalent. +; kernel void testInsert_uint8(uint8 b, uint8 i, global uint8 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_uint8(<8 x i32> noundef %b, <8 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <8 x i32> @_Z15bitfield_insertDv8_jS_jj(<8 x i32> noundef %b, <8 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <8 x i32> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <8 x i32> @_Z15bitfield_insertDv8_jS_jj(<8 x i32> noundef, <8 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_short8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_short8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short8]] %[[#insertinsert_short8]] +; OpenCL equivalent. +; kernel void testInsert_short8(short8 b, short8 i, global short8 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_short8(<8 x i16> noundef %b, <8 x i16> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <8 x i16> @_Z15bitfield_insertDv8_sS_jj(<8 x i16> noundef %b, <8 x i16> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <8 x i16> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <8 x i16> @_Z15bitfield_insertDv8_sS_jj(<8 x i16> noundef, <8 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ushort8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ushort8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort8]] %[[#insertinsert_ushort8]] +; OpenCL equivalent. +; kernel void testInsert_ushort8(ushort8 b, ushort8 i, global ushort8 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ushort8(<8 x i16> noundef %b, <8 x i16> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <8 x i16> @_Z15bitfield_insertDv8_tS_jj(<8 x i16> noundef %b, <8 x i16> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <8 x i16> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <8 x i16> @_Z15bitfield_insertDv8_tS_jj(<8 x i16> noundef, <8 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_char8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_char8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char8]] %[[#insertinsert_char8]] +; OpenCL equivalent. +; kernel void testInsert_char8(char8 b, char8 i, global char8 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_char8(<8 x i8> noundef %b, <8 x i8> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <8 x i8> @_Z15bitfield_insertDv8_cS_jj(<8 x i8> noundef %b, <8 x i8> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <8 x i8> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <8 x i8> @_Z15bitfield_insertDv8_cS_jj(<8 x i8> noundef, <8 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_uchar8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_uchar8:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar8]] %[[#insertinsert_uchar8]] +; OpenCL equivalent. +; kernel void testInsert_uchar8(uchar8 b, uchar8 i, global uchar8 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_uchar8(<8 x i8> noundef %b, <8 x i8> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <8 x i8> @_Z15bitfield_insertDv8_hS_jj(<8 x i8> noundef %b, <8 x i8> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <8 x i8> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <8 x i8> @_Z15bitfield_insertDv8_hS_jj(<8 x i8> noundef, <8 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_long16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_long16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long16]] %[[#insertinsert_long16]] +; OpenCL equivalent. +; kernel void testInsert_long16(long16 b, long16 i, global long16 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_long16(<16 x i64> noundef %b, <16 x i64> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 128 initializes((0, 128)) %res) { +entry: + %call = tail call spir_func <16 x i64> @_Z15bitfield_insertDv16_lS_jj(<16 x i64> noundef %b, <16 x i64> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <16 x i64> %call, ptr addrspace(1) %res, align 128, !tbaa !22 + ret void +} + +declare spir_func <16 x i64> @_Z15bitfield_insertDv16_lS_jj(<16 x i64> noundef, <16 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ulong16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ulong16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong16]] %[[#insertinsert_ulong16]] +; OpenCL equivalent. +; kernel void testInsert_ulong16(ulong16 b, ulong16 i, global ulong16 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ulong16(<16 x i64> noundef %b, <16 x i64> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 128 initializes((0, 128)) %res) { +entry: + %call = tail call spir_func <16 x i64> @_Z15bitfield_insertDv16_mS_jj(<16 x i64> noundef %b, <16 x i64> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <16 x i64> %call, ptr addrspace(1) %res, align 128, !tbaa !22 + ret void +} + +declare spir_func <16 x i64> @_Z15bitfield_insertDv16_mS_jj(<16 x i64> noundef, <16 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_int16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_int16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int16]] %[[#insertinsert_int16]] +; OpenCL equivalent. +; kernel void testInsert_int16(int16 b, int16 i, global int16 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_int16(<16 x i32> noundef %b, <16 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 64 initializes((0, 64)) %res) { +entry: + %call = tail call spir_func <16 x i32> @_Z15bitfield_insertDv16_iS_jj(<16 x i32> noundef %b, <16 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <16 x i32> %call, ptr addrspace(1) %res, align 64, !tbaa !22 + ret void +} + +declare spir_func <16 x i32> @_Z15bitfield_insertDv16_iS_jj(<16 x i32> noundef, <16 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_uint16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_uint16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint16]] %[[#insertinsert_uint16]] +; OpenCL equivalent. +; kernel void testInsert_uint16(uint16 b, uint16 i, global uint16 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_uint16(<16 x i32> noundef %b, <16 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 64 initializes((0, 64)) %res) { +entry: + %call = tail call spir_func <16 x i32> @_Z15bitfield_insertDv16_jS_jj(<16 x i32> noundef %b, <16 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <16 x i32> %call, ptr addrspace(1) %res, align 64, !tbaa !22 + ret void +} + +declare spir_func <16 x i32> @_Z15bitfield_insertDv16_jS_jj(<16 x i32> noundef, <16 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_short16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_short16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short16]] %[[#insertinsert_short16]] +; OpenCL equivalent. +; kernel void testInsert_short16(short16 b, short16 i, global short16 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_short16(<16 x i16> noundef %b, <16 x i16> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <16 x i16> @_Z15bitfield_insertDv16_sS_jj(<16 x i16> noundef %b, <16 x i16> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <16 x i16> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <16 x i16> @_Z15bitfield_insertDv16_sS_jj(<16 x i16> noundef, <16 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_ushort16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_ushort16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort16]] %[[#insertinsert_ushort16]] +; OpenCL equivalent. +; kernel void testInsert_ushort16(ushort16 b, ushort16 i, global ushort16 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_ushort16(<16 x i16> noundef %b, <16 x i16> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <16 x i16> @_Z15bitfield_insertDv16_tS_jj(<16 x i16> noundef %b, <16 x i16> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <16 x i16> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <16 x i16> @_Z15bitfield_insertDv16_tS_jj(<16 x i16> noundef, <16 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_char16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_char16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char16]] %[[#insertinsert_char16]] +; OpenCL equivalent. +; kernel void testInsert_char16(char16 b, char16 i, global char16 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_char16(<16 x i8> noundef %b, <16 x i8> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <16 x i8> @_Z15bitfield_insertDv16_cS_jj(<16 x i8> noundef %b, <16 x i8> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <16 x i8> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <16 x i8> @_Z15bitfield_insertDv16_cS_jj(<16 x i8> noundef, <16 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_uchar16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_uchar16:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar16]] %[[#insertinsert_uchar16]] +; OpenCL equivalent. +; kernel void testInsert_uchar16(uchar16 b, uchar16 i, global uchar16 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } + +define dso_local spir_kernel void @testInsert_uchar16(<16 x i8> noundef %b, <16 x i8> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <16 x i8> @_Z15bitfield_insertDv16_hS_jj(<16 x i8> noundef %b, <16 x i8> noundef %i, i32 noundef 4, i32 noundef 2) #2 + store <16 x i8> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <16 x i8> @_Z15bitfield_insertDv16_hS_jj(<16 x i8> noundef, <16 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_long(long b, ulong bu, global long *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_long(i64 noundef %b, i64 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z23bitfield_extract_signedljj(i64 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i64 @_Z23bitfield_extract_signedmjj(i64 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i64 %call1, %call + store i64 %add, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +declare spir_func i64 @_Z23bitfield_extract_signedljj(i64 noundef, i32 noundef, i32 noundef) + +declare spir_func i64 @_Z23bitfield_extract_signedmjj(i64 noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_int(int b, uint bu, global int *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_int(i32 noundef %b, i32 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func i32 @_Z23bitfield_extract_signedijj(i32 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i32 @_Z23bitfield_extract_signedjjj(i32 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i32 %call1, %call + store i32 %add, ptr addrspace(1) %res, align 4, !tbaa !13 + ret void +} + +declare spir_func i32 @_Z23bitfield_extract_signedijj(i32 noundef, i32 noundef, i32 noundef) + +declare spir_func i32 @_Z23bitfield_extract_signedjjj(i32 noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_short(short b, ushort bu, global short *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_short(i16 noundef signext %b, i16 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i16 %call1, %call + store i16 %add, ptr addrspace(1) %res, align 2, !tbaa !17 + ret void +} + +declare spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext, i32 noundef, i32 noundef) + +declare spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_char(char b, uchar bu, global char *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_char(i8 noundef signext %b, i8 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 1 initializes((0, 1)) %res) { +entry: + %call = tail call spir_func signext i8 @_Z23bitfield_extract_signedcjj(i8 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i8 @_Z23bitfield_extract_signedhjj(i8 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i8 %call1, %call + store i8 %add, ptr addrspace(1) %res, align 1, !tbaa !22 + ret void +} + +declare spir_func signext i8 @_Z23bitfield_extract_signedcjj(i8 noundef signext, i32 noundef, i32 noundef) + +declare spir_func signext i8 @_Z23bitfield_extract_signedhjj(i8 noundef zeroext, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_long2(long b, ulong bu, global long *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_long2(i64 noundef %b, i64 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z23bitfield_extract_signedljj(i64 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i64 @_Z23bitfield_extract_signedmjj(i64 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i64 %call1, %call + store i64 %add, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_int2(int b, uint bu, global int *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_int2(i32 noundef %b, i32 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func i32 @_Z23bitfield_extract_signedijj(i32 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i32 @_Z23bitfield_extract_signedjjj(i32 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i32 %call1, %call + store i32 %add, ptr addrspace(1) %res, align 4, !tbaa !13 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_short2(short b, ushort bu, global short *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_short2(i16 noundef signext %b, i16 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i16 %call1, %call + store i16 %add, ptr addrspace(1) %res, align 2, !tbaa !17 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_char2(char b, uchar bu, global char *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_char2(i8 noundef signext %b, i8 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 1 initializes((0, 1)) %res) { +entry: + %call = tail call spir_func signext i8 @_Z23bitfield_extract_signedcjj(i8 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i8 @_Z23bitfield_extract_signedhjj(i8 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i8 %call1, %call + store i8 %add, ptr addrspace(1) %res, align 1, !tbaa !22 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_long3(long b, ulong bu, global long *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_long3(i64 noundef %b, i64 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z23bitfield_extract_signedljj(i64 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i64 @_Z23bitfield_extract_signedmjj(i64 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i64 %call1, %call + store i64 %add, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_int3(int b, uint bu, global int *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_int3(i32 noundef %b, i32 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func i32 @_Z23bitfield_extract_signedijj(i32 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i32 @_Z23bitfield_extract_signedjjj(i32 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i32 %call1, %call + store i32 %add, ptr addrspace(1) %res, align 4, !tbaa !13 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_short3(short b, ushort bu, global short *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_short3(i16 noundef signext %b, i16 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i16 %call1, %call + store i16 %add, ptr addrspace(1) %res, align 2, !tbaa !17 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_char3(char b, uchar bu, global char *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_char3(i8 noundef signext %b, i8 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 1 initializes((0, 1)) %res) { +entry: + %call = tail call spir_func signext i8 @_Z23bitfield_extract_signedcjj(i8 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i8 @_Z23bitfield_extract_signedhjj(i8 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i8 %call1, %call + store i8 %add, ptr addrspace(1) %res, align 1, !tbaa !22 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_long4(long b, ulong bu, global long *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_long4(i64 noundef %b, i64 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z23bitfield_extract_signedljj(i64 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i64 @_Z23bitfield_extract_signedmjj(i64 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i64 %call1, %call + store i64 %add, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_int4(int b, uint bu, global int *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_int4(i32 noundef %b, i32 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func i32 @_Z23bitfield_extract_signedijj(i32 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i32 @_Z23bitfield_extract_signedjjj(i32 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i32 %call1, %call + store i32 %add, ptr addrspace(1) %res, align 4, !tbaa !13 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_short4(short b, ushort bu, global short *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_short4(i16 noundef signext %b, i16 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i16 %call1, %call + store i16 %add, ptr addrspace(1) %res, align 2, !tbaa !17 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_char4(char b, uchar bu, global char *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_char4(i8 noundef signext %b, i8 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 1 initializes((0, 1)) %res) { +entry: + %call = tail call spir_func signext i8 @_Z23bitfield_extract_signedcjj(i8 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i8 @_Z23bitfield_extract_signedhjj(i8 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i8 %call1, %call + store i8 %add, ptr addrspace(1) %res, align 1, !tbaa !22 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_long8(long b, ulong bu, global long *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_long8(i64 noundef %b, i64 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z23bitfield_extract_signedljj(i64 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i64 @_Z23bitfield_extract_signedmjj(i64 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i64 %call1, %call + store i64 %add, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_int8(int b, uint bu, global int *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_int8(i32 noundef %b, i32 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func i32 @_Z23bitfield_extract_signedijj(i32 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i32 @_Z23bitfield_extract_signedjjj(i32 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i32 %call1, %call + store i32 %add, ptr addrspace(1) %res, align 4, !tbaa !13 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_short8(short b, ushort bu, global short *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_short8(i16 noundef signext %b, i16 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i16 %call1, %call + store i16 %add, ptr addrspace(1) %res, align 2, !tbaa !17 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_char8(char b, uchar bu, global char *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_char8(i8 noundef signext %b, i8 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 1 initializes((0, 1)) %res) { +entry: + %call = tail call spir_func signext i8 @_Z23bitfield_extract_signedcjj(i8 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i8 @_Z23bitfield_extract_signedhjj(i8 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i8 %call1, %call + store i8 %add, ptr addrspace(1) %res, align 1, !tbaa !22 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_long16(long b, ulong bu, global long *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_long16(i64 noundef %b, i64 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z23bitfield_extract_signedljj(i64 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i64 @_Z23bitfield_extract_signedmjj(i64 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i64 %call1, %call + store i64 %add, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_int16(int b, uint bu, global int *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_int16(i32 noundef %b, i32 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func i32 @_Z23bitfield_extract_signedijj(i32 noundef %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func i32 @_Z23bitfield_extract_signedjjj(i32 noundef %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add nsw i32 %call1, %call + store i32 %add, ptr addrspace(1) %res, align 4, !tbaa !13 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_short16(short b, ushort bu, global short *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_short16(i16 noundef signext %b, i16 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i16 %call1, %call + store i16 %add, ptr addrspace(1) %res, align 2, !tbaa !17 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_char16(char b, uchar bu, global char *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } + +define dso_local spir_kernel void @testExtractS_char16(i8 noundef signext %b, i8 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 1 initializes((0, 1)) %res) { +entry: + %call = tail call spir_func signext i8 @_Z23bitfield_extract_signedcjj(i8 noundef signext %b, i32 noundef 5, i32 noundef 4) #2 + %call1 = tail call spir_func signext i8 @_Z23bitfield_extract_signedhjj(i8 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2 + %add = add i8 %call1, %call + store i8 %add, ptr addrspace(1) %res, align 1, !tbaa !22 + ret void +} + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_long(long b, ulong bu, global ulong *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_long(i64 noundef %b, i64 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z25bitfield_extract_unsignedljj(i64 noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func i64 @_Z25bitfield_extract_unsignedmjj(i64 noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add i64 %call1, %call + store i64 %add, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +declare spir_func i64 @_Z25bitfield_extract_unsignedljj(i64 noundef, i32 noundef, i32 noundef) + +declare spir_func i64 @_Z25bitfield_extract_unsignedmjj(i64 noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_int(int b, uint bu, global uint *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_int(i32 noundef %b, i32 noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func i32 @_Z25bitfield_extract_unsignedijj(i32 noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func i32 @_Z25bitfield_extract_unsignedjjj(i32 noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add i32 %call1, %call + store i32 %add, ptr addrspace(1) %res, align 4, !tbaa !13 + ret void +} + +declare spir_func i32 @_Z25bitfield_extract_unsignedijj(i32 noundef, i32 noundef, i32 noundef) + +declare spir_func i32 @_Z25bitfield_extract_unsignedjjj(i32 noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_short(short b, ushort bu, global ushort *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_short(i16 noundef signext %b, i16 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func zeroext i16 @_Z25bitfield_extract_unsignedsjj(i16 noundef signext %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func zeroext i16 @_Z25bitfield_extract_unsignedtjj(i16 noundef zeroext %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add i16 %call1, %call + store i16 %add, ptr addrspace(1) %res, align 2, !tbaa !17 + ret void +} + +declare spir_func zeroext i16 @_Z25bitfield_extract_unsignedsjj(i16 noundef signext, i32 noundef, i32 noundef) + +declare spir_func zeroext i16 @_Z25bitfield_extract_unsignedtjj(i16 noundef zeroext, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_char(char b, uchar bu, global uchar *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_char(i8 noundef signext %b, i8 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 1 initializes((0, 1)) %res) { +entry: + %call = tail call spir_func zeroext i8 @_Z25bitfield_extract_unsignedcjj(i8 noundef signext %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func zeroext i8 @_Z25bitfield_extract_unsignedhjj(i8 noundef zeroext %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add i8 %call1, %call + store i8 %add, ptr addrspace(1) %res, align 1, !tbaa !22 + ret void +} + +declare spir_func zeroext i8 @_Z25bitfield_extract_unsignedcjj(i8 noundef signext, i32 noundef, i32 noundef) + +declare spir_func zeroext i8 @_Z25bitfield_extract_unsignedhjj(i8 noundef zeroext, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_long2(long2 b, ulong2 bu, global ulong2 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_long2(<2 x i64> noundef %b, <2 x i64> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <2 x i64> @_Z25bitfield_extract_unsignedDv2_ljj(<2 x i64> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <2 x i64> @_Z25bitfield_extract_unsignedDv2_mjj(<2 x i64> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <2 x i64> %call1, %call + store <2 x i64> %add, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <2 x i64> @_Z25bitfield_extract_unsignedDv2_ljj(<2 x i64> noundef, i32 noundef, i32 noundef) + +declare spir_func <2 x i64> @_Z25bitfield_extract_unsignedDv2_mjj(<2 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_int2(int2 b, uint2 bu, global uint2 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_int2(<2 x i32> noundef %b, <2 x i32> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <2 x i32> @_Z25bitfield_extract_unsignedDv2_ijj(<2 x i32> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <2 x i32> @_Z25bitfield_extract_unsignedDv2_jjj(<2 x i32> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <2 x i32> %call1, %call + store <2 x i32> %add, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <2 x i32> @_Z25bitfield_extract_unsignedDv2_ijj(<2 x i32> noundef, i32 noundef, i32 noundef) + +declare spir_func <2 x i32> @_Z25bitfield_extract_unsignedDv2_jjj(<2 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_short2(short2 b, ushort2 bu, global ushort2 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_short2(<2 x i16> noundef %b, <2 x i16> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <2 x i16> @_Z25bitfield_extract_unsignedDv2_sjj(<2 x i16> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <2 x i16> @_Z25bitfield_extract_unsignedDv2_tjj(<2 x i16> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <2 x i16> %call1, %call + store <2 x i16> %add, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <2 x i16> @_Z25bitfield_extract_unsignedDv2_sjj(<2 x i16> noundef, i32 noundef, i32 noundef) + +declare spir_func <2 x i16> @_Z25bitfield_extract_unsignedDv2_tjj(<2 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_char2(char2 b, uchar2 bu, global uchar2 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_char2(<2 x i8> noundef %b, <2 x i8> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func <2 x i8> @_Z25bitfield_extract_unsignedDv2_cjj(<2 x i8> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <2 x i8> @_Z25bitfield_extract_unsignedDv2_hjj(<2 x i8> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <2 x i8> %call1, %call + store <2 x i8> %add, ptr addrspace(1) %res, align 2, !tbaa !22 + ret void +} + +declare spir_func <2 x i8> @_Z25bitfield_extract_unsignedDv2_cjj(<2 x i8> noundef, i32 noundef, i32 noundef) + +declare spir_func <2 x i8> @_Z25bitfield_extract_unsignedDv2_hjj(<2 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_long3(long3 b, ulong3 bu, global ulong3 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_long3(<3 x i64> noundef %b, <3 x i64> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <3 x i64> @_Z25bitfield_extract_unsignedDv3_ljj(<3 x i64> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call6 = tail call spir_func <3 x i64> @_Z25bitfield_extract_unsignedDv3_mjj(<3 x i64> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <3 x i64> %call6, %call + %extractVec9 = shufflevector <3 x i64> %add, <3 x i64> poison, <4 x i32> + store <4 x i64> %extractVec9, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <3 x i64> @_Z25bitfield_extract_unsignedDv3_ljj(<3 x i64> noundef, i32 noundef, i32 noundef) + +declare spir_func <3 x i64> @_Z25bitfield_extract_unsignedDv3_mjj(<3 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_int3(int3 b, uint3 bu, global uint3 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_int3(<3 x i32> noundef %b, <3 x i32> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <3 x i32> @_Z25bitfield_extract_unsignedDv3_ijj(<3 x i32> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call6 = tail call spir_func <3 x i32> @_Z25bitfield_extract_unsignedDv3_jjj(<3 x i32> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <3 x i32> %call6, %call + %extractVec9 = shufflevector <3 x i32> %add, <3 x i32> poison, <4 x i32> + store <4 x i32> %extractVec9, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <3 x i32> @_Z25bitfield_extract_unsignedDv3_ijj(<3 x i32> noundef, i32 noundef, i32 noundef) + +declare spir_func <3 x i32> @_Z25bitfield_extract_unsignedDv3_jjj(<3 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_short3(short3 b, ushort3 bu, global ushort3 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_short3(<3 x i16> noundef %b, <3 x i16> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <3 x i16> @_Z25bitfield_extract_unsignedDv3_sjj(<3 x i16> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call6 = tail call spir_func <3 x i16> @_Z25bitfield_extract_unsignedDv3_tjj(<3 x i16> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <3 x i16> %call6, %call + %extractVec9 = shufflevector <3 x i16> %add, <3 x i16> poison, <4 x i32> + store <4 x i16> %extractVec9, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <3 x i16> @_Z25bitfield_extract_unsignedDv3_sjj(<3 x i16> noundef, i32 noundef, i32 noundef) + +declare spir_func <3 x i16> @_Z25bitfield_extract_unsignedDv3_tjj(<3 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_char3(char3 b, uchar3 bu, global uchar3 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_char3(<3 x i8> noundef %b, <3 x i8> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <3 x i8> @_Z25bitfield_extract_unsignedDv3_cjj(<3 x i8> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call6 = tail call spir_func <3 x i8> @_Z25bitfield_extract_unsignedDv3_hjj(<3 x i8> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <3 x i8> %call6, %call + %extractVec9 = shufflevector <3 x i8> %add, <3 x i8> poison, <4 x i32> + store <4 x i8> %extractVec9, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <3 x i8> @_Z25bitfield_extract_unsignedDv3_cjj(<3 x i8> noundef, i32 noundef, i32 noundef) + +declare spir_func <3 x i8> @_Z25bitfield_extract_unsignedDv3_hjj(<3 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_long4(long4 b, ulong4 bu, global ulong4 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_long4(<4 x i64> noundef %b, <4 x i64> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <4 x i64> @_Z25bitfield_extract_unsignedDv4_ljj(<4 x i64> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <4 x i64> @_Z25bitfield_extract_unsignedDv4_mjj(<4 x i64> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <4 x i64> %call1, %call + store <4 x i64> %add, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <4 x i64> @_Z25bitfield_extract_unsignedDv4_ljj(<4 x i64> noundef, i32 noundef, i32 noundef) + +declare spir_func <4 x i64> @_Z25bitfield_extract_unsignedDv4_mjj(<4 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_int4(int4 b, uint4 bu, global uint4 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_int4(<4 x i32> noundef %b, <4 x i32> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <4 x i32> @_Z25bitfield_extract_unsignedDv4_ijj(<4 x i32> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <4 x i32> @_Z25bitfield_extract_unsignedDv4_jjj(<4 x i32> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <4 x i32> %call1, %call + store <4 x i32> %add, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <4 x i32> @_Z25bitfield_extract_unsignedDv4_ijj(<4 x i32> noundef, i32 noundef, i32 noundef) + +declare spir_func <4 x i32> @_Z25bitfield_extract_unsignedDv4_jjj(<4 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_short4(short4 b, ushort4 bu, global ushort4 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_short4(<4 x i16> noundef %b, <4 x i16> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <4 x i16> @_Z25bitfield_extract_unsignedDv4_sjj(<4 x i16> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <4 x i16> @_Z25bitfield_extract_unsignedDv4_tjj(<4 x i16> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <4 x i16> %call1, %call + store <4 x i16> %add, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <4 x i16> @_Z25bitfield_extract_unsignedDv4_sjj(<4 x i16> noundef, i32 noundef, i32 noundef) + +declare spir_func <4 x i16> @_Z25bitfield_extract_unsignedDv4_tjj(<4 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_char4(char4 b, uchar4 bu, global uchar4 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_char4(<4 x i8> noundef %b, <4 x i8> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <4 x i8> @_Z25bitfield_extract_unsignedDv4_cjj(<4 x i8> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <4 x i8> @_Z25bitfield_extract_unsignedDv4_hjj(<4 x i8> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <4 x i8> %call1, %call + store <4 x i8> %add, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <4 x i8> @_Z25bitfield_extract_unsignedDv4_cjj(<4 x i8> noundef, i32 noundef, i32 noundef) + +declare spir_func <4 x i8> @_Z25bitfield_extract_unsignedDv4_hjj(<4 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_long8(long8 b, ulong8 bu, global ulong8 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_long8(<8 x i64> noundef %b, <8 x i64> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 64 initializes((0, 64)) %res) { +entry: + %call = tail call spir_func <8 x i64> @_Z25bitfield_extract_unsignedDv8_ljj(<8 x i64> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <8 x i64> @_Z25bitfield_extract_unsignedDv8_mjj(<8 x i64> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <8 x i64> %call1, %call + store <8 x i64> %add, ptr addrspace(1) %res, align 64, !tbaa !22 + ret void +} + +declare spir_func <8 x i64> @_Z25bitfield_extract_unsignedDv8_ljj(<8 x i64> noundef, i32 noundef, i32 noundef) + +declare spir_func <8 x i64> @_Z25bitfield_extract_unsignedDv8_mjj(<8 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_int8(int8 b, uint8 bu, global uint8 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_int8(<8 x i32> noundef %b, <8 x i32> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <8 x i32> @_Z25bitfield_extract_unsignedDv8_ijj(<8 x i32> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <8 x i32> @_Z25bitfield_extract_unsignedDv8_jjj(<8 x i32> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <8 x i32> %call1, %call + store <8 x i32> %add, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <8 x i32> @_Z25bitfield_extract_unsignedDv8_ijj(<8 x i32> noundef, i32 noundef, i32 noundef) + +declare spir_func <8 x i32> @_Z25bitfield_extract_unsignedDv8_jjj(<8 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_short8(short8 b, ushort8 bu, global ushort8 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_short8(<8 x i16> noundef %b, <8 x i16> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <8 x i16> @_Z25bitfield_extract_unsignedDv8_sjj(<8 x i16> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <8 x i16> @_Z25bitfield_extract_unsignedDv8_tjj(<8 x i16> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <8 x i16> %call1, %call + store <8 x i16> %add, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <8 x i16> @_Z25bitfield_extract_unsignedDv8_sjj(<8 x i16> noundef, i32 noundef, i32 noundef) + +declare spir_func <8 x i16> @_Z25bitfield_extract_unsignedDv8_tjj(<8 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_char8(char8 b, uchar8 bu, global uchar8 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_char8(<8 x i8> noundef %b, <8 x i8> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_cjj(<8 x i8> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_hjj(<8 x i8> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <8 x i8> %call1, %call + store <8 x i8> %add, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_cjj(<8 x i8> noundef, i32 noundef, i32 noundef) + +declare spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_hjj(<8 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_long16(long16 b, ulong16 bu, global ulong16 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_long16(<16 x i64> noundef %b, <16 x i64> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 128 initializes((0, 128)) %res) { +entry: + %call = tail call spir_func <16 x i64> @_Z25bitfield_extract_unsignedDv16_ljj(<16 x i64> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <16 x i64> @_Z25bitfield_extract_unsignedDv16_mjj(<16 x i64> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <16 x i64> %call1, %call + store <16 x i64> %add, ptr addrspace(1) %res, align 128, !tbaa !22 + ret void +} + +declare spir_func <16 x i64> @_Z25bitfield_extract_unsignedDv16_ljj(<16 x i64> noundef, i32 noundef, i32 noundef) + +declare spir_func <16 x i64> @_Z25bitfield_extract_unsignedDv16_mjj(<16 x i64> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_int16(int16 b, uint16 bu, global uint16 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_int16(<16 x i32> noundef %b, <16 x i32> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 64 initializes((0, 64)) %res) { +entry: + %call = tail call spir_func <16 x i32> @_Z25bitfield_extract_unsignedDv16_ijj(<16 x i32> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <16 x i32> @_Z25bitfield_extract_unsignedDv16_jjj(<16 x i32> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <16 x i32> %call1, %call + store <16 x i32> %add, ptr addrspace(1) %res, align 64, !tbaa !22 + ret void +} + +declare spir_func <16 x i32> @_Z25bitfield_extract_unsignedDv16_ijj(<16 x i32> noundef, i32 noundef, i32 noundef) + +declare spir_func <16 x i32> @_Z25bitfield_extract_unsignedDv16_jjj(<16 x i32> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_short16(short16 b, ushort16 bu, global ushort16 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_short16(<16 x i16> noundef %b, <16 x i16> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <16 x i16> @_Z25bitfield_extract_unsignedDv16_sjj(<16 x i16> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <16 x i16> @_Z25bitfield_extract_unsignedDv16_tjj(<16 x i16> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <16 x i16> %call1, %call + store <16 x i16> %add, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <16 x i16> @_Z25bitfield_extract_unsignedDv16_sjj(<16 x i16> noundef, i32 noundef, i32 noundef) + +declare spir_func <16 x i16> @_Z25bitfield_extract_unsignedDv16_tjj(<16 x i16> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_char16(char16 b, uchar16 bu, global uchar16 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } + +define dso_local spir_kernel void @testExtractU_char16(<16 x i8> noundef %b, <16 x i8> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <16 x i8> @_Z25bitfield_extract_unsignedDv16_cjj(<16 x i8> noundef %b, i32 noundef 3, i32 noundef 4) #2 + %call1 = tail call spir_func <16 x i8> @_Z25bitfield_extract_unsignedDv16_hjj(<16 x i8> noundef %bu, i32 noundef 3, i32 noundef 4) #2 + %add = add <16 x i8> %call1, %call + store <16 x i8> %add, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <16 x i8> @_Z25bitfield_extract_unsignedDv16_cjj(<16 x i8> noundef, i32 noundef, i32 noundef) + +declare spir_func <16 x i8> @_Z25bitfield_extract_unsignedDv16_hjj(<16 x i8> noundef, i32 noundef, i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_long(long b, global long *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_long(i64 noundef %b, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z11bit_reversel(i64 noundef %b) #2 + store i64 %call, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +declare spir_func i64 @_Z11bit_reversel(i64 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ulong(ulong b, global ulong *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ulong(i64 noundef %b, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z11bit_reversem(i64 noundef %b) #2 + store i64 %call, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +declare spir_func i64 @_Z11bit_reversem(i64 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_int(int b, global int *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_int(i32 noundef %b, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func i32 @_Z11bit_reversei(i32 noundef %b) #2 + store i32 %call, ptr addrspace(1) %res, align 4, !tbaa !13 + ret void +} + +declare spir_func i32 @_Z11bit_reversei(i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uint(uint b, global uint *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uint(i32 noundef %b, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func i32 @_Z11bit_reversej(i32 noundef %b) #2 + store i32 %call, ptr addrspace(1) %res, align 4, !tbaa !13 + ret void +} + +declare spir_func i32 @_Z11bit_reversej(i32 noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_short(short b, global short *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_short(i16 noundef signext %b, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func signext i16 @_Z11bit_reverses(i16 noundef signext %b) #2 + store i16 %call, ptr addrspace(1) %res, align 2, !tbaa !17 + ret void +} + +declare spir_func signext i16 @_Z11bit_reverses(i16 noundef signext) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ushort(ushort b, global ushort *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ushort(i16 noundef zeroext %b, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func zeroext i16 @_Z11bit_reverset(i16 noundef zeroext %b) #2 + store i16 %call, ptr addrspace(1) %res, align 2, !tbaa !17 + ret void +} + +declare spir_func zeroext i16 @_Z11bit_reverset(i16 noundef zeroext) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_char(char b, global char *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_char(i8 noundef signext %b, ptr addrspace(1) nocapture noundef writeonly align 1 initializes((0, 1)) %res) { +entry: + %call = tail call spir_func signext i8 @_Z11bit_reversec(i8 noundef signext %b) #2 + store i8 %call, ptr addrspace(1) %res, align 1, !tbaa !22 + ret void +} + +declare spir_func signext i8 @_Z11bit_reversec(i8 noundef signext) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uchar(uchar b, global uchar *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uchar(i8 noundef zeroext %b, ptr addrspace(1) nocapture noundef writeonly align 1 initializes((0, 1)) %res) { +entry: + %call = tail call spir_func zeroext i8 @_Z11bit_reverseh(i8 noundef zeroext %b) #2 + store i8 %call, ptr addrspace(1) %res, align 1, !tbaa !22 + ret void +} + +declare spir_func zeroext i8 @_Z11bit_reverseh(i8 noundef zeroext) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_long2(long2 b, global long2 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_long2(<2 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <2 x i64> @_Z11bit_reverseDv2_l(<2 x i64> noundef %b) #2 + store <2 x i64> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <2 x i64> @_Z11bit_reverseDv2_l(<2 x i64> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ulong2(ulong2 b, global ulong2 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ulong2(<2 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <2 x i64> @_Z11bit_reverseDv2_m(<2 x i64> noundef %b) #2 + store <2 x i64> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <2 x i64> @_Z11bit_reverseDv2_m(<2 x i64> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_int2(int2 b, global int2 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_int2(<2 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <2 x i32> @_Z11bit_reverseDv2_i(<2 x i32> noundef %b) #2 + store <2 x i32> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <2 x i32> @_Z11bit_reverseDv2_i(<2 x i32> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uint2(uint2 b, global uint2 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uint2(<2 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <2 x i32> @_Z11bit_reverseDv2_j(<2 x i32> noundef %b) #2 + store <2 x i32> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <2 x i32> @_Z11bit_reverseDv2_j(<2 x i32> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_short2(short2 b, global short2 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_short2(<2 x i16> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <2 x i16> @_Z11bit_reverseDv2_s(<2 x i16> noundef %b) #2 + store <2 x i16> %call, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <2 x i16> @_Z11bit_reverseDv2_s(<2 x i16> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ushort2(ushort2 b, global ushort2 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ushort2(<2 x i16> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <2 x i16> @_Z11bit_reverseDv2_t(<2 x i16> noundef %b) #2 + store <2 x i16> %call, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <2 x i16> @_Z11bit_reverseDv2_t(<2 x i16> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_char2(char2 b, global char2 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_char2(<2 x i8> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func <2 x i8> @_Z11bit_reverseDv2_c(<2 x i8> noundef %b) #2 + store <2 x i8> %call, ptr addrspace(1) %res, align 2, !tbaa !22 + ret void +} + +declare spir_func <2 x i8> @_Z11bit_reverseDv2_c(<2 x i8> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uchar2(uchar2 b, global uchar2 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uchar2(<2 x i8> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 2 initializes((0, 2)) %res) { +entry: + %call = tail call spir_func <2 x i8> @_Z11bit_reverseDv2_h(<2 x i8> noundef %b) #2 + store <2 x i8> %call, ptr addrspace(1) %res, align 2, !tbaa !22 + ret void +} + +declare spir_func <2 x i8> @_Z11bit_reverseDv2_h(<2 x i8> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_long3(long3 b, global long3 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_long3(<3 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <3 x i64> @_Z11bit_reverseDv3_l(<3 x i64> noundef %b) #2 + %extractVec2 = shufflevector <3 x i64> %call, <3 x i64> poison, <4 x i32> + store <4 x i64> %extractVec2, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <3 x i64> @_Z11bit_reverseDv3_l(<3 x i64> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ulong3(ulong3 b, global ulong3 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ulong3(<3 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <3 x i64> @_Z11bit_reverseDv3_m(<3 x i64> noundef %b) #2 + %extractVec2 = shufflevector <3 x i64> %call, <3 x i64> poison, <4 x i32> + store <4 x i64> %extractVec2, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <3 x i64> @_Z11bit_reverseDv3_m(<3 x i64> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_int3(int3 b, global int3 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_int3(<3 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <3 x i32> @_Z11bit_reverseDv3_i(<3 x i32> noundef %b) #2 + %extractVec2 = shufflevector <3 x i32> %call, <3 x i32> poison, <4 x i32> + store <4 x i32> %extractVec2, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <3 x i32> @_Z11bit_reverseDv3_i(<3 x i32> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uint3(uint3 b, global uint3 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uint3(<3 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <3 x i32> @_Z11bit_reverseDv3_j(<3 x i32> noundef %b) #2 + %extractVec2 = shufflevector <3 x i32> %call, <3 x i32> poison, <4 x i32> + store <4 x i32> %extractVec2, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <3 x i32> @_Z11bit_reverseDv3_j(<3 x i32> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_short3(short3 b, global short3 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_short3(<3 x i16> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <3 x i16> @_Z11bit_reverseDv3_s(<3 x i16> noundef %b) #2 + %extractVec2 = shufflevector <3 x i16> %call, <3 x i16> poison, <4 x i32> + store <4 x i16> %extractVec2, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <3 x i16> @_Z11bit_reverseDv3_s(<3 x i16> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ushort3(ushort3 b, global ushort3 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ushort3(<3 x i16> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <3 x i16> @_Z11bit_reverseDv3_t(<3 x i16> noundef %b) #2 + %extractVec2 = shufflevector <3 x i16> %call, <3 x i16> poison, <4 x i32> + store <4 x i16> %extractVec2, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <3 x i16> @_Z11bit_reverseDv3_t(<3 x i16> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_char3(char3 b, global char3 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_char3(<3 x i8> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <3 x i8> @_Z11bit_reverseDv3_c(<3 x i8> noundef %b) #2 + %extractVec2 = shufflevector <3 x i8> %call, <3 x i8> poison, <4 x i32> + store <4 x i8> %extractVec2, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <3 x i8> @_Z11bit_reverseDv3_c(<3 x i8> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uchar3(uchar3 b, global uchar3 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uchar3(<3 x i8> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <3 x i8> @_Z11bit_reverseDv3_h(<3 x i8> noundef %b) #2 + %extractVec2 = shufflevector <3 x i8> %call, <3 x i8> poison, <4 x i32> + store <4 x i8> %extractVec2, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <3 x i8> @_Z11bit_reverseDv3_h(<3 x i8> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_long4(long4 b, global long4 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_long4(<4 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <4 x i64> @_Z11bit_reverseDv4_l(<4 x i64> noundef %b) #2 + store <4 x i64> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <4 x i64> @_Z11bit_reverseDv4_l(<4 x i64> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ulong4(ulong4 b, global ulong4 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ulong4(<4 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <4 x i64> @_Z11bit_reverseDv4_m(<4 x i64> noundef %b) #2 + store <4 x i64> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <4 x i64> @_Z11bit_reverseDv4_m(<4 x i64> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_int4(int4 b, global int4 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_int4(<4 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <4 x i32> @_Z11bit_reverseDv4_i(<4 x i32> noundef %b) #2 + store <4 x i32> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <4 x i32> @_Z11bit_reverseDv4_i(<4 x i32> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uint4(uint4 b, global uint4 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uint4(<4 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <4 x i32> @_Z11bit_reverseDv4_j(<4 x i32> noundef %b) #2 + store <4 x i32> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <4 x i32> @_Z11bit_reverseDv4_j(<4 x i32> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_short4(short4 b, global short4 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_short4(<4 x i16> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <4 x i16> @_Z11bit_reverseDv4_s(<4 x i16> noundef %b) #2 + store <4 x i16> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <4 x i16> @_Z11bit_reverseDv4_s(<4 x i16> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ushort4(ushort4 b, global ushort4 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ushort4(<4 x i16> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <4 x i16> @_Z11bit_reverseDv4_t(<4 x i16> noundef %b) #2 + store <4 x i16> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <4 x i16> @_Z11bit_reverseDv4_t(<4 x i16> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_char4(char4 b, global char4 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_char4(<4 x i8> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <4 x i8> @_Z11bit_reverseDv4_c(<4 x i8> noundef %b) #2 + store <4 x i8> %call, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <4 x i8> @_Z11bit_reverseDv4_c(<4 x i8> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uchar4(uchar4 b, global uchar4 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uchar4(<4 x i8> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 4 initializes((0, 4)) %res) { +entry: + %call = tail call spir_func <4 x i8> @_Z11bit_reverseDv4_h(<4 x i8> noundef %b) #2 + store <4 x i8> %call, ptr addrspace(1) %res, align 4, !tbaa !22 + ret void +} + +declare spir_func <4 x i8> @_Z11bit_reverseDv4_h(<4 x i8> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_long8(long8 b, global long8 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_long8(<8 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 64 initializes((0, 64)) %res) { +entry: + %call = tail call spir_func <8 x i64> @_Z11bit_reverseDv8_l(<8 x i64> noundef %b) #2 + store <8 x i64> %call, ptr addrspace(1) %res, align 64, !tbaa !22 + ret void +} + +declare spir_func <8 x i64> @_Z11bit_reverseDv8_l(<8 x i64> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ulong8(ulong8 b, global ulong8 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ulong8(<8 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 64 initializes((0, 64)) %res) { +entry: + %call = tail call spir_func <8 x i64> @_Z11bit_reverseDv8_m(<8 x i64> noundef %b) #2 + store <8 x i64> %call, ptr addrspace(1) %res, align 64, !tbaa !22 + ret void +} + +declare spir_func <8 x i64> @_Z11bit_reverseDv8_m(<8 x i64> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_int8(int8 b, global int8 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_int8(<8 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <8 x i32> @_Z11bit_reverseDv8_i(<8 x i32> noundef %b) #2 + store <8 x i32> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <8 x i32> @_Z11bit_reverseDv8_i(<8 x i32> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uint8(uint8 b, global uint8 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uint8(<8 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <8 x i32> @_Z11bit_reverseDv8_j(<8 x i32> noundef %b) #2 + store <8 x i32> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <8 x i32> @_Z11bit_reverseDv8_j(<8 x i32> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_short8(short8 b, global short8 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_short8(<8 x i16> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <8 x i16> @_Z11bit_reverseDv8_s(<8 x i16> noundef %b) #2 + store <8 x i16> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <8 x i16> @_Z11bit_reverseDv8_s(<8 x i16> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ushort8(ushort8 b, global ushort8 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ushort8(<8 x i16> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <8 x i16> @_Z11bit_reverseDv8_t(<8 x i16> noundef %b) #2 + store <8 x i16> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <8 x i16> @_Z11bit_reverseDv8_t(<8 x i16> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_char8(char8 b, global char8 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_char8(<8 x i8> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <8 x i8> @_Z11bit_reverseDv8_c(<8 x i8> noundef %b) #2 + store <8 x i8> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <8 x i8> @_Z11bit_reverseDv8_c(<8 x i8> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uchar8(uchar8 b, global uchar8 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uchar8(<8 x i8> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func <8 x i8> @_Z11bit_reverseDv8_h(<8 x i8> noundef %b) #2 + store <8 x i8> %call, ptr addrspace(1) %res, align 8, !tbaa !22 + ret void +} + +declare spir_func <8 x i8> @_Z11bit_reverseDv8_h(<8 x i8> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_long16(long16 b, global long16 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_long16(<16 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 128 initializes((0, 128)) %res) { +entry: + %call = tail call spir_func <16 x i64> @_Z11bit_reverseDv16_l(<16 x i64> noundef %b) #2 + store <16 x i64> %call, ptr addrspace(1) %res, align 128, !tbaa !22 + ret void +} + +declare spir_func <16 x i64> @_Z11bit_reverseDv16_l(<16 x i64> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ulong16(ulong16 b, global ulong16 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ulong16(<16 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 128 initializes((0, 128)) %res) { +entry: + %call = tail call spir_func <16 x i64> @_Z11bit_reverseDv16_m(<16 x i64> noundef %b) #2 + store <16 x i64> %call, ptr addrspace(1) %res, align 128, !tbaa !22 + ret void +} + +declare spir_func <16 x i64> @_Z11bit_reverseDv16_m(<16 x i64> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_int16(int16 b, global int16 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_int16(<16 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 64 initializes((0, 64)) %res) { +entry: + %call = tail call spir_func <16 x i32> @_Z11bit_reverseDv16_i(<16 x i32> noundef %b) #2 + store <16 x i32> %call, ptr addrspace(1) %res, align 64, !tbaa !22 + ret void +} + +declare spir_func <16 x i32> @_Z11bit_reverseDv16_i(<16 x i32> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uint16(uint16 b, global uint16 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uint16(<16 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 64 initializes((0, 64)) %res) { +entry: + %call = tail call spir_func <16 x i32> @_Z11bit_reverseDv16_j(<16 x i32> noundef %b) #2 + store <16 x i32> %call, ptr addrspace(1) %res, align 64, !tbaa !22 + ret void +} + +declare spir_func <16 x i32> @_Z11bit_reverseDv16_j(<16 x i32> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_short16(short16 b, global short16 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_short16(<16 x i16> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <16 x i16> @_Z11bit_reverseDv16_s(<16 x i16> noundef %b) #2 + store <16 x i16> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <16 x i16> @_Z11bit_reverseDv16_s(<16 x i16> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_ushort16(ushort16 b, global ushort16 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_ushort16(<16 x i16> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 initializes((0, 32)) %res) { +entry: + %call = tail call spir_func <16 x i16> @_Z11bit_reverseDv16_t(<16 x i16> noundef %b) #2 + store <16 x i16> %call, ptr addrspace(1) %res, align 32, !tbaa !22 + ret void +} + +declare spir_func <16 x i16> @_Z11bit_reverseDv16_t(<16 x i16> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_char16(char16 b, global char16 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_char16(<16 x i8> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <16 x i8> @_Z11bit_reverseDv16_c(<16 x i8> noundef %b) #2 + store <16 x i8> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <16 x i8> @_Z11bit_reverseDv16_c(<16 x i8> noundef) + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_uchar16(uchar16 b, global uchar16 *res) { +; *res = bit_reverse(b); +; } + +define dso_local spir_kernel void @testBitReverse_uchar16(<16 x i8> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 16 initializes((0, 16)) %res) { +entry: + %call = tail call spir_func <16 x i8> @_Z11bit_reverseDv16_h(<16 x i8> noundef %b) #2 + store <16 x i8> %call, ptr addrspace(1) %res, align 16, !tbaa !22 + ret void +} + +declare spir_func <16 x i8> @_Z11bit_reverseDv16_h(<16 x i8> noundef) + +attributes #0 = { convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="false" } +attributes #1 = { convergent mustprogress nofree nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" } +attributes #2 = { convergent nounwind willreturn memory(none) } + +!llvm.module.flags = !{!0} +!opencl.ocl.version = !{!1} +!opencl.spir.version = !{!1} +!llvm.ident = !{!2} + +!0 = !{i32 1, !"wchar_size", i32 4} +!1 = !{i32 2, i32 0} +!2 = !{!"clang version 20.0.0git (https://github.com/llvm/llvm-project.git cc61409d353a40f62d3a137f3c7436aa00df779d)"} +!7 = !{!8, !8, i64 0} +!8 = !{!"long", !9, i64 0} +!9 = !{!"omnipotent char", !10, i64 0} +!10 = !{!"Simple C/C++ TBAA"} +!13 = !{!14, !14, i64 0} +!14 = !{!"int", !9, i64 0} +!17 = !{!18, !18, i64 0} +!18 = !{!"short", !9, i64 0} +!22 = !{!9, !9, i64 0} diff --git a/llvm/test/CodeGen/SPIRV/lit.local.cfg b/llvm/test/CodeGen/SPIRV/lit.local.cfg index adf1806948183..4655633a25682 100644 --- a/llvm/test/CodeGen/SPIRV/lit.local.cfg +++ b/llvm/test/CodeGen/SPIRV/lit.local.cfg @@ -1,12 +1,6 @@ -import lit.llvm - if not "SPIRV" in config.root.targets: config.unsupported = True -lit.llvm.initialize(lit_config, config) -lit.llvm.llvm_config.use_clang() -config.suffixes.add(".cl") - spirv_sim_root = os.path.join(config.llvm_src_root, "utils", "spirv-sim") config.substitutions.append( From c8b26ea93963b396b3d338e7f6df684578020367 Mon Sep 17 00:00:00 2001 From: "Maronas, Marcos" Date: Fri, 24 Jan 2025 18:04:39 +0100 Subject: [PATCH 07/11] Add tests for SPIRV-friendly builtins. --- .../cl_khr_extended_bit_ops.ll | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll index 112d8e66fb415..c2147fbb68c42 100644 --- a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll +++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll @@ -2743,9 +2743,90 @@ entry: declare spir_func <16 x i8> @_Z11bit_reverseDv16_h(<16 x i8> noundef) +; Test SPIRV-friendly builtins. +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_int2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_int2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int2]] %[[#insertinsert_int2]] +; OpenCL equivalent. +; kernel void testInsert_SPIRVFriendly(int2 b, int2 i, global int2 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } +define spir_kernel void @testInsert_SPIRVFriendly(<2 x i32> %b, <2 x i32> %i, ptr addrspace(1) nocapture align 8 %res) #3 { +entry: + %call = call spir_func <2 x i32> @_Z22__spirv_BitFieldInsertDv2_iS_jj(<2 x i32> %b, <2 x i32> %i, i32 4, i32 2) #3 + store <2 x i32> %call, ptr addrspace(1) %res, align 8 + ret void +} + +declare spir_func <2 x i32> @_Z22__spirv_BitFieldInsertDv2_iS_jj(<2 x i32>, <2 x i32>, i32, i32) #3 + + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_SPIRVFriendly(short b, ushort bu, global short *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } +define spir_kernel void @testExtractS_SPIRVFriendly(i16 signext %b, i16 zeroext %bu, ptr addrspace(1) nocapture align 2 %res) #3 { +entry: + %call = call spir_func i16 @_Z24__spirv_BitFieldSExtractsjj(i16 %b, i32 5, i32 4) #3 + %call1 = call spir_func i16 @_Z24__spirv_BitFieldSExtractsjj(i16 %bu, i32 5, i32 4) #3 + %add = add i16 %call1, %call + store i16 %add, ptr addrspace(1) %res, align 2 + ret void +} + +declare spir_func i16 @_Z24__spirv_BitFieldSExtractsjj(i16, i32, i32) #3 + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_SPIRVFriendly(char8 b, uchar8 bu, global uchar8 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } +define spir_kernel void @testExtractU_SPIRVFriendly(<8 x i8> %b, <8 x i8> %bu, ptr addrspace(1) nocapture align 8 %res) #3 { +entry: + %call = call spir_func <8 x i8> @_Z24__spirv_BitFieldUExtractDv8_hjj(<8 x i8> %b, i32 3, i32 4) #3 + %call1 = call spir_func <8 x i8> @_Z24__spirv_BitFieldUExtractDv8_hjj(<8 x i8> %bu, i32 3, i32 4) #3 + %add = add <8 x i8> %call1, %call + store <8 x i8> %add, ptr addrspace(1) %res, align 8 + ret void +} + +declare spir_func <8 x i8> @_Z24__spirv_BitFieldUExtractDv8_hjj(<8 x i8>, i32, i32) #3 + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_SPIRVFriendly(long4 b, global long4 *res) { +; *res = bit_reverse(b); +; } +define spir_kernel void @testBitReverse_SPIRVFriendly(<4 x i64> %b, ptr addrspace(1) nocapture align 32 %res) #3 { +entry: + %call = call <4 x i64> @llvm.bitreverse.v4i64(<4 x i64> %b) + store <4 x i64> %call, ptr addrspace(1) %res, align 32 + ret void +} + +declare <4 x i64> @llvm.bitreverse.v4i64(<4 x i64>) #4 + + + attributes #0 = { convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="false" } attributes #1 = { convergent mustprogress nofree nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" } attributes #2 = { convergent nounwind willreturn memory(none) } +attributes #3 = { nounwind } +attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } !llvm.module.flags = !{!0} !opencl.ocl.version = !{!1} From 936cea7d5b3cb48360e2d2cc437c25a7447d180c Mon Sep 17 00:00:00 2001 From: "Maronas, Marcos" Date: Fri, 24 Jan 2025 18:05:04 +0100 Subject: [PATCH 08/11] Fix SPIRV-friendly builtins. --- llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp index 6a4ec14ad70aa..b04d80466bc49 100644 --- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp @@ -1003,7 +1003,8 @@ static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call, // Generate SPIRV instruction accordingly. if (Call->isSpirvOp()) - return buildOpFromWrapper(MIRBuilder, Opcode, Call, Register(0)); + return buildOpFromWrapper(MIRBuilder, Opcode, Call, + GR->getSPIRVTypeID(Call->ReturnType)); auto MIB = MIRBuilder.buildInstr(Opcode) .addDef(Call->ReturnRegister) From aa2fd7ae6a52f8c02df33e1ee4f9264ce7440253 Mon Sep 17 00:00:00 2001 From: "Maronas, Marcos" Date: Fri, 24 Jan 2025 18:31:55 +0100 Subject: [PATCH 09/11] Add new tests to check enabled capabilities. --- .../cl_khr_extended_bit_ops_ocl_only.ll | 42 +++++++++++++++++++ ..._khr_extended_bit_ops_spv-friendly_only.ll | 38 +++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_ocl_only.ll create mode 100644 llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_spv-friendly_only.ll diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_ocl_only.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_ocl_only.ll new file mode 100644 index 0000000000000..ba8ca53c42166 --- /dev/null +++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_ocl_only.ll @@ -0,0 +1,42 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-EXTENSION +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTENSION +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - -filetype=obj | spirv-val %} +; +; if OpenCL builtin calls present in LLVM IR input and SPV_KHR_bit_instructions is enabled, no error and BitInstructions capability generated. +; CHECK-EXTENSION: Capability BitInstructions +; CHECK-EXTENSION: Extension "SPV_KHR_bit_instructions" +; if OpenCL builtin calls present in LLVM IR input and SPV_KHR_bit_instructions is NOT enabled, error. +; CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions +; +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_long:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_long:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long]] %[[#insertinsert_long]] +; +; OpenCL equivalent. +; kernel void testInsert_long(long b, long i, global long *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } +define dso_local spir_kernel void @testInsert_long(i64 noundef %b, i64 noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 initializes((0, 8)) %res) { +entry: + %call = tail call spir_func i64 @_Z15bitfield_insertlljj(i64 noundef %b, i64 noundef %i, i32 noundef 4, i32 noundef 2) #2 + store i64 %call, ptr addrspace(1) %res, align 8, !tbaa !7 + ret void +} + +declare spir_func i64 @_Z15bitfield_insertlljj(i64 noundef, i64 noundef, i32 noundef, i32 noundef) + +attributes #2 = { convergent nounwind willreturn memory(none) } + +!llvm.module.flags = !{!0} +!opencl.ocl.version = !{!1} +!opencl.spir.version = !{!1} +!llvm.ident = !{!2} + +!0 = !{i32 1, !"wchar_size", i32 4} +!1 = !{i32 2, i32 0} +!2 = !{!"clang version 20.0.0git (https://github.com/llvm/llvm-project.git cc61409d353a40f62d3a137f3c7436aa00df779d)"} +!7 = !{!8, !8, i64 0} +!8 = !{!"long", !9, i64 0} +!9 = !{!"omnipotent char", !10, i64 0} +!10 = !{!"Simple C/C++ TBAA"} diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_spv-friendly_only.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_spv-friendly_only.ll new file mode 100644 index 0000000000000..65cccc83a3e02 --- /dev/null +++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_spv-friendly_only.ll @@ -0,0 +1,38 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-EXTENSION +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-NO-EXTENSION +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - -filetype=obj | spirv-val %} +; +; CHECK-EXTENSION: Capability BitInstructions +; CHECK-EXTENSION: Extension "SPV_KHR_bit_instructions" +; CHECK-NO-EXTENSION-NOT: Capability BitInstructions +; CHECK-NO-EXTENSION-NOT: Extension "SPV_KHR_bit_instructions" +; CHECK-NO-EXTENSION: Capability Shader +; +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_SPIRVFriendly(long4 b, global long4 *res) { +; *res = bit_reverse(b); +; } +define spir_kernel void @testBitReverse_SPIRVFriendly(<4 x i64> %b, ptr addrspace(1) nocapture align 32 %res) #3 { +entry: + %call = call <4 x i64> @llvm.bitreverse.v4i64(<4 x i64> %b) + store <4 x i64> %call, ptr addrspace(1) %res, align 32 + ret void +} + +declare <4 x i64> @llvm.bitreverse.v4i64(<4 x i64>) #4 + + +attributes #3 = { nounwind } +attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } + +!llvm.module.flags = !{!0} +!opencl.ocl.version = !{!1} +!opencl.spir.version = !{!1} +!llvm.ident = !{!2} + +!0 = !{i32 1, !"wchar_size", i32 4} +!1 = !{i32 2, i32 0} +!2 = !{!"clang version 20.0.0git (https://github.com/llvm/llvm-project.git cc61409d353a40f62d3a137f3c7436aa00df779d)"} From 775d4eaff9a156a1a755a6465fba756b8225f80f Mon Sep 17 00:00:00 2001 From: "Maronas, Marcos" Date: Fri, 24 Jan 2025 18:34:57 +0100 Subject: [PATCH 10/11] Update test. --- .../SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_ocl_only.ll | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_ocl_only.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_ocl_only.ll index ba8ca53c42166..221ecb4fef6d9 100644 --- a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_ocl_only.ll +++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops_ocl_only.ll @@ -4,6 +4,7 @@ ; ; if OpenCL builtin calls present in LLVM IR input and SPV_KHR_bit_instructions is enabled, no error and BitInstructions capability generated. ; CHECK-EXTENSION: Capability BitInstructions +; CHECK-EXTENSION-NOT: Capability Shader ; CHECK-EXTENSION: Extension "SPV_KHR_bit_instructions" ; if OpenCL builtin calls present in LLVM IR input and SPV_KHR_bit_instructions is NOT enabled, error. ; CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions From ab0ef111af62bfef160de30518aa237a4f030a9b Mon Sep 17 00:00:00 2001 From: "Maronas, Marcos" Date: Tue, 4 Feb 2025 11:40:06 +0100 Subject: [PATCH 11/11] Spin off SPIRV-friendly builtins test. --- .../cl_khr_extended_bit_ops.ll | 83 ---------------- .../spirv-friendly_extended_bit_ops.ll | 98 +++++++++++++++++++ 2 files changed, 98 insertions(+), 83 deletions(-) create mode 100644 llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/spirv-friendly_extended_bit_ops.ll diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll index c2147fbb68c42..14e5964a949da 100644 --- a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll +++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll @@ -2743,90 +2743,7 @@ entry: declare spir_func <16 x i8> @_Z11bit_reverseDv16_h(<16 x i8> noundef) -; Test SPIRV-friendly builtins. -; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -; CHECK-EXTENSION: %[[#insertbase_int2:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#insertinsert_int2:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int2]] %[[#insertinsert_int2]] -; OpenCL equivalent. -; kernel void testInsert_SPIRVFriendly(int2 b, int2 i, global int2 *res) { -; *res = bitfield_insert(b, i, 4, 2); -; } -define spir_kernel void @testInsert_SPIRVFriendly(<2 x i32> %b, <2 x i32> %i, ptr addrspace(1) nocapture align 8 %res) #3 { -entry: - %call = call spir_func <2 x i32> @_Z22__spirv_BitFieldInsertDv2_iS_jj(<2 x i32> %b, <2 x i32> %i, i32 4, i32 2) #3 - store <2 x i32> %call, ptr addrspace(1) %res, align 8 - ret void -} - -declare spir_func <2 x i32> @_Z22__spirv_BitFieldInsertDv2_iS_jj(<2 x i32>, <2 x i32>, i32, i32) #3 - - -; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] -; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] -; OpenCL equivalent. -; kernel void testExtractS_SPIRVFriendly(short b, ushort bu, global short *res) { -; *res = bitfield_extract_signed(b, 5, 4); -; *res += bitfield_extract_signed(bu, 5, 4); -; } -define spir_kernel void @testExtractS_SPIRVFriendly(i16 signext %b, i16 zeroext %bu, ptr addrspace(1) nocapture align 2 %res) #3 { -entry: - %call = call spir_func i16 @_Z24__spirv_BitFieldSExtractsjj(i16 %b, i32 5, i32 4) #3 - %call1 = call spir_func i16 @_Z24__spirv_BitFieldSExtractsjj(i16 %bu, i32 5, i32 4) #3 - %add = add i16 %call1, %call - store i16 %add, ptr addrspace(1) %res, align 2 - ret void -} - -declare spir_func i16 @_Z24__spirv_BitFieldSExtractsjj(i16, i32, i32) #3 - -; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] -; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] -; OpenCL equivalent. -; kernel void testExtractU_SPIRVFriendly(char8 b, uchar8 bu, global uchar8 *res) { -; *res = bitfield_extract_unsigned(b, 3, 4); -; *res += bitfield_extract_unsigned(bu, 3, 4); -; } -define spir_kernel void @testExtractU_SPIRVFriendly(<8 x i8> %b, <8 x i8> %bu, ptr addrspace(1) nocapture align 8 %res) #3 { -entry: - %call = call spir_func <8 x i8> @_Z24__spirv_BitFieldUExtractDv8_hjj(<8 x i8> %b, i32 3, i32 4) #3 - %call1 = call spir_func <8 x i8> @_Z24__spirv_BitFieldUExtractDv8_hjj(<8 x i8> %bu, i32 3, i32 4) #3 - %add = add <8 x i8> %call1, %call - store <8 x i8> %add, ptr addrspace(1) %res, align 8 - ret void -} - -declare spir_func <8 x i8> @_Z24__spirv_BitFieldUExtractDv8_hjj(<8 x i8>, i32, i32) #3 - -; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] -; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] -; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] -; OpenCL equivalent. -; kernel void testBitReverse_SPIRVFriendly(long4 b, global long4 *res) { -; *res = bit_reverse(b); -; } -define spir_kernel void @testBitReverse_SPIRVFriendly(<4 x i64> %b, ptr addrspace(1) nocapture align 32 %res) #3 { -entry: - %call = call <4 x i64> @llvm.bitreverse.v4i64(<4 x i64> %b) - store <4 x i64> %call, ptr addrspace(1) %res, align 32 - ret void -} - -declare <4 x i64> @llvm.bitreverse.v4i64(<4 x i64>) #4 - - - -attributes #0 = { convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="false" } -attributes #1 = { convergent mustprogress nofree nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" } attributes #2 = { convergent nounwind willreturn memory(none) } -attributes #3 = { nounwind } -attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } !llvm.module.flags = !{!0} !opencl.ocl.version = !{!1} diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/spirv-friendly_extended_bit_ops.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/spirv-friendly_extended_bit_ops.ll new file mode 100644 index 0000000000000..e49a55956aff0 --- /dev/null +++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/spirv-friendly_extended_bit_ops.ll @@ -0,0 +1,98 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-EXTENSION +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTENSION +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - -filetype=obj | spirv-val %} +; +; CHECK-EXTENSION: Capability BitInstructions +; CHECK-EXTENSION: Extension "SPV_KHR_bit_instructions" +; CHECK-NO-EXTENSION: LLVM ERROR: __spirv_BitFieldInsert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions + +; Test SPIRV-friendly builtins. +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#insertbase_int2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#insertinsert_int2:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int2]] %[[#insertinsert_int2]] +; OpenCL equivalent. +; kernel void testInsert_SPIRVFriendly(int2 b, int2 i, global int2 *res) { +; *res = bitfield_insert(b, i, 4, 2); +; } +define spir_kernel void @testInsert_SPIRVFriendly(<2 x i32> %b, <2 x i32> %i, ptr addrspace(1) nocapture align 8 %res) #3 { +entry: + %call = call spir_func <2 x i32> @_Z22__spirv_BitFieldInsertDv2_iS_jj(<2 x i32> %b, <2 x i32> %i, i32 4, i32 2) #3 + store <2 x i32> %call, ptr addrspace(1) %res, align 8 + ret void +} + +declare spir_func <2 x i32> @_Z22__spirv_BitFieldInsertDv2_iS_jj(<2 x i32>, <2 x i32>, i32, i32) #3 + + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractS_SPIRVFriendly(short b, ushort bu, global short *res) { +; *res = bitfield_extract_signed(b, 5, 4); +; *res += bitfield_extract_signed(bu, 5, 4); +; } +define spir_kernel void @testExtractS_SPIRVFriendly(i16 signext %b, i16 zeroext %bu, ptr addrspace(1) nocapture align 2 %res) #3 { +entry: + %call = call spir_func i16 @_Z24__spirv_BitFieldSExtractsjj(i16 %b, i32 5, i32 4) #3 + %call1 = call spir_func i16 @_Z24__spirv_BitFieldSExtractsjj(i16 %bu, i32 5, i32 4) #3 + %add = add i16 %call1, %call + store i16 %add, ptr addrspace(1) %res, align 2 + ret void +} + +declare spir_func i16 @_Z24__spirv_BitFieldSExtractsjj(i16, i32, i32) #3 + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]] +; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]] +; OpenCL equivalent. +; kernel void testExtractU_SPIRVFriendly(char8 b, uchar8 bu, global uchar8 *res) { +; *res = bitfield_extract_unsigned(b, 3, 4); +; *res += bitfield_extract_unsigned(bu, 3, 4); +; } +define spir_kernel void @testExtractU_SPIRVFriendly(<8 x i8> %b, <8 x i8> %bu, ptr addrspace(1) nocapture align 8 %res) #3 { +entry: + %call = call spir_func <8 x i8> @_Z24__spirv_BitFieldUExtractDv8_hjj(<8 x i8> %b, i32 3, i32 4) #3 + %call1 = call spir_func <8 x i8> @_Z24__spirv_BitFieldUExtractDv8_hjj(<8 x i8> %bu, i32 3, i32 4) #3 + %add = add <8 x i8> %call1, %call + store <8 x i8> %add, ptr addrspace(1) %res, align 8 + ret void +} + +declare spir_func <8 x i8> @_Z24__spirv_BitFieldUExtractDv8_hjj(<8 x i8>, i32, i32) #3 + +; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]] +; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] +; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]] +; OpenCL equivalent. +; kernel void testBitReverse_SPIRVFriendly(long4 b, global long4 *res) { +; *res = bit_reverse(b); +; } +define spir_kernel void @testBitReverse_SPIRVFriendly(<4 x i64> %b, ptr addrspace(1) nocapture align 32 %res) #3 { +entry: + %call = call <4 x i64> @llvm.bitreverse.v4i64(<4 x i64> %b) + store <4 x i64> %call, ptr addrspace(1) %res, align 32 + ret void +} + +declare <4 x i64> @llvm.bitreverse.v4i64(<4 x i64>) #4 + + + +attributes #3 = { nounwind } +attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } + +!llvm.module.flags = !{!0} +!opencl.ocl.version = !{!1} +!opencl.spir.version = !{!1} +!llvm.ident = !{!2} + +!0 = !{i32 1, !"wchar_size", i32 4} +!1 = !{i32 2, i32 0} +!2 = !{!"clang version 20.0.0git (https://github.com/llvm/llvm-project.git cc61409d353a40f62d3a137f3c7436aa00df779d)"}