-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
HLSLHLSL Language SupportHLSL Language Supportbackend:DirectXbackend:SPIR-Vbot:HLSLmetaissueIssue to collect references to a group of similar or related issues.Issue to collect references to a group of similar or related issues.
Description
- Implement
isnanclang builtin, - Link
isnanclang builtin withhlsl_intrinsics.h - Add sema checks for
isnantoCheckHLSLBuiltinFunctionCallinSemaChecking.cpp - Add codegen for
isnantoEmitHLSLBuiltinExprinCGBuiltin.cpp - Add codegen tests to
clang/test/CodeGenHLSL/builtins/isnan.hlsl - Add sema tests to
clang/test/SemaHLSL/BuiltIns/isnan-errors.hlsl - Create the
int_dx_isnanintrinsic inIntrinsicsDirectX.td - Create the
DXILOpMappingofint_dx_isnanto8inDXIL.td - Create the
isnan.llandisnan_errors.lltests inllvm/test/CodeGen/DirectX/ - Create the
int_spv_isnanintrinsic inIntrinsicsSPIRV.td - In SPIRVInstructionSelector.cpp create the
isnanlowering and map it toint_spv_isnaninSPIRVInstructionSelector::selectIntrinsic. - Create SPIR-V backend test case in
llvm/test/CodeGen/SPIRV/hlsl-intrinsics/isnan.ll
DirectX
| DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
|---|---|---|---|
| 8 | IsNaN | 6.0 | () |
In sm6.8 and earlier the 16 bit overload must be emulated, because the 16 bit overload isn't supported until sm6.9.
SPIR-V
OpIsNan:
Description:
Result is true if x is a NaN for the floating-point encoding used
by the type of x, otherwise result is false.
Result Type must be a scalar or vector of Boolean
type.
x must be a scalar or vector of floating-point type. It
must have the same number of components as Result Type.
Results are computed per component.
| Word Count | Opcode | Results | Operands | |
|---|---|---|---|---|
4 |
156 |
<id> |
<id> |
Test Case(s)
Example 1
//dxc isnan_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export bool4 fn(float4 p1) {
return isnan(p1);
}HLSL:
Determines if the specified value is NAN or QNAN.
| ret isnan(x) |
|---|
Parameters
| Item | Description |
|---|---|
| x |
[in] The specified value. |
Return Value
Returns a value of the same size as the input, with a value set to True if the x parameter is NAN or QNAN. Otherwise, False.
Type Description
| Name | Template Type | Component Type | Size |
|---|---|---|---|
| x | scalar, vector, or matrix | float | any |
| ret | scalar, vector, or matrix | bool | as input |
Minimum Shader Model
This function is supported in the following shader models.
| Shader Model | Supported |
|---|---|
| Shader Model 2 (DirectX HLSL) and higher shader models | yes |
| Shader Model 1 (DirectX HLSL) | yes (vs_1_1 only) |
Requirements
| Requirement | Value |
|---|---|
| Header |
|
See also
Metadata
Metadata
Assignees
Labels
HLSLHLSL Language SupportHLSL Language Supportbackend:DirectXbackend:SPIR-Vbot:HLSLmetaissueIssue to collect references to a group of similar or related issues.Issue to collect references to a group of similar or related issues.
Type
Projects
Status
Closed