[clang] [clang][HLSL] Add sign intrinsic part 3 (PR #101989)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 5 07:21:53 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 04f65043bc8711996a4ade05c67ae2d087ae8be5 03e05cc3ee4746b760750515e884ab8ba4674e87 --extensions cpp,h -- clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CGHLSLRuntime.h clang/lib/Headers/hlsl/hlsl_intrinsics.h clang/lib/Sema/SemaHLSL.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index e5c545686d..41be70612a 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -18675,7 +18675,8 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
!E->getArg(0)->getType()->hasSignedIntegerRepresentation())
llvm_unreachable("sign operand must have a float or int representation");
- return Builder.CreateIntrinsic(retType, CGM.getHLSLRuntime().getSignIntrinsic(),
+ return Builder.CreateIntrinsic(
+ retType, CGM.getHLSLRuntime().getSignIntrinsic(),
ArrayRef<Value *>{Op0}, nullptr, "hlsl.sign");
}
}
diff --git a/clang/lib/Headers/hlsl/hlsl_intrinsics.h b/clang/lib/Headers/hlsl/hlsl_intrinsics.h
index 65c499e6ca..10510a85a9 100644
--- a/clang/lib/Headers/hlsl/hlsl_intrinsics.h
+++ b/clang/lib/Headers/hlsl/hlsl_intrinsics.h
@@ -1730,8 +1730,8 @@ __attribute__((convergent)) uint WaveGetLaneIndex();
//===----------------------------------------------------------------------===//
/// \fn T sign(T Val)
-/// \brief Returns -1 if \a Val is less than zero; 0 if \a Val equals zero; and 1 if \a Val is greater than zero.
-/// \param Val The input value.
+/// \brief Returns -1 if \a Val is less than zero; 0 if \a Val equals zero; and
+/// 1 if \a Val is greater than zero. \param Val The input value.
#ifdef __HLSL_ENABLE_16_BIT
_HLSL_AVAILABILITY(shadermodel, 6.2)
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 7d10c2a71e..e01eb17b53 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -998,7 +998,8 @@ bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) {
}
bool CheckFloatingOrSignedIntRepresentation(Sema *S, CallExpr *TheCall) {
auto checkAllSignedTypes = [](clang::QualType PassedType) -> bool {
- return !PassedType->hasSignedIntegerRepresentation() && !PassedType->hasFloatingRepresentation();
+ return !PassedType->hasSignedIntegerRepresentation() &&
+ !PassedType->hasFloatingRepresentation();
};
return CheckArgsTypesAreCorrect(S, TheCall, S->Context.IntTy,
checkAllSignedTypes);
@@ -1125,7 +1126,8 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
break;
}
case Builtin::BI__builtin_hlsl_elementwise_sign: {
- if (CheckFloatingOrSignedIntRepresentation(&SemaRef, TheCall) && CheckSignedIntRepresentation(&SemaRef, TheCall))
+ if (CheckFloatingOrSignedIntRepresentation(&SemaRef, TheCall) &&
+ CheckSignedIntRepresentation(&SemaRef, TheCall))
return true;
if (SemaRef.PrepareBuiltinElementwiseMathOneArgCall(TheCall))
return true;
``````````
</details>
https://github.com/llvm/llvm-project/pull/101989
More information about the cfe-commits
mailing list