1+ // RUN: %clang_cc1 -finclude-default-header -triple \
2+ // RUN: dxil-pc-shadermodel6.3-library %s \
3+ // RUN: -emit-llvm -O1 -o - | FileCheck %s
4+
5+ //CHECK-LABEL: define noundef i1 @_Z12test_or_boolbb(
6+ //CHECK-SAME: i1 noundef [[X:%.*]], i1 noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
7+ //CHECK-NEXT: [[ENTRY:.*:]]
8+ //CHECK-NEXT: [[HLSL_OR:%.*]] = or i1 [[x]], [[y]]
9+ //CHECK-NEXT: ret i1 [[HLSL_OR]]
10+ //CHECK_NEXT: }
11+ bool test_or_bool (bool x, bool y)
12+ {
13+ return or (x, y);
14+
15+ }
16+
17+ //CHECK-LABEL: define noundef <2 x i1> @_Z13test_or_bool2Dv2_bS_(
18+ //CHECK-SAME: <2 x i1> noundef [[X:%.*]], <2 x i1> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
19+ //CHECK-NEXT: [[ENTRY:.*:]]
20+ //CHECK-NEXT: [[HLSL_OR:%.*]] = or <2 xi1> [[x]], [[y]]
21+ //CHECK-NEXT: ret <2 x i1> [[HLSL_OR]]
22+ //CHECK_NEXT: }
23+ bool2 test_or_bool2 (bool2 x, bool2 y)
24+ {
25+ return or (x, y);
26+ }
27+
28+ //CHECK-LABEL: define noundef <3 x i1> @_Z13test_or_bool3Dv3_bS_(
29+ //CHECK-SAME: <3 x i1> noundef [[X:%.*]], <3 x i1> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
30+ //CHECK-NEXT: [[ENTRY:.*:]]
31+ //CHECK-NEXT: [[HLSL_OR:%.*]] = or <3 xi1> [[x]], [[y]]
32+ //CHECK-NEXT: ret <3 x i1> [[HLSL_OR]]
33+ //CHECK_NEXT: }
34+ bool3 test_or_bool3 (bool3 x, bool3 y)
35+ {
36+ return or (x, y);
37+ }
38+
39+ //CHECK-LABEL: define noundef <4 x i1> @_Z13test_or_bool4Dv4_bS_(
40+ //CHECK-SAME: <4 x i1> noundef [[X:%.*]], <4 x i1> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
41+ //CHECK-NEXT: [[ENTRY:.*:]]
42+ //CHECK-NEXT: [[HLSL_OR:%.*]] = or <4 xi1> [[x]], [[y]]
43+ //CHECK-NEXT: ret <4 x i1> [[HLSL_OR]]
44+ //CHECK_NEXT: }
45+ bool4 test_or_bool4 (bool4 x, bool4 y)
46+ {
47+ return or (x, y);
48+ }
49+
50+ //CHECK-LABEL: define noundef i1 @_Z11test_or_intii(
51+ //CHECK-SAME: i32 noundef [[X:%.*]], i32 noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
52+ //CHECK-NEXT: [[ENTRY:.*:]]
53+ //CHECK_NEXT: [[0:%.*]] = or i32 [[y]], [[x]]
54+ //CHECK-NEXT: [[HLSL_OR:%.*]] = icmp ne i32 [[0]], 0
55+ //CHECK-NEXT: ret i1 [[HLSL_OR]]
56+ //CHECK_NEXT: }
57+ bool test_or_int (int x, int y)
58+ {
59+ return or (x, y);
60+ }
61+
62+ //CHECK-LABEL: define noundef <4 x i1> @_Z12test_or_int4Dv4_iS_(
63+ //CHECK-SAME: <4 x i32> noundef [[X:%.*]], <4 x i32> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
64+ //CHECK-NEXT: [[ENTRY:.*:]]
65+ //CHECK_NEXT: [[0:%.*]] = or <4 x i32> [[y]], [[x]]
66+ //CHECK-NEXT: [[HLSL_OR:%.*]] = icmp ne <4 x i32> [[0]], zeroinitializer
67+ //CHECK-NEXT: ret <4 x i1> [[HLSL_OR]]
68+ //CHECK_NEXT: }
69+ bool4 test_or_int4 (int4 x, int4 y)
70+ {
71+ return or (x, y);
72+ }
73+
74+ //CHECK-LABEL: noundef <4 x i1> @_Z14test_or_float4Dv4_fS_(
75+ //CHECK-SAME: <4 x float> noundef nofpclass(nan inf) [[X:%.*]], <4 x float> noundef nofpclass(nan inf) [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
76+ //CHECK-NEXT: [[ENTRY:.*:]]
77+ //CHECK-NEXT: [[TOBOOL:%.*]] = fcmp reassoc nnan ninf nsz arcp afn une <4 x float> [[X]], zeroinitializer
78+ //CHECK-NEXT: [[TOBOOL1:%.*]] = fcmp reassoc nnan ninf nsz arcp afn une <4 x float> [[Y]], zeroinitializer
79+ //CHECK-NEXT: [[HLSL_OR:%.*]] = or <4 x i1> [[TOBOOL]], [[TOBOOL1]]
80+ //CHECK-NEXT: ret <4 x i1> [[HLSL_OR]]
81+ //CHECK_NEXT: }
82+ bool4 test_or_float4 (float4 x, float4 y)
83+ {
84+ return or (x, y);
85+ }
0 commit comments