1- // RUN: %dxc -O3 -T lib_6_8 -HV 2021 -spirv -fcgl -fspv-target-env=universal1.5 %s | FileCheck %s
1+ // RUN: %dxc %s -T lib_6_8 -E main -spirv -enable-16bit-types
22
3- template <typename S> struct Trait;
3+ // CHECK-DAG: %ulong = OpTypeInt 64 0
4+ // CHECK-DAG: %long = OpTypeInt 64 1
45
5- template <> struct Trait<int64_t> {
6- using type = int64_t;
7- static const type value = -42 ;
6+ template <typename T> struct S {
7+ static const T value = 0 ;
88};
99
10- Trait<int64_t>::type get_s64_value () {
11- return Trait<int64_t>::value;
10+ // CHECK: %u = OpFunction %void None
11+ [shader ("vertex" )]
12+ uint64_t u () : A
13+ {
14+ // CHECK: OpStore %out_var_A %ulong_0
15+ return S<uint64_t>::value;
1216}
1317
14- int64_t cvt_s64 (int64_t x) { return int64_t (x); }
15-
16- template <> struct Trait<uint64_t> {
17- using type = uint64_t;
18- static const type value = 1337ull;
19- };
20-
21- Trait<uint64_t>::type get_u64_value () {
22- return Trait<uint64_t>::value;
23- }
24-
25- uint64_t cvt_u64 (uint64_t x) { return uint64_t (x); }
26-
27- // CHECK-LABEL: %testcase_s64 = OpFunction %long
28- export int64_t testcase_s64 (int x) {
29- if (x == 2 ) {
30- // CHECK: OpReturnValue %long_n42
31- return int64_t (Trait<int64_t>::value);
32- }
33- else if (x == 4 ) {
34- // CHECK: OpStore %param_var_x %long_n42
35- // CHECK-NEXT: OpFunctionCall %long %cvt_s64 %param_var_x
36- return cvt_s64 (Trait<int64_t>::value);
37- } else if (x == 8 ) {
38- return get_s64_value ();
39- }
40- return 0ll;
41- }
42-
43- // CHECK-LABEL: %testcase_u64 = OpFunction %ulong
44- export uint64_t testcase_u64 (int x) {
45- if (x == 2 ) {
46- // CHECK: OpReturnValue %ulong_1337
47- return uint64_t (Trait<uint64_t>::value);
48- }
49- else if (x == 4 ) {
50- // CHECK: OpStore %param_var_x_0 %ulong_1337
51- // CHECK-NEXT: OpFunctionCall %ulong %cvt_u64 %param_var_x_0
52- return cvt_u64 (Trait<uint64_t>::value);
53- } else if (x == 8 ) {
54- return get_u64_value ();
55- }
56- return 0ull;
57- }
58-
59- // CHECK-LABEL: %get_s64_value = OpFunction %long
60- // CHECK-LABEL: %get_u64_value = OpFunction %ulong
18+ // CHECK: %s = OpFunction %void None
19+ [shader ("vertex" )]
20+ int64_t s () : B
21+ {
22+ // CHECK: OpStore %out_var_A %long_0
23+ return S<int64_t>::value;
24+ }
0 commit comments