Description
- Implement
degrees
clang builtin,Linkdegrees
clang builtin withhlsl_intrinsics.h
Add sema checks fordegrees
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
Add codegen fordegrees
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
Add codegen tests toclang/test/CodeGenHLSL/builtins/degrees.hlsl
Add sema tests toclang/test/SemaHLSL/BuiltIns/degrees-errors.hlsl
Create theint_spv_degrees
intrinsic inIntrinsicsSPIRV.td
In SPIRVInstructionSelector.cpp create thedegrees
lowering and map it toint_spv_degrees
inSPIRVInstructionSelector::selectIntrinsic
.Create SPIR-V backend test case inllvm/test/CodeGen/SPIRV/hlsl-intrinsics/degrees.ll
DirectX
There were no DXIL opcodes found for degrees
.
SPIR-V
Degrees:
Description:
Degrees
Converts radians to degrees, i.e., radians * 180 / π.
The operand radians must be a scalar or vector whose component type is
16-bit or 32-bit floating-point.
Result Type and the type of radians must be the same type. Results
are computed per component.
Number | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
---|---|---|---|---|
12 |
<id> |
Test Case(s)
Example 1
//dxc degrees_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export float4 fn(float4 p1) {
return degrees(p1);
}
HLSL:
Converts the specified value from radians to degrees.
ret degrees(x) |
---|
Parameters
Item | Description |
---|---|
x |
[in] The specified value. |
Return Value
The result of converting the x parameter from radians to degrees.
Type Description
Name | Template Type | Component Type | Size |
---|---|---|---|
x | scalar, vector, or matrix | float | any |
ret | same as input x | float | same dimension(s) as input x |
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) | vs_1_1 |
See also
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status
Activity
degrees
intrinsic #111209[HLSL] Implement the `degrees` intrinsic (llvm#111209)
llvmbot commentedon Oct 10, 2024
@llvm/issue-subscribers-clang-codegen
Author: Farzon Lotfi (farzonl)
DirectX
There were no DXIL opcodes found for
degrees
.SPIR-V
Degrees:
Description:
Degrees
Converts radians to degrees, i.e., radians * 180 / π.
The operand radians must be a scalar or vector whose component type is
16-bit or 32-bit floating-point.
Result Type and the type of radians must be the same type. Results
are computed per component.
<table>
<colgroup>
<col style="width: 20%" />
<col style="width: 20%" />
<col style="width: 20%" />
<col style="width: 20%" />
<col style="width: 20%" />
</colgroup>
<thead>
<tr>
<th>Number</th>
<th>Operand 1</th>
<th>Operand 2</th>
<th>Operand 3</th>
<th>Operand 4</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p>12</p></td>
<td
class="tableblock halign-left valign-top"><p><em><id></em><br />
<em>radians</em></p></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
Test Case(s)
Example 1
HLSL:
Converts the specified value from radians to degrees.
Parameters
Return Value
The result of converting the x parameter from radians to degrees.
Type Description
Minimum Shader Model
This function is supported in the following shader models.
See also
<dl> <dt>
Intrinsic Functions (DirectX HLSL)
</dt> </dl>
llvmbot commentedon Oct 10, 2024
@llvm/issue-subscribers-clang-frontend
Author: Farzon Lotfi (farzonl)
DirectX
There were no DXIL opcodes found for
degrees
.SPIR-V
Degrees:
Description:
Degrees
Converts radians to degrees, i.e., radians * 180 / π.
The operand radians must be a scalar or vector whose component type is
16-bit or 32-bit floating-point.
Result Type and the type of radians must be the same type. Results
are computed per component.
<table>
<colgroup>
<col style="width: 20%" />
<col style="width: 20%" />
<col style="width: 20%" />
<col style="width: 20%" />
<col style="width: 20%" />
</colgroup>
<thead>
<tr>
<th>Number</th>
<th>Operand 1</th>
<th>Operand 2</th>
<th>Operand 3</th>
<th>Operand 4</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p>12</p></td>
<td
class="tableblock halign-left valign-top"><p><em><id></em><br />
<em>radians</em></p></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
Test Case(s)
Example 1
HLSL:
Converts the specified value from radians to degrees.
Parameters
Return Value
The result of converting the x parameter from radians to degrees.
Type Description
Minimum Shader Model
This function is supported in the following shader models.
See also
<dl> <dt>
Intrinsic Functions (DirectX HLSL)
</dt> </dl>
[HLSL] Implement the `degrees` intrinsic (llvm#111209)