|
| 1 | +;=========================== begin_copyright_notice ============================ |
| 2 | +; |
| 3 | +; Copyright (C) 2024 Intel Corporation |
| 4 | +; |
| 5 | +; SPDX-License-Identifier: MIT |
| 6 | +; |
| 7 | +;============================ end_copyright_notice ============================= |
| 8 | +; RUN: igc_opt -igc-opencl-printf-resolution -S < %s | FileCheck %s |
| 9 | +; ------------------------------------------------ |
| 10 | +; OpenCLPrintfResolution |
| 11 | +; ------------------------------------------------ |
| 12 | + |
| 13 | +%struct.A.base = type <{ i8 addrspace(4)*, i32 }> |
| 14 | +%struct.B = type { %struct.A.base, [4 x i8] } |
| 15 | + |
| 16 | +@.str = internal unnamed_addr addrspace(2) constant [19 x i8] c"constructed A: %p\0A\00", align 1, !spirv.Decorations !0 |
| 17 | +@.priv.__global = internal addrspace(1) global %struct.B zeroinitializer |
| 18 | + |
| 19 | +; Function Attrs: nounwind |
| 20 | +define spir_kernel void @struct_printf_call(i32 addrspace(1)* %out, <8 x i32> %r0, <8 x i32> %payloadHeader, i8 addrspace(2)* %constBase, i8* %privateBase, i8 addrspace(1)* %printfBuffer) #0 { |
| 21 | +entry: |
| 22 | + %str = getelementptr inbounds [19 x i8], [19 x i8] addrspace(2)* @.str, i64 0, i64 0 |
| 23 | + %bc = bitcast %struct.B addrspace(1)* @.priv.__global to i8 addrspace(1)* |
| 24 | + %asc = addrspacecast i8 addrspace(1)* %bc to i8 addrspace(4)* |
| 25 | +; CHECK: [[TMP1:%[A-z0-9]*]] = bitcast %struct.B addrspace(1)* @.priv.__global to i8 addrspace(1)* |
| 26 | +; CHECK: [[TMP2:%[A-z0-9]*]] = addrspacecast i8 addrspace(1)* [[TMP1]] to i8 addrspace(4)* |
| 27 | +; CHECK: [[TMP3:%[A-z0-9]*]] = ptrtoint i8 addrspace(4)* [[TMP2]] to i64 |
| 28 | +; CHECK-NOT: [[TMP4:%[A-z0-9]*]] = ptrtoint %struct.B addrspace(1)* @.priv.__global to i64 |
| 29 | +; CHECK: store i64 [[TMP3]] |
| 30 | + %call = call spir_func i32 (i8 addrspace(2)*, ...) @printf(i8 addrspace(2)* %str, i8 addrspace(4)* %asc) #0 |
| 31 | + store i32 %call, i32 addrspace(1)* %out, align 4 |
| 32 | + ret void |
| 33 | +} |
| 34 | + |
| 35 | +; Function Attrs: nounwind |
| 36 | +declare spir_func i32 @printf(i8 addrspace(2)*, ...) #0 |
| 37 | + |
| 38 | +attributes #0 = { nounwind } |
| 39 | + |
| 40 | +!igc.functions = !{!0} |
| 41 | +!IGCMetadata = !{!9} |
| 42 | + |
| 43 | +!0 = !{void (i32 addrspace(1)*, <8 x i32>, <8 x i32>, i8 addrspace(2)*, i8*, i8 addrspace(1)*)* @struct_printf_call, !1} |
| 44 | +!1 = !{!2, !3} |
| 45 | +!2 = !{!"function_type", i32 0} |
| 46 | +!3 = !{!"implicit_arg_desc", !4, !5, !6, !7, !8} |
| 47 | +!4 = !{i32 0} |
| 48 | +!5 = !{i32 1} |
| 49 | +!6 = !{i32 10} |
| 50 | +!7 = !{i32 12} |
| 51 | +!8 = !{i32 13} |
| 52 | +!9 = !{!"ModuleMD", !10} |
| 53 | +!10 = !{!"FuncMD", !11, !12} |
| 54 | +!11 = distinct !{!"FuncMDMap[0]", void (i32 addrspace(1)*, <8 x i32>, <8 x i32>, i8 addrspace(2)*, i8*, i8 addrspace(1)*)* @struct_printf_call} |
| 55 | +!12 = !{!"FuncMDValue[0]", !13, !14, !15} |
| 56 | +!13 = !{!"localOffsets"} |
| 57 | +!14 = !{!"funcArgs"} |
| 58 | +!15 = !{!"functionType", !"KernelFunction"} |
0 commit comments