xref: /llvm-project/clang/test/CodeGenHLSL/static_global_and_function_in_cb.hlsl (revision d92bac8a3ebb19106f6bca6b7613a27c52cb48ab)
1// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \
2// RUN:   -emit-llvm -disable-llvm-passes -o - | FileCheck %s
3
4// RUN: %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan-library %s \
5// RUN:   -emit-llvm -disable-llvm-passes -o - | FileCheck %s
6
7cbuffer A {
8  // CHECK: @a = external addrspace(2) externally_initialized global float, align 4
9  float a;
10  // CHECK: @_ZL1b = internal global float 3.000000e+00, align 4
11  static float b = 3;
12  float foo() { return a + b; }
13}
14// CHECK: @[[CB:.+]] = external constant { float }
15
16// CHECK:define {{.*}} float @_Z3foov()
17// CHECK:load float, ptr addrspace(2) @a, align 4
18// CHECK:load float, ptr @_ZL1b, align 4
19
20float bar() {
21  return foo();
22}
23