|
1 | 1 | // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
2 | | -// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type -fnative-int16-type \ |
3 | | -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s -DTARGET=dx |
| 2 | +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ |
| 3 | +// RUN: -fnative-int16-type -emit-llvm -o - | FileCheck %s -DTARGET=dx |
4 | 4 | // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ |
5 | | -// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type -fnative-int16-type \ |
6 | | -// RUN: -emit-llvm -disable-llvm-passes \ |
7 | | -// RUN: -o - | FileCheck %s -DTARGET=spv |
| 5 | +// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ |
| 6 | +// RUN: -fnative-int16-type -emit-llvm -o - | FileCheck %s -DTARGET=spv |
8 | 7 |
|
9 | 8 | #ifdef __HLSL_ENABLE_16_BIT |
10 | 9 | // CHECK-LABEL: test_firstbithigh_ushort |
11 | | -// CHECK: call i32 @llvm.[[TARGET]].firstbituhigh.i16 |
| 10 | +// CHECK: [[FBH:%.*]] = call i32 @llvm.[[TARGET]].firstbituhigh.i16 |
| 11 | +// CHECK: sub i32 15, [[FBH]] |
12 | 12 | uint test_firstbithigh_ushort(uint16_t p0) { |
13 | 13 | return firstbithigh(p0); |
14 | 14 | } |
15 | 15 |
|
16 | 16 | // CHECK-LABEL: test_firstbithigh_ushort2 |
17 | | -// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbituhigh.v2i16 |
| 17 | +// CHECK: [[FBH:%.*]] = call <2 x i32> @llvm.[[TARGET]].firstbituhigh.v2i16 |
| 18 | +// CHECK: sub <2 x i32> splat (i32 15), [[FBH]] |
18 | 19 | uint2 test_firstbithigh_ushort2(uint16_t2 p0) { |
19 | 20 | return firstbithigh(p0); |
20 | 21 | } |
21 | 22 |
|
22 | 23 | // CHECK-LABEL: test_firstbithigh_ushort3 |
23 | | -// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbituhigh.v3i16 |
| 24 | +// CHECK: [[FBH:%.*]] = call <3 x i32> @llvm.[[TARGET]].firstbituhigh.v3i16 |
| 25 | +// CHECK: sub <3 x i32> splat (i32 15), [[FBH]] |
24 | 26 | uint3 test_firstbithigh_ushort3(uint16_t3 p0) { |
25 | 27 | return firstbithigh(p0); |
26 | 28 | } |
27 | 29 |
|
28 | 30 | // CHECK-LABEL: test_firstbithigh_ushort4 |
29 | | -// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbituhigh.v4i16 |
| 31 | +// CHECK: [[FBH:%.*]] = call <4 x i32> @llvm.[[TARGET]].firstbituhigh.v4i16 |
| 32 | +// CHECK: sub <4 x i32> splat (i32 15), [[FBH]] |
30 | 33 | uint4 test_firstbithigh_ushort4(uint16_t4 p0) { |
31 | 34 | return firstbithigh(p0); |
32 | 35 | } |
33 | 36 |
|
34 | 37 | // CHECK-LABEL: test_firstbithigh_short |
35 | | -// CHECK: call i32 @llvm.[[TARGET]].firstbitshigh.i16 |
| 38 | +// CHECK: [[FBH:%.*]] = call i32 @llvm.[[TARGET]].firstbitshigh.i16 |
| 39 | +// CHECK: sub i32 15, [[FBH]] |
36 | 40 | uint test_firstbithigh_short(int16_t p0) { |
37 | 41 | return firstbithigh(p0); |
38 | 42 | } |
39 | 43 |
|
40 | 44 | // CHECK-LABEL: test_firstbithigh_short2 |
41 | | -// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbitshigh.v2i16 |
| 45 | +// CHECK: [[FBH:%.*]] = call <2 x i32> @llvm.[[TARGET]].firstbitshigh.v2i16 |
| 46 | +// CHECK: sub <2 x i32> splat (i32 15), [[FBH]] |
42 | 47 | uint2 test_firstbithigh_short2(int16_t2 p0) { |
43 | 48 | return firstbithigh(p0); |
44 | 49 | } |
45 | 50 |
|
46 | 51 | // CHECK-LABEL: test_firstbithigh_short3 |
47 | | -// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbitshigh.v3i16 |
| 52 | +// CHECK: [[FBH:%.*]] = call <3 x i32> @llvm.[[TARGET]].firstbitshigh.v3i16 |
| 53 | +// CHECK: sub <3 x i32> splat (i32 15), [[FBH]] |
48 | 54 | uint3 test_firstbithigh_short3(int16_t3 p0) { |
49 | 55 | return firstbithigh(p0); |
50 | 56 | } |
51 | 57 |
|
52 | 58 | // CHECK-LABEL: test_firstbithigh_short4 |
53 | | -// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbitshigh.v4i16 |
| 59 | +// CHECK: [[FBH:%.*]] = call <4 x i32> @llvm.[[TARGET]].firstbitshigh.v4i16 |
| 60 | +// CHECK: sub <4 x i32> splat (i32 15), [[FBH]] |
54 | 61 | uint4 test_firstbithigh_short4(int16_t4 p0) { |
55 | 62 | return firstbithigh(p0); |
56 | 63 | } |
57 | 64 | #endif // __HLSL_ENABLE_16_BIT |
58 | 65 |
|
59 | 66 | // CHECK-LABEL: test_firstbithigh_uint |
60 | | -// CHECK: call i32 @llvm.[[TARGET]].firstbituhigh.i32 |
| 67 | +// CHECK: [[FBH:%.*]] = call i32 @llvm.[[TARGET]].firstbituhigh.i32 |
| 68 | +// CHECK: sub i32 31, [[FBH]] |
61 | 69 | uint test_firstbithigh_uint(uint p0) { |
62 | 70 | return firstbithigh(p0); |
63 | 71 | } |
64 | 72 |
|
65 | 73 | // CHECK-LABEL: test_firstbithigh_uint2 |
66 | | -// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbituhigh.v2i32 |
| 74 | +// CHECK: [[FBH:%.*]] = call <2 x i32> @llvm.[[TARGET]].firstbituhigh.v2i32 |
| 75 | +// CHECK: sub <2 x i32> splat (i32 31), [[FBH]] |
67 | 76 | uint2 test_firstbithigh_uint2(uint2 p0) { |
68 | 77 | return firstbithigh(p0); |
69 | 78 | } |
70 | 79 |
|
71 | 80 | // CHECK-LABEL: test_firstbithigh_uint3 |
72 | | -// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbituhigh.v3i32 |
| 81 | +// CHECK: [[FBH:%.*]] = call <3 x i32> @llvm.[[TARGET]].firstbituhigh.v3i32 |
| 82 | +// CHECK: sub <3 x i32> splat (i32 31), [[FBH]] |
73 | 83 | uint3 test_firstbithigh_uint3(uint3 p0) { |
74 | 84 | return firstbithigh(p0); |
75 | 85 | } |
76 | 86 |
|
77 | 87 | // CHECK-LABEL: test_firstbithigh_uint4 |
78 | | -// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbituhigh.v4i32 |
| 88 | +// CHECK: [[FBH:%.*]] = call <4 x i32> @llvm.[[TARGET]].firstbituhigh.v4i32 |
| 89 | +// CHECK: sub <4 x i32> splat (i32 31), [[FBH]] |
79 | 90 | uint4 test_firstbithigh_uint4(uint4 p0) { |
80 | 91 | return firstbithigh(p0); |
81 | 92 | } |
82 | 93 |
|
83 | 94 | // CHECK-LABEL: test_firstbithigh_ulong |
84 | | -// CHECK: call i32 @llvm.[[TARGET]].firstbituhigh.i64 |
| 95 | +// CHECK: [[FBH:%.*]] = call i32 @llvm.[[TARGET]].firstbituhigh.i64 |
| 96 | +// CHECK: sub i32 63, [[FBH]] |
85 | 97 | uint test_firstbithigh_ulong(uint64_t p0) { |
86 | 98 | return firstbithigh(p0); |
87 | 99 | } |
88 | 100 |
|
89 | 101 | // CHECK-LABEL: test_firstbithigh_ulong2 |
90 | | -// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbituhigh.v2i64 |
| 102 | +// CHECK: [[FBH:%.*]] = call <2 x i32> @llvm.[[TARGET]].firstbituhigh.v2i64 |
| 103 | +// CHECK: sub <2 x i32> splat (i32 63), [[FBH]] |
91 | 104 | uint2 test_firstbithigh_ulong2(uint64_t2 p0) { |
92 | 105 | return firstbithigh(p0); |
93 | 106 | } |
94 | 107 |
|
95 | 108 | // CHECK-LABEL: test_firstbithigh_ulong3 |
96 | | -// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbituhigh.v3i64 |
| 109 | +// CHECK: [[FBH:%.*]] = call <3 x i32> @llvm.[[TARGET]].firstbituhigh.v3i64 |
| 110 | +// CHECK: sub <3 x i32> splat (i32 63), [[FBH]] |
97 | 111 | uint3 test_firstbithigh_ulong3(uint64_t3 p0) { |
98 | 112 | return firstbithigh(p0); |
99 | 113 | } |
100 | 114 |
|
101 | 115 | // CHECK-LABEL: test_firstbithigh_ulong4 |
102 | | -// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbituhigh.v4i64 |
| 116 | +// CHECK: [[FBH:%.*]] = call <4 x i32> @llvm.[[TARGET]].firstbituhigh.v4i64 |
| 117 | +// CHECK: sub <4 x i32> splat (i32 63), [[FBH]] |
103 | 118 | uint4 test_firstbithigh_ulong4(uint64_t4 p0) { |
104 | 119 | return firstbithigh(p0); |
105 | 120 | } |
106 | 121 |
|
107 | 122 | // CHECK-LABEL: test_firstbithigh_int |
108 | | -// CHECK: call i32 @llvm.[[TARGET]].firstbitshigh.i32 |
| 123 | +// CHECK: [[FBH:%.*]] = call i32 @llvm.[[TARGET]].firstbitshigh.i32 |
| 124 | +// CHECK: sub i32 31, [[FBH]] |
109 | 125 | uint test_firstbithigh_int(int p0) { |
110 | 126 | return firstbithigh(p0); |
111 | 127 | } |
112 | 128 |
|
113 | 129 | // CHECK-LABEL: test_firstbithigh_int2 |
114 | | -// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbitshigh.v2i32 |
| 130 | +// CHECK: [[FBH:%.*]] = call <2 x i32> @llvm.[[TARGET]].firstbitshigh.v2i32 |
| 131 | +// CHECK: sub <2 x i32> splat (i32 31), [[FBH]] |
115 | 132 | uint2 test_firstbithigh_int2(int2 p0) { |
116 | 133 | return firstbithigh(p0); |
117 | 134 | } |
118 | 135 |
|
119 | 136 | // CHECK-LABEL: test_firstbithigh_int3 |
120 | | -// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbitshigh.v3i32 |
| 137 | +// CHECK: [[FBH:%.*]] = call <3 x i32> @llvm.[[TARGET]].firstbitshigh.v3i32 |
| 138 | +// CHECK: sub <3 x i32> splat (i32 31), [[FBH]] |
121 | 139 | uint3 test_firstbithigh_int3(int3 p0) { |
122 | 140 | return firstbithigh(p0); |
123 | 141 | } |
124 | 142 |
|
125 | 143 | // CHECK-LABEL: test_firstbithigh_int4 |
126 | | -// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbitshigh.v4i32 |
| 144 | +// CHECK: [[FBH:%.*]] = call <4 x i32> @llvm.[[TARGET]].firstbitshigh.v4i32 |
| 145 | +// CHECK: sub <4 x i32> splat (i32 31), [[FBH]] |
127 | 146 | uint4 test_firstbithigh_int4(int4 p0) { |
128 | 147 | return firstbithigh(p0); |
129 | 148 | } |
130 | 149 |
|
131 | 150 | // CHECK-LABEL: test_firstbithigh_long |
132 | | -// CHECK: call i32 @llvm.[[TARGET]].firstbitshigh.i64 |
| 151 | +// CHECK: [[FBH:%.*]] = call i32 @llvm.[[TARGET]].firstbitshigh.i64 |
| 152 | +// CHECK: sub i32 63, [[FBH]] |
133 | 153 | uint test_firstbithigh_long(int64_t p0) { |
134 | 154 | return firstbithigh(p0); |
135 | 155 | } |
136 | 156 |
|
137 | 157 | // CHECK-LABEL: test_firstbithigh_long2 |
138 | | -// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbitshigh.v2i64 |
| 158 | +// CHECK: [[FBH:%.*]] = call <2 x i32> @llvm.[[TARGET]].firstbitshigh.v2i64 |
| 159 | +// CHECK: sub <2 x i32> splat (i32 63), [[FBH]] |
139 | 160 | uint2 test_firstbithigh_long2(int64_t2 p0) { |
140 | 161 | return firstbithigh(p0); |
141 | 162 | } |
142 | 163 |
|
143 | 164 | // CHECK-LABEL: test_firstbithigh_long3 |
144 | | -// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbitshigh.v3i64 |
| 165 | +// CHECK: [[FBH:%.*]] = call <3 x i32> @llvm.[[TARGET]].firstbitshigh.v3i64 |
| 166 | +// CHECK: sub <3 x i32> splat (i32 63), [[FBH]] |
145 | 167 | uint3 test_firstbithigh_long3(int64_t3 p0) { |
146 | 168 | return firstbithigh(p0); |
147 | 169 | } |
148 | 170 |
|
149 | 171 | // CHECK-LABEL: test_firstbithigh_long4 |
150 | | -// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbitshigh.v4i64 |
| 172 | +// CHECK: [[FBH:%.*]] = call <4 x i32> @llvm.[[TARGET]].firstbitshigh.v4i64 |
| 173 | +// CHECK: sub <4 x i32> splat (i32 63), [[FBH]] |
151 | 174 | uint4 test_firstbithigh_long4(int64_t4 p0) { |
152 | 175 | return firstbithigh(p0); |
153 | 176 | } |
154 | 177 |
|
155 | 178 | // CHECK-LABEL: test_firstbithigh_upcast |
156 | 179 | // CHECK: [[FBH:%.*]] = call <4 x i32> @llvm.[[TARGET]].firstbituhigh.v4i32(<4 x i32> %{{.*}}) |
157 | | -// CHECK: [[CONV:%.*]] = zext <4 x i32> [[FBH]] to <4 x i64> |
| 180 | +// CHECK: [[SUB:%.*]] = sub <4 x i32> splat (i32 31), [[FBH]] |
| 181 | +// CHECK: [[CONV:%.*]] = zext <4 x i32> [[SUB]] to <4 x i64> |
158 | 182 | // CHECK: ret <4 x i64> [[CONV]] |
159 | 183 | uint64_t4 test_firstbithigh_upcast(uint4 p0) { |
160 | 184 | return firstbithigh(p0); |
|
0 commit comments