Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HLSL] Update Sema Checking Diagnostics for builtins #138429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions 14 clang/include/clang/Basic/Builtins.td
Original file line number Diff line number Diff line change
Expand Up @@ -4897,10 +4897,16 @@ def HLSLClamp : LangBuiltin<"HLSL_LANG"> {
let Prototype = "void(...)";
}

def HLSLCross: LangBuiltin<"HLSL_LANG"> {
let Spellings = ["__builtin_hlsl_cross"];
def HLSLCrossFloat: LangBuiltin<"HLSL_LANG"> {
let Spellings = ["__builtin_hlsl_crossf32"];
let Attributes = [NoThrow, Const];
let Prototype = "void(...)";
let Prototype = "_ExtVector<3, float>(_ExtVector<3, float>, _ExtVector<3, float>)";
}

def HLSLCrossHalf: LangBuiltin<"HLSL_LANG"> {
let Spellings = ["__builtin_hlsl_crossf16"];
let Attributes = [NoThrow, Const];
let Prototype = "_ExtVector<3, __fp16>(_ExtVector<3, __fp16>, _ExtVector<3, __fp16>)";
}

def HLSLDegrees : LangBuiltin<"HLSL_LANG"> {
Expand Down Expand Up @@ -4959,7 +4965,7 @@ def HLSLLerp : LangBuiltin<"HLSL_LANG"> {

def HLSLMad : LangBuiltin<"HLSL_LANG"> {
let Spellings = ["__builtin_hlsl_mad"];
let Attributes = [NoThrow, Const];
let Attributes = [NoThrow, Const, CustomTypeChecking];
let Prototype = "void(...)";
}

Expand Down
2 changes: 1 addition & 1 deletion 2 clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -12649,7 +12649,7 @@ def err_builtin_invalid_arg_type: Error<
// An 'or' if non-empty second and third components are combined
"%plural{0:|:%plural{0:|:or }2}3"
// Third component: floating-point types
"%select{|floating-point}3"
"%select{|floating-point|16 or 32 bit floating-point}3"
// A space after a non-empty third component
"%plural{0:|: }3"
"%plural{[0,3]:type|:types}1 (was %4)">;
Expand Down
3 changes: 2 additions & 1 deletion 3 clang/lib/CodeGen/CGHLSLBuiltins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
/*ReturnType=*/OpX->getType(), Intr,
ArrayRef<Value *>{OpX, OpMin, OpMax}, nullptr, "hlsl.clamp");
}
case Builtin::BI__builtin_hlsl_cross: {
case Builtin::BI__builtin_hlsl_crossf16:
case Builtin::BI__builtin_hlsl_crossf32: {
Value *Op0 = EmitScalarExpr(E->getArg(0));
Value *Op1 = EmitScalarExpr(E->getArg(1));
assert(E->getArg(0)->getType()->hasFloatingRepresentation() &&
Expand Down
4 changes: 2 additions & 2 deletions 4 clang/lib/Headers/hlsl/hlsl_alias_intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -1882,10 +1882,10 @@ uint64_t4 reversebits(uint64_t4);
/// x[0] * y[1] - y[0] * x[1]

_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_cross)
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_crossf16)
half3 cross(half3, half3);

_HLSL_BUILTIN_ALIAS(__builtin_hlsl_cross)
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_crossf32)
float3 cross(float3, float3);

//===----------------------------------------------------------------------===//
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.