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