Visible to Intel only — GUID: zkp1691737589507
Ixiasoft
Visible to Intel only — GUID: zkp1691737589507
Ixiasoft
4.3.4.2. Floating Point Operations
Category | Operation | Cycles2 | Result | Subnormal | Rounding3 | GCC Inference |
---|---|---|---|---|---|---|
Arithmetic | FDIV.S | 14 | a ÷ b | Flush-to-0 | RNE | a / b |
FSUB.S | 1 | a - b | Flush-to-0 | RNE | a - b | |
FADD.S | 1 | a + b | Flush-to-0 | RNE | a + b | |
FMUL.S | 2 | a x b | Flush-to-0 | RNE | a * b | |
FSQRT.S | 12 | √a | Flush-to-0 | Faithful 4 | sqrt(a) | |
FMIN.S | 2 | (a < b) ? a : b | Supported | RNE | fminf() | |
FMAX.S | 2 | (a < b) ? b : a | Supported | RNE | fmaxf() | |
Fused Arithmetic5 | FMADD.S | 3 | (a x b) + c | Flush-to-0 | RNE | (a * b) + c |
FMSUB.S | 3 | (a x b) – c | Flush-to-0 | RNE | (a * b) - c | |
FNMSUB.S | 3 | -(a x b) + c | Flush-to-0 | RNE | -(a * b) + c | |
FNMADD.S | 3 | -(a x b) - c | Flush-to-0 | RNE | -(a * b) - c | |
Conversion | FCVT.S.W / FCVT.S.WU | 3 | int_to_float(a) | Supported | None | Casting |
FCVT.W.S / FCVT.WU.S | 3 | float_to_int(a) | Supported | Round towards Zero | Casting | |
Round to Nearest, ties to Max Magnitude | roundf(a) | |||||
Compare | FLT.S | 1 | (a < b) ? 1 : 0 | Flush-to-0 | RNE | a < b |
FLE.S | 1 | (a ≤ b) ? 1 : 0 | Flush-to-0 | RNE | a <= b | |
FEQ.S | 1 | (a = b) ? 1 : 0 | Flush-to-0 | RNE | a == b | |
Sign Injection | FSGNJN.S (FNEG.S) | 1 | -a | Supported | RNE | -a |
FSGNJX.S (FABS.S) | 1 | |a| | Supported | RNE | fabsf(a) | |
Classification | FCLASS.S | 2 | Refer to topic Floating Point Classification. | Supported | None | fpclassify(a) |
- Operation —Provides the name of the floating-point operation. The names match the names of the corresponding RISC-V floating-point instructions.
- Cycle —Specifies the number of cycles it takes to execute the instruction.
- Result—Describes the computation performed by the operation.
- Subnormal—Describes how the operation treats subnormal inputs and subnormal outputs. Subnormals are numbers with a magnitude less than approximately 1.17549435082e-38.
- Rounding —Describes how the FPU rounds the result.
- GCC Inference—Shows the C code from which GCC infers the instruction operation.
When optimizing a Floating Point Unit (FPU) within a processor, the FSQRT (floating-point square root) and FDIV (floating-point division) operations are critical components. Because of their complexity and longer execution time, they can influence the maximum frequency (Fmax) of the FPU. Refer to the following guidelines to help you decide whether to enable or disable the FSQRT and FDIV.
Action | Guidelines |
---|---|
Enable | Enable the FQSRT and FDIV:
|
Disable | Disable the FQSRT and FDIV:
|
In summary, deciding whether to enable or disable FSQRT and FDIV in a Floating Point Unit (FPU) is a choice between two main goals. You can aim for a higher maximum frequency (Fmax) and lower logic usage, or you can focus on improving performance for floating-point operations. This decision should depend on the specific needs and limits of your application.