Commit d369a48c authored by Connor Abbott's avatar Connor Abbott

bifrost: Add more special function opcodes

parent 71ef0ab6
......@@ -471,9 +471,22 @@ static const FMAOpInfo FMAOpInfos[] = {
//
// This computes x1.
{ 0xe0345, "LOG_FREXPM", FMAOneSrc },
{ 0xe0365, "FRCP_TABLE", FMAOneSrc },
// Compute required exponent for reciprocal (negate it, accounting for the offset.)
{ 0xe038d, "FRCP_EXP", FMAOneSrc },
// Given a floating point number m * 2^e, returns m * 2^{-1}. This is
// exactly the same as the mantissa part of frexp().
{ 0xe0365, "FRCP_FREXPM", FMAOneSrc },
// Given a floating point number m * 2^e, returns m * 2^{-2} if e is even,
// and m * 2^{-1} if e is odd. In other words, scales by powers of 4 until
// within the range [0.25, 1). Used for square-root and reciprocal
// square-root.
{ 0xe0375, "FSQRT_FREXPM", FMAOneSrc },
// Given a floating point number m * 2^e, computes -e - 1 as an integer.
// Zero and infinity/NaN return 0.
{ 0xe038d, "FRCP_FREXPE", FMAOneSrc },
// Computes floor(e/2) + 1.
{ 0xe03a5, "FSQRT_FREXPE", FMAOneSrc },
// Given a floating point number m * 2^e, computes -floor(e/2) - 1 as an
// integer.
{ 0xe03ad, "FRSQ_FREXPE", FMAOneSrc },
{ 0xe03c5, "LOG_FREXPE", FMAOneSrc },
{ 0xe0b80, "IMAX3", FMAThreeSrc },
{ 0xe0bc0, "UMAX3", FMAThreeSrc },
......@@ -922,7 +935,12 @@ static const ADDOpInfo ADDOpInfos[] = {
// this seems to be the canonical way the blob generates a MOV.
{ 0x07b2d, "MOV", ADDOneSrc },
{ 0x07b2f, "SWZ.YY.v2i16", ADDOneSrc },
{ 0x07b8d, "FRCP_EXP", ADDOneSrc },
// Given a floating point number m * 2^e, returns m ^ 2^{-1}.
{ 0x07b65, "FRCP_FREXPM", ADDOneSrc },
{ 0x07b75, "FSQRT_FREXPM", ADDOneSrc },
{ 0x07b8d, "FRCP_FREXPE", ADDOneSrc },
{ 0x07ba5, "FSQRT_FREXPE", ADDOneSrc },
{ 0x07bad, "FRSQ_FREXPE", ADDOneSrc },
// From the ARM patent US20160364209A1:
// "Decompose v (the input) into numbers x1 and s such that v = x1 * 2^s,
// and x1 is a floating point value in a predetermined range where the
......@@ -966,15 +984,25 @@ static const ADDOpInfo ADDOpInfos[] = {
{ 0x0ca88, "LOAD.v3i32", ADDTwoSrc, true },
{ 0x0caa0, "LD_UBO.v3i32", ADDTwoSrc, true },
{ 0x0cb88, "STORE.v3i32", ADDTwoSrc, true },
// Does not exist on G71 (added to G51, G72, and everything after)
// *_FAST does not exist on G71 (added to G51, G72, and everything after)
{ 0x0cc00, "FRCP_FAST.f32", ADDOneSrc },
// Produce appropriate scale
{ 0x0ce00, "FRCP_SCALE", ADDOneSrc },
// Used in the argument reduction for log.
{ 0x0cc20, "FRSQ_FAST.f32", ADDOneSrc },
// Given a floating point number m * 2^e, produces a table-based
// approximation of 2/m using the top 17 bits. Includes special cases for
// infinity, NaN, and zero, and copies the sign bit.
{ 0x0ce00, "FRCP_TABLE", ADDOneSrc },
// A similar table for inverse square root, using the high 17 bits of the
// mantissa as well as the low bit of the exponent.
{ 0x0ce20, "FRSQ_TABLE", ADDOneSrc },
// Used in the argument reduction for log. Given a floating-point number
// m * 2^e, uses the top 4 bits of m to produce an approximation to 1/m
// with the exponent forced to 0 and only the top 5 bits are nonzero. 0,
// infinity, and NaN all return 1.0.
// See the ARM patent for more information.
{ 0x0ce60, "FRCP_APPROX", ADDOneSrc },
{ 0x0cf50, "SIN_TABLE", ADDOneSrc },
{ 0x0cf51, "COS_TABLE", ADDOneSrc },
{ 0x0cf58, "EXP_TABLE", ADDOneSrc },
{ 0x0cf60, "FLOG2_TABLE", ADDOneSrc },
{ 0x0cf64, "FLOGE_TABLE", ADDOneSrc },
{ 0x0d000, "BRANCH", ADDBranch },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment