add ztrans proposal
[libreriscv.git] / ztrans_proposal.mdwn
1 # Ztrans - transcendental operations
2
3 See:
4
5 * <http://bugs.libre-riscv.org/show_bug.cgi?id=127>
6 * <https://www.khronos.org/registry/spir-v/specs/unified1/OpenCL.ExtendedInstructionSet.100.html>
7
8 [[!toc levels=2]]
9
10 # List of 2-arg opcodes
11
12 [[!table data="""
13 opcode | Description | pseudo-code | Extension |
14 FATAN2 | atan2 arc tangent | rd = atan2(rs2, rs1) | Ztrans |
15 FATAN2PI | atan arc tangent / pi | rd = atan2(rs2, rs1) / pi | |
16 FPOW | power of | rd = pow(rs1, rs2) | Ztrans |
17 """]]
18
19 # List of 1-arg opcodes
20
21 [[!table data="""
22 opcode | Description | pseudo-code | Extension |
23 FCBRT | Cube Root | rd = pow(rs1, 3) | |
24 FEXP2 | power-of-2 | rd = pow(2, rs1) | |
25 FLOG2 | log2 | rd = log2(rs1) | |
26 FEXPM1 | exponent minus 1 | rd = pow(e, rs1) - 1.0 | |
27 FLOG1P | log plus 1 | rd = log(e, 1 + rs1) | |
28 FEXP | exponent | rd = pow(e, rs1) | |
29 FLOG | natural log (base e) | rd = log(e, rs1) | |
30 FEXP10 | power-of-10 | rd = pow(10, rs1) | |
31 FLOG10 | log base 10 | rd = log10(rs1) | |
32 FSIN | sin (radians) | | Ztrans |
33 FCOS | cos (radians) | | Ztrans |
34 FTAN | tan (radians) | | Ztrans |
35 FSINPI | sin times pi | rd = sin(pi * rs1) | |
36 FCOSPI | cos times pi | rd = cos(pi * rs1) | |
37 FTANPI | tan times pi | rd = tan(pi * rs1) | |
38 FSINH | hyperbolic sin (radians) | | |
39 FCOSH | hyperbolic cos (radians) | | |
40 FTANH | hyperbolic tan (radians) | | |
41 FASINH | inverse hyperbolic sin | | |
42 FACOSH | inverse hyperbolic cos | | |
43 FATANH | inverse hyperbolic tan | | |
44 """]]
45
46 # Pseudo-code ops
47
48 * FRCP rd, rs1 - pseudo-code alias for rd = 1.0 / rs1
49 * SINCOS - fused macro-op between FSIN and FCOS (issued in that order).
50 * SINCOSPI - fused macro-op between FSINPI and FCOSPI (issued in that order).
51