1; Check duplicate operands in opencl.ocl.version metadata is accepted without 2; assertion. 3 4; RUN: llvm-as < %s | llvm-spirv -spirv-text -o %t 5; RUN: FileCheck < %t %s 6 7; ModuleID = 'clver.bc' 8target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" 9target triple = "spir64-unknown-unknown" 10 11%struct.my_struct_t = type { i8, i32 } 12 13@var = addrspace(1) global %struct.my_struct_t { i8 97, i32 42 }, align 4 14 15; Function Attrs: nounwind 16define spir_kernel void @__OpenCL_writer_kernel(i8 zeroext %c, i32 %i) #0 { 17entry: 18 %c.addr = alloca i8, align 1 19 %i.addr = alloca i32, align 4 20 store i8 %c, i8* %c.addr, align 1, !tbaa !14 21 store i32 %i, i32* %i.addr, align 4, !tbaa !17 22 %0 = load i8, i8* %c.addr, align 1, !tbaa !14 23 store i8 %0, i8 addrspace(1)* getelementptr inbounds (%struct.my_struct_t, %struct.my_struct_t addrspace(1)* @var, i32 0, i32 0), align 1, !tbaa !19 24 %1 = load i32, i32* %i.addr, align 4, !tbaa !17 25 store i32 %1, i32 addrspace(1)* getelementptr inbounds (%struct.my_struct_t, %struct.my_struct_t addrspace(1)* @var, i32 0, i32 1), align 4, !tbaa !21 26 ret void 27} 28 29; Function Attrs: nounwind 30define spir_kernel void @__OpenCL_reader_kernel(i8 addrspace(1)* %C, i32 addrspace(1)* %I) #0 { 31entry: 32 %C.addr = alloca i8 addrspace(1)*, align 8 33 %I.addr = alloca i32 addrspace(1)*, align 8 34 store i8 addrspace(1)* %C, i8 addrspace(1)** %C.addr, align 8, !tbaa !22 35 store i32 addrspace(1)* %I, i32 addrspace(1)** %I.addr, align 8, !tbaa !22 36 %0 = load i8, i8 addrspace(1)* getelementptr inbounds (%struct.my_struct_t, %struct.my_struct_t addrspace(1)* @var, i32 0, i32 0), align 1, !tbaa !19 37 %1 = load i8 addrspace(1)*, i8 addrspace(1)** %C.addr, align 8, !tbaa !22 38 store i8 %0, i8 addrspace(1)* %1, align 1, !tbaa !14 39 %2 = load i32, i32 addrspace(1)* getelementptr inbounds (%struct.my_struct_t, %struct.my_struct_t addrspace(1)* @var, i32 0, i32 1), align 4, !tbaa !21 40 %3 = load i32 addrspace(1)*, i32 addrspace(1)** %I.addr, align 8, !tbaa !22 41 store i32 %2, i32 addrspace(1)* %3, align 4, !tbaa !17 42 ret void 43} 44 45attributes #0 = { nounwind } 46 47; "cl_images" should be encoded as BasicImage capability, 48; but images are not used in this test case, so this capability is not required. 49; CHECK-DAG-NOT: 4 Extension "cl_images" 50; CHECK-DAG: 8 Extension "cl_khr_int64_base_atomics" 51; CHECK-DAG: 9 Extension "cl_khr_int64_extended_atomics" 52; CHECK: 3 Source 3 200000 53 54!opencl.kernels = !{!0, !7} 55!opencl.enable.FP_CONTRACT = !{} 56!llvm.ident = !{!12, !12} 57!opencl.ocl.version = !{!13, !13} 58!opencl.spir.version = !{!13, !13} 59!opencl.used.extensions = !{!24, !25} 60!opencl.used.optional.core.features = !{!26, !27} 61 62!0 = !{void (i8, i32)* @__OpenCL_writer_kernel, !1, !2, !3, !4, !5, !6} 63!1 = !{!"kernel_arg_addr_space", i32 0, i32 0} 64!2 = !{!"kernel_arg_access_qual", !"none", !"none"} 65!3 = !{!"kernel_arg_type", !"uchar", !"uint"} 66!4 = !{!"kernel_arg_base_type", !"uchar", !"uint"} 67!5 = !{!"kernel_arg_type_qual", !"", !""} 68!6 = !{!"kernel_arg_name", !"c", !"i"} 69!7 = !{void (i8 addrspace(1)*, i32 addrspace(1)*)* @__OpenCL_reader_kernel, !8, !2, !9, !10, !5, !11} 70!8 = !{!"kernel_arg_addr_space", i32 1, i32 1} 71!9 = !{!"kernel_arg_type", !"uchar*", !"uint*"} 72!10 = !{!"kernel_arg_base_type", !"uchar*", !"uint*"} 73!11 = !{!"kernel_arg_name", !"C", !"I"} 74!12 = !{!"clang version 3.6 (tags/RELEASE_361/rc1)"} 75!13 = !{i32 2, i32 0} 76!14 = !{!15, !15, i64 0} 77!15 = !{!"omnipotent char", !16, i64 0} 78!16 = !{!"Simple C/C++ TBAA"} 79!17 = !{!18, !18, i64 0} 80!18 = !{!"int", !15, i64 0} 81!19 = !{!20, !15, i64 0} 82!20 = !{!"", !15, i64 0, !18, i64 4} 83!21 = !{!20, !18, i64 4} 84!22 = !{!23, !23, i64 0} 85!23 = !{!"any pointer", !15, i64 0} 86!24 = !{!"cl_khr_int64_base_atomics"} 87!25 = !{!"cl_khr_int64_base_atomics", !"cl_khr_int64_extended_atomics"} 88!26 = !{!"cl_images"} 89!27 = !{!""} 90