-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Description
- Implement
frexpclang builtin, - Link
frexpclang builtin withhlsl_intrinsics.h - Add sema checks for
frexptoCheckHLSLBuiltinFunctionCallinSemaChecking.cpp - Add codegen for
frexptoEmitHLSLBuiltinExprinCGBuiltin.cpp - Add codegen tests to
clang/test/CodeGenHLSL/builtins/frexp.hlsl - Add sema tests to
clang/test/SemaHLSL/BuiltIns/frexp-errors.hlsl - Create the
int_spv_frexpintrinsic inIntrinsicsSPIRV.td - In SPIRVInstructionSelector.cpp create the
frexplowering and map it toint_spv_frexpinSPIRVInstructionSelector::selectIntrinsic. - Create SPIR-V backend test case in
llvm/test/CodeGen/SPIRV/hlsl-intrinsics/frexp.ll
DirectX
There were no DXIL opcodes found for frexp.
SPIR-V
FrexpStruct:
Description:
FrexpStruct
Same semantics as in Frexp, except that the entire result is in the
instruction’s result; there is not a pointer operand to write through.
Result Type must be an OpTypeStruct with two members. Member 0
must have the same type as the type of x. Member 0 holds the
significand. Member 1 must be a scalar or vector with integer
component type, with 32-bit component width. Member 1 holds exponent.
These two members must have the same number of components. This
structure type must be explicitly declared by the module.
| Number | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
|---|---|---|---|---|
52 |
<id> |
Test Case(s)
Example 1
//dxc frexp_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export float4 fn(float4 p1, float4 p2) {
return frexp(p1, p2);
}HLSL:
Returns the mantissa and exponent of the specified floating-point value.
| ret frexp(x, exp) |
|---|
The return value is the mantissa, and the value returned by exp parameter is the exponent.
Parameters
| Item | Description |
|---|---|
| x |
[in] The specified floating-point value. If the x parameter is 0, this function returns 0 for both the mantissa and the exponent. |
| exp |
[out] The returned exponent of the x parameter. |
Return Value
The mantissa of the x parameter.
Type Description
| Name | Template Type | Component Type | Size |
|---|---|---|---|
| x | scalar, vector, or matrix | float | any |
| exp | same as input x | float | same dimension(s) as input x |
| 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 3 (DirectX HLSL) and higher shader models | yes |
| Shader Model 2 (DirectX HLSL) | yes (ps_2_x only) |
| Shader Model 1 (DirectX HLSL) | no |
Remarks
Requirements
| Requirement | Value |
|---|---|
| Header |
|
See also
Metadata
Metadata
Assignees
Labels
Type
Projects
Status