Debian Codegraph @

clang/test/CodeGenHLSL/builtins/or.hlsl

raw
1 // RUN: %clang_cc1 -finclude-default-header -triple \
2 // RUN: dxil-pc-shadermodel6.3-library %s \
3 // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
4
5 // CHECK-LABEL: define hidden noundef i1 @_Z14test_or_scalarbb(
6 // CHECK-SAME: i1 noundef [[X:%.*]], i1 noundef [[Y:%.*]]) #[[ATTR0:[0-9]+]] {
7 // CHECK-NEXT: entry:
8 // CHECK: [[HLSL_OR:%.*]] = or i1 [[A:%.*]], [[B:%.*]]
9 // CHECK: ret i1 [[HLSL_OR]]
10 bool test_or_scalar(bool x, bool y)
11 {
12 return or(x, y);
13 }
14
15 // CHECK-LABEL: define hidden noundef <2 x i1> @_Z13test_or_bool2Dv2_bS_(
16 // CHECK-SAME: <2 x i1> noundef [[X:%.*]], <2 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
17 // CHECK-NEXT: entry:
18 // CHECK: [[HLSL_OR:%.*]] = or <2 x i1> [[A:%.*]], [[B:%.*]]
19 // CHECK: ret <2 x i1> [[HLSL_OR]]
20 bool2 test_or_bool2(bool2 x, bool2 y)
21 {
22 return or(x, y);
23 }
24
25 // CHECK-LABEL: define hidden noundef <3 x i1> @_Z13test_or_bool3Dv3_bS_(
26 // CHECK-SAME: <3 x i1> noundef [[X:%.*]], <3 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
27 // CHECK-NEXT: entry:
28 // CHECK: [[HLSL_OR:%.*]] = or <3 x i1> [[A:%.*]], [[B:%.*]]
29 // CHECK: ret <3 x i1> [[HLSL_OR]]
30 bool3 test_or_bool3(bool3 x, bool3 y)
31 {
32 return or(x, y);
33 }
34
35 // CHECK-LABEL: define hidden noundef <4 x i1> @_Z13test_or_bool4Dv4_bS_(
36 // CHECK-SAME: <4 x i1> noundef [[X:%.*]], <4 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
37 // CHECK-NEXT: entry:
38 // CHECK: [[HLSL_OR:%.*]] = or <4 x i1> [[A:%.*]], [[B:%.*]]
39 // CHECK: ret <4 x i1> [[HLSL_OR]]
40 bool4 test_or_bool4(bool4 x, bool4 y)
41 {
42 return or(x, y);
43 }
44
45 // CHECK-LABEL: define hidden noundef i1 @_Z11test_or_intii(
46 // CHECK-SAME: i32 noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR0]] {
47 // CHECK-NEXT: entry:
48 // CHECK: [[TOBBOL:%.*]] = icmp ne i32 [[A:%.*]], 0
49 // CHECK: [[TOBBOL1:%.*]] = icmp ne i32 [[B:%.*]], 0
50 // CHECK: [[HLSL_OR:%.*]] = or i1 [[TOBBOL]], [[TOBBOL1]]
51 // CHECK: ret i1 [[HLSL_OR]]
52 bool test_or_int(int x, int y)
53 {
54 return or(x, y);
55 }
56
57 // CHECK-LABEL: define hidden noundef <4 x i1> @_Z12test_or_int4Dv4_iS_(
58 // CHECK-SAME: <4 x i32> noundef [[X:%.*]], <4 x i32> noundef [[Y:%.*]]) #[[ATTR0]] {
59 // CHECK-NEXT: entry:
60 // CHECK: [[TOBOOL:%.*]] = icmp ne <4 x i32> [[A:%.*]], zeroinitializer
61 // CHECK: [[TOBOOL1:%.*]] = icmp ne <4 x i32> [[B:%.*]], zeroinitializer
62 // CHECK: [[HLSL_OR:%.*]] = or <4 x i1> [[TOBOOL]], [[TOBOOL1]]
63 // CHECK: ret <4 x i1> [[HLSL_OR]]
64 bool4 test_or_int4(int4 x, int4 y)
65 {
66 return or(x, y);
67 }
68
69 // CHECK-LABEL: define hidden noundef <4 x i1> @_Z14test_or_float4Dv4_fS_(
70 // CHECK-SAME: <4 x float> noundef nofpclass(nan inf) [[X:%.*]], <4 x float> noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR0]] {
71 // CHECK-NEXT: entry:
72 // CHECK: [[TOBOOL:%.*]] = fcmp reassoc nnan ninf nsz arcp afn une <4 x float> [[A:%.*]], zeroinitializer
73 // CHECK: [[TOBOOL1:%.*]] = fcmp reassoc nnan ninf nsz arcp afn une <4 x float> [[B:%.*]], zeroinitializer
74 // CHECK: [[HLSL_OR:%.*]] = or <4 x i1> [[TOBOOL]], [[TOBOOL1]]
75 // CHECK: ret <4 x i1> [[HLSL_OR]]
76 bool4 test_or_float4(float4 x, float4 y)
77 {
78 return or(x, y);
79 }
80
81 // CHECK-LABEL: define hidden noundef <2 x i1> @_Z15test_or_bool1x2u11matrix_typeILm1ELm2EbES_(
82 // CHECK-SAME: <2 x i1> noundef [[X:%.*]], <2 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
83 // CHECK-NEXT: entry:
84 // CHECK: [[HLSL_OR:%.*]] = or <2 x i32> [[A:%.*]], [[B:%.*]]
85 // CHECK: ret <2 x i1> [[HLSL_OR_CAST:%.*]]
86 bool1x2 test_or_bool1x2(bool1x2 x, bool1x2 y)
87 {
88 return or(x, y);
89 }
90
91 // CHECK-LABEL: define hidden noundef <3 x i1> @_Z15test_or_bool1x3u11matrix_typeILm1ELm3EbES_(
92 // CHECK-SAME: <3 x i1> noundef [[X:%.*]], <3 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
93 // CHECK-NEXT: entry:
94 // CHECK: [[HLSL_OR:%.*]] = or <3 x i32> [[A:%.*]], [[B:%.*]]
95 // CHECK: ret <3 x i1> [[HLSL_OR_CAST:%.*]]
96 bool1x3 test_or_bool1x3(bool1x3 x, bool1x3 y)
97 {
98 return or(x, y);
99 }
100
101 // CHECK-LABEL: define hidden noundef <4 x i1> @_Z15test_or_bool1x4u11matrix_typeILm1ELm4EbES_(
102 // CHECK-SAME: <4 x i1> noundef [[X:%.*]], <4 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
103 // CHECK-NEXT: entry:
104 // CHECK: [[HLSL_OR:%.*]] = or <4 x i32> [[A:%.*]], [[B:%.*]]
105 // CHECK: ret <4 x i1> [[HLSL_OR_CAST:%.*]]
106 bool1x4 test_or_bool1x4(bool1x4 x, bool1x4 y)
107 {
108 return or(x, y);
109 }
110
111 // CHECK-LABEL: define hidden noundef <2 x i1> @_Z15test_or_bool2x1u11matrix_typeILm2ELm1EbES_(
112 // CHECK-SAME: <2 x i1> noundef [[X:%.*]], <2 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
113 // CHECK-NEXT: entry:
114 // CHECK: [[HLSL_OR:%.*]] = or <2 x i32> [[A:%.*]], [[B:%.*]]
115 // CHECK: ret <2 x i1> [[HLSL_OR_CAST:%.*]]
116 bool2x1 test_or_bool2x1(bool2x1 x, bool2x1 y)
117 {
118 return or(x, y);
119 }
120
121
122 // CHECK-LABEL: define hidden noundef <4 x i1> @_Z15test_or_bool2x2u11matrix_typeILm2ELm2EbES_(
123 // CHECK-SAME: <4 x i1> noundef [[X:%.*]], <4 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
124 // CHECK-NEXT: entry:
125 // CHECK: [[HLSL_OR:%.*]] = or <4 x i32> [[A:%.*]], [[B:%.*]]
126 // CHECK: ret <4 x i1> [[HLSL_OR_CAST:%.*]]
127 bool2x2 test_or_bool2x2(bool2x2 x, bool2x2 y)
128 {
129 return or(x, y);
130 }
131
132 // CHECK-LABEL: define hidden noundef <6 x i1> @_Z15test_or_bool2x3u11matrix_typeILm2ELm3EbES_(
133 // CHECK-SAME: <6 x i1> noundef [[X:%.*]], <6 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
134 // CHECK-NEXT: entry:
135 // CHECK: [[HLSL_OR:%.*]] = or <6 x i32> [[A:%.*]], [[B:%.*]]
136 // CHECK: ret <6 x i1> [[HLSL_OR_CAST:%.*]]
137 bool2x3 test_or_bool2x3(bool2x3 x, bool2x3 y)
138 {
139 return or(x, y);
140 }
141
142 // CHECK-LABEL: define hidden noundef <8 x i1> @_Z15test_or_bool2x4u11matrix_typeILm2ELm4EbES_(
143 // CHECK-SAME: <8 x i1> noundef [[X:%.*]], <8 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
144 // CHECK-NEXT: entry:
145 // CHECK: [[HLSL_OR:%.*]] = or <8 x i32> [[A:%.*]], [[B:%.*]]
146 // CHECK: ret <8 x i1> [[HLSL_OR_CAST:%.*]]
147 bool2x4 test_or_bool2x4(bool2x4 x, bool2x4 y)
148 {
149 return or(x, y);
150 }
151
152 // CHECK-LABEL: define hidden noundef <3 x i1> @_Z15test_or_bool3x1u11matrix_typeILm3ELm1EbES_(
153 // CHECK-SAME: <3 x i1> noundef [[X:%.*]], <3 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
154 // CHECK-NEXT: entry:
155 // CHECK: [[HLSL_OR:%.*]] = or <3 x i32> [[A:%.*]], [[B:%.*]]
156 // CHECK: ret <3 x i1> [[HLSL_OR_CAST:%.*]]
157 bool3x1 test_or_bool3x1(bool3x1 x, bool3x1 y)
158 {
159 return or(x, y);
160 }
161
162 // CHECK-LABEL: define hidden noundef <6 x i1> @_Z15test_or_bool3x2u11matrix_typeILm3ELm2EbES_(
163 // CHECK-SAME: <6 x i1> noundef [[X:%.*]], <6 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
164 // CHECK-NEXT: entry:
165 // CHECK: [[HLSL_OR:%.*]] = or <6 x i32> [[A:%.*]], [[B:%.*]]
166 // CHECK: ret <6 x i1> [[HLSL_OR_CAST:%.*]]
167 bool3x2 test_or_bool3x2(bool3x2 x, bool3x2 y)
168 {
169 return or(x, y);
170 }
171
172
173 // CHECK-LABEL: define hidden noundef <9 x i1> @_Z15test_or_bool3x3u11matrix_typeILm3ELm3EbES_(
174 // CHECK-SAME: <9 x i1> noundef [[X:%.*]], <9 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
175 // CHECK-NEXT: entry:
176 // CHECK: [[HLSL_OR:%.*]] = or <9 x i32> [[A:%.*]], [[B:%.*]]
177 // CHECK: ret <9 x i1> [[HLSL_OR_CAST:%.*]]
178 bool3x3 test_or_bool3x3(bool3x3 x, bool3x3 y)
179 {
180 return or(x, y);
181 }
182
183 // CHECK-LABEL: define hidden noundef <12 x i1> @_Z15test_or_bool3x4u11matrix_typeILm3ELm4EbES_(
184 // CHECK-SAME: <12 x i1> noundef [[X:%.*]], <12 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
185 // CHECK-NEXT: entry:
186 // CHECK: [[HLSL_OR:%.*]] = or <12 x i32> [[A:%.*]], [[B:%.*]]
187 // CHECK: ret <12 x i1> [[HLSL_OR_CAST:%.*]]
188 bool3x4 test_or_bool3x4(bool3x4 x, bool3x4 y)
189 {
190 return or(x, y);
191 }
192
193 // CHECK-LABEL: define hidden noundef <4 x i1> @_Z15test_or_bool4x1u11matrix_typeILm4ELm1EbES_(
194 // CHECK-SAME: <4 x i1> noundef [[X:%.*]], <4 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
195 // CHECK-NEXT: entry:
196 // CHECK: [[HLSL_OR:%.*]] = or <4 x i32> [[A:%.*]], [[B:%.*]]
197 // CHECK: ret <4 x i1> [[HLSL_OR_CAST:%.*]]
198 bool4x1 test_or_bool4x1(bool4x1 x, bool4x1 y)
199 {
200 return or(x, y);
201 }
202
203 // CHECK-LABEL: define hidden noundef <8 x i1> @_Z15test_or_bool4x2u11matrix_typeILm4ELm2EbES_(
204 // CHECK-SAME: <8 x i1> noundef [[X:%.*]], <8 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
205 // CHECK-NEXT: entry:
206 // CHECK: [[HLSL_OR:%.*]] = or <8 x i32> [[A:%.*]], [[B:%.*]]
207 // CHECK: ret <8 x i1> [[HLSL_OR_CAST:%.*]]
208 bool4x2 test_or_bool4x2(bool4x2 x, bool4x2 y)
209 {
210 return or(x, y);
211 }
212
213 // CHECK-LABEL: define hidden noundef <12 x i1> @_Z15test_or_bool4x3u11matrix_typeILm4ELm3EbES_(
214 // CHECK-SAME: <12 x i1> noundef [[X:%.*]], <12 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
215 // CHECK-NEXT: entry:
216 // CHECK: [[HLSL_OR:%.*]] = or <12 x i32> [[A:%.*]], [[B:%.*]]
217 // CHECK: ret <12 x i1> [[HLSL_OR_CAST:%.*]]
218 bool4x3 test_or_bool4x3(bool4x3 x, bool4x3 y)
219 {
220 return or(x, y);
221 }
222
223 // CHECK-LABEL: define hidden noundef <16 x i1> @_Z15test_or_bool4x4u11matrix_typeILm4ELm4EbES_(
224 // CHECK-SAME: <16 x i1> noundef [[X:%.*]], <16 x i1> noundef [[Y:%.*]]) #[[ATTR0]] {
225 // CHECK-NEXT: entry:
226 // CHECK: [[HLSL_OR:%.*]] = or <16 x i32> [[A:%.*]], [[B:%.*]]
227 // CHECK: ret <16 x i1> [[HLSL_OR_CAST:%.*]]
228 bool4x4 test_or_bool4x4(bool4x4 x, bool4x4 y)
229 {
230 return or(x, y);
231 }