|
| 1 | +;=========================== begin_copyright_notice ============================ |
| 2 | +; |
| 3 | +; Copyright (C) 2023 Intel Corporation |
| 4 | +; |
| 5 | +; SPDX-License-Identifier: MIT |
| 6 | +; |
| 7 | +;============================ end_copyright_notice ============================= |
| 8 | +; REQUIRES: regkeys |
| 9 | +; RUN: igc_opt --serialize-igc-metadata -igc-programscope-constant-analysis \ |
| 10 | +; RUN: -S -regkey EnableZEBinary=1 < %s | FileCheck %s |
| 11 | +; ------------------------------------------------ |
| 12 | +; ProgramScopeConstantAnalysis |
| 13 | +; ------------------------------------------------ |
| 14 | + |
| 15 | +; Test checks that metadata can be updated correctly with non-constant address |
| 16 | +; space string constants after the address space requirement is relaxed when |
| 17 | +; EnableZEBinary=1 |
| 18 | + |
| 19 | +; CHECK: !{!"stringConstants", |
| 20 | +; CHECK-DAG: !{!"stringConstantsSet{{[[][0-9][]]}}", [3 x i8] addrspace(2)* @fmt_str} |
| 21 | +; CHECK-DAG: !{!"stringConstantsSet{{[[][0-9][]]}}", [3 x i8] addrspace(1)* @opencl_printf_str} |
| 22 | +; CHECK-DAG: !{!"stringConstantsSet{{[[][0-9][]]}}", [3 x i8] addrspace(1)* @sycl_v1_printf_str} |
| 23 | +; CHECK-DAG: !{!"stringConstantsSet{{[[][0-9][]]}}", [3 x i8] addrspace(1)* @sycl_v2_printf_str} |
| 24 | +; CHECK-DAG: !{!"stringConstantsSet{{[[][0-9][]]}}", [3 x i8] addrspace(1)* @cl_sycl_printf_str} |
| 25 | + |
| 26 | +@fmt_str = internal unnamed_addr addrspace(2) constant [3 x i8] c"%s\00", align 1 |
| 27 | +@opencl_printf_str = internal unnamed_addr addrspace(1) constant [3 x i8] c"A\0A\00", align 1 |
| 28 | +@sycl_v1_printf_str = internal unnamed_addr addrspace(1) constant [3 x i8] c"B\0A\00", align 1 |
| 29 | +@sycl_v2_printf_str = internal unnamed_addr addrspace(1) constant [3 x i8] c"C\0A\00", align 1 |
| 30 | +@cl_sycl_printf_str = internal unnamed_addr addrspace(1) constant [3 x i8] c"D\0A\00", align 1 |
| 31 | + |
| 32 | +; decl of opencl printf |
| 33 | +declare spir_func i32 @printf(i8 addrspace(2)*, ...) |
| 34 | + |
| 35 | +; decl of sycl v1 oneapi printf |
| 36 | +declare spir_func i32 @_ZN4sycl3_V13ext6oneapi12experimental6printfIU3AS2cJEEEiPKT_DpT0_(i8 addrspace(2)*, ...) |
| 37 | + |
| 38 | +; decl of future sycl v2 oneapi printf |
| 39 | +declare spir_func i32 @_ZN4sycl3_V23ext6oneapi12experimental6printfIU3AS2cJEEEiPKT_DpT0_(i8 addrspace(2)*, ...) |
| 40 | + |
| 41 | +; decl of deprecated cl sycl oneapi printf |
| 42 | +declare spir_func i32 @_ZN2cl4sycl3ext6oneapi12experimental6printfIU3AS2cJEEEiPKT_DpT0_(i8 addrspace(2)*, ...) |
| 43 | + |
| 44 | +; Function Attrs: convergent noinline nounwind optnone |
| 45 | +define spir_func void @foo() { |
| 46 | + %1 = getelementptr inbounds [3 x i8], [3 x i8] addrspace(2)* @fmt_str, i32 0, i32 0 |
| 47 | + %2 = getelementptr inbounds [3 x i8], [3 x i8] addrspace(1)* @opencl_printf_str, i64 0, i64 0 |
| 48 | + %3 = addrspacecast i8 addrspace(1)* %2 to i8 addrspace(4)* |
| 49 | + %4 = call spir_func i32 (i8 addrspace(2)*, ...) @printf(i8 addrspace(2)* %1, i8 addrspace(4)* %3) |
| 50 | + %5 = getelementptr inbounds [3 x i8], [3 x i8] addrspace(1)* @sycl_v1_printf_str, i64 0, i64 0 |
| 51 | + %6 = addrspacecast i8 addrspace(1)* %5 to i8 addrspace(4)* |
| 52 | + %7 = call spir_func i32 (i8 addrspace(2)*, ...) @_ZN4sycl3_V13ext6oneapi12experimental6printfIU3AS2cJEEEiPKT_DpT0_(i8 addrspace(2)* %1, i8 addrspace(4)* %6) |
| 53 | + %8 = getelementptr inbounds [3 x i8], [3 x i8] addrspace(1)* @sycl_v2_printf_str, i64 0, i64 0 |
| 54 | + %9 = addrspacecast i8 addrspace(1)* %8 to i8 addrspace(4)* |
| 55 | + %10 = call spir_func i32 (i8 addrspace(2)*, ...) @_ZN4sycl3_V23ext6oneapi12experimental6printfIU3AS2cJEEEiPKT_DpT0_(i8 addrspace(2)* %1, i8 addrspace(4)* %9) |
| 56 | + %11 = getelementptr inbounds [3 x i8], [3 x i8] addrspace(1)* @cl_sycl_printf_str, i64 0, i64 0 |
| 57 | + %12 = addrspacecast i8 addrspace(1)* %11 to i8 addrspace(4)* |
| 58 | + %13 = call spir_func i32 (i8 addrspace(2)*, ...) @_ZN2cl4sycl3ext6oneapi12experimental6printfIU3AS2cJEEEiPKT_DpT0_(i8 addrspace(2)* %1, i8 addrspace(4)* %12) |
| 59 | + ret void |
| 60 | +} |
0 commit comments