Skip to content

Commit c07e61e

Browse files
committed
Address review comments
1 parent 69fb22e commit c07e61e

File tree

2 files changed

+39
-44
lines changed

2 files changed

+39
-44
lines changed

clang/test/CodeGenHLSL/builtins/or.hlsl

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,78 @@
11
// RUN: %clang_cc1 -finclude-default-header -triple \
22
// RUN: dxil-pc-shadermodel6.3-library %s \
3-
// RUN: -emit-llvm -O1 -o - | FileCheck %s
3+
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
44

5-
//CHECK-LABEL: define noundef i1 @_Z15test_and_scalarbb(
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_and_scalar(bool x, bool y)
5+
//CHECK-LABEL: define 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)
1211
{
1312
return or(x, y);
1413
}
1514

1615
//CHECK-LABEL: define noundef <2 x i1> @_Z13test_or_bool2Dv2_bS_(
17-
//CHECK-SAME: <2 x i1> noundef [[X:%.*]], <2 x i1> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
18-
//CHECK-NEXT: [[ENTRY:.*:]]
19-
//CHECK-NEXT: [[HLSL_OR:%.*]] = or <2 x i1> [[X]], [[Y]]
20-
//CHECK-NEXT: ret <2 x i1> [[HLSL_OR]]
21-
//CHECK-NEXT: }
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]]
2220
bool2 test_or_bool2(bool2 x, bool2 y)
2321
{
2422
return or(x, y);
2523
}
2624

2725
//CHECK-LABEL: define noundef <3 x i1> @_Z13test_or_bool3Dv3_bS_(
28-
//CHECK-SAME: <3 x i1> noundef [[X:%.*]], <3 x i1> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
29-
//CHECK-NEXT: [[ENTRY:.*:]]
30-
//CHECK-NEXT: [[HLSL_OR:%.*]] = or <3 x i1> [[X]], [[Y]]
31-
//CHECK-NEXT: ret <3 x i1> [[HLSL_OR]]
32-
//CHECK-NEXT: }
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]]
3330
bool3 test_or_bool3(bool3 x, bool3 y)
3431
{
3532
return or(x, y);
3633
}
3734

3835
//CHECK-LABEL: define noundef <4 x i1> @_Z13test_or_bool4Dv4_bS_(
39-
//CHECK-SAME: <4 x i1> noundef [[X:%.*]], <4 x i1> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
40-
//CHECK-NEXT: [[ENTRY:.*:]]
41-
//CHECK-NEXT: [[HLSL_OR:%.*]] = or <4 x i1> [[X]], [[Y]]
42-
//CHECK-NEXT: ret <4 x i1> [[HLSL_OR]]
43-
//CHECK-NEXT: }
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]]
4440
bool4 test_or_bool4(bool4 x, bool4 y)
4541
{
4642
return or(x, y);
4743
}
4844

4945
//CHECK-LABEL: define noundef i1 @_Z11test_or_intii(
50-
//CHECK-SAME: i32 noundef [[X:%.*]], i32 noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
51-
//CHECK-NEXT: [[ENTRY:.*:]]
52-
//CHECK-NEXT: [[A:%.*]] = or i32 [[Y]], [[X]]
53-
//CHECK-NEXT: [[HLSL_OR:%.*]] = icmp ne i32 [[A]], 0
54-
//CHECK-NEXT: ret i1 [[HLSL_OR]]
55-
//CHECK-NEXT: }
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]]
5652
bool test_or_int(int x, int y)
5753
{
5854
return or(x, y);
5955
}
6056

6157
//CHECK-LABEL: define noundef <4 x i1> @_Z12test_or_int4Dv4_iS_(
62-
//CHECK-SAME: <4 x i32> noundef [[X:%.*]], <4 x i32> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
63-
//CHECK-NEXT: [[ENTRY:.*:]]
64-
//CHECK-NEXT: [[A:%.*]] = or <4 x i32> [[Y]], [[X]]
65-
//CHECK-NEXT: [[HLSL_OR:%.*]] = icmp ne <4 x i32> [[A]], zeroinitializer
66-
//CHECK-NEXT: ret <4 x i1> [[HLSL_OR]]
67-
//CHECK-NEXT: }
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]]
6864
bool4 test_or_int4(int4 x, int4 y)
6965
{
7066
return or(x, y);
7167
}
7268

73-
//CHECK-LABEL: noundef <4 x i1> @_Z14test_or_float4Dv4_fS_(
74-
//CHECK-SAME: <4 x float> noundef nofpclass(nan inf) [[X:%.*]], <4 x float> noundef nofpclass(nan inf) [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] {
75-
//CHECK-NEXT: [[ENTRY:.*:]]
76-
//CHECK-NEXT: [[TOBOOL:%.*]] = fcmp reassoc nnan ninf nsz arcp afn une <4 x float> [[X]], zeroinitializer
77-
//CHECK-NEXT: [[TOBOOL1:%.*]] = fcmp reassoc nnan ninf nsz arcp afn une <4 x float> [[Y]], zeroinitializer
78-
//CHECK-NEXT: [[HLSL_OR:%.*]] = or <4 x i1> [[TOBOOL]], [[TOBOOL1]]
79-
//CHECK-NEXT: ret <4 x i1> [[HLSL_OR]]
80-
//CHECK-NEXT: }
69+
//CHECK-LABEL: define 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]]
8176
bool4 test_or_float4(float4 x, float4 y)
8277
{
8378
return or(x, y);

clang/test/SemaHLSL/BuiltIns/logical-operator-errors.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ bool test_too_many_arg(bool a)
1717
bool2 test_mismatched_args(bool2 a, bool3 b)
1818
{
1919
return TEST_FUNC(a, b);
20-
// expected-error@-1 {{all arguments to}}{{.*}}{{must have the same type}}
20+
// expected-error@-1 {{all arguments to}}{{_builtin_hlsl_or|_builtin_hlsl_and }}{{must have the same type}}
2121
}
2222

2323
bool test_incorrect_type(int a)

0 commit comments

Comments
 (0)