Skip to content

Commit b72a197

Browse files
committed
Address review comments
1 parent d99e734 commit b72a197

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

clang/lib/Headers/hlsl/hlsl_intrinsics.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,14 @@ bool4 and(bool4 x, bool4 y);
294294
// or builtins
295295
//===----------------------------------------------------------------------===//
296296

297-
/// \fn T or(T x, T y)
298-
/// \brief Returns the bitwise OR of the two input values, \a x and \a y.
299-
/// \param x The first input value and y The second input value.
300-
///
301-
/// \returns A boolean vector by performing a logical OR operation elementwise.
297+
/// \fn bool or(bool x, bbol y)
298+
/// \brief Logically ors two boolean vectors elementwise and produces a bool
299+
/// vector output.
300+
301+
// TODO: Clean up clang-format marker once we've resolved
302+
// https://github.com/llvm/llvm-project/issues/128979
303+
//
304+
// clang-format off
302305
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_or)
303306
bool or(bool, bool);
304307
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_or)
@@ -307,6 +310,7 @@ _HLSL_BUILTIN_ALIAS(__builtin_hlsl_or)
307310
bool3 or(bool3, bool3);
308311
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_or)
309312
bool4 or(bool4, bool4);
313+
// clang-format on
310314

311315
//===----------------------------------------------------------------------===//
312316
// any builtins

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,11 +2311,10 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
23112311
if (CheckVectorElementCallArgs(&SemaRef, TheCall))
23122312
return true;
23132313

2314-
// Ensure input expr type is a scalar/vector and the same as the return type
2314+
// Ensure input expr type is a scalar/vector of type Boolty
23152315
if (CheckScalarOrVector(&SemaRef, TheCall, getASTContext().BoolTy, 0))
23162316
return true;
23172317

2318-
// Ensure input parameter type is bool
23192318
ExprResult A = TheCall->getArg(0);
23202319
QualType ArgTyA = A.get()->getType();
23212320

clang/test/CodeGenHLSL/builtins/or.hlsl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
//CHECK-NEXT: [[HLSL_OR:%.*]] = or i1 [[x]], [[y]]
99
//CHECK-NEXT: ret i1 [[HLSL_OR]]
1010
//CHECK_NEXT: }
11-
bool test_or_bool(bool x, bool y)
11+
bool test_and_scalar(bool x, bool y)
1212
{
1313
return or(x, y);
14-
1514
}
1615

1716
//CHECK-LABEL: define noundef <2 x i1> @_Z13test_or_bool2Dv2_bS_(

0 commit comments

Comments
 (0)