/* SPDX-License-Identifier: GPL-2.0-only */ /* * linux/arch/arm/vfp/vfp.h * * Copyright (C) 2004 ARM Limited. * Written by Deep Blue Solutions Limited.
*/
staticinline u32 vfp_shiftright32jamming(u32 val, unsignedint shift)
{ if (shift) { if (shift < 32)
val = val >> shift | ((val << (32 - shift)) != 0); else
val = val != 0;
} return val;
}
staticinline u64 vfp_shiftright64jamming(u64 val, unsignedint shift)
{ if (shift) { if (shift < 64)
val = val >> shift | ((val << (64 - shift)) != 0); else
val = val != 0;
} return val;
}
/* * VFP_SINGLE_MANTISSA_BITS - number of bits in the mantissa * VFP_SINGLE_EXPONENT_BITS - number of bits in the exponent * VFP_SINGLE_LOW_BITS - number of low bits in the unpacked significand * which are not propagated to the float upon packing.
*/ #define VFP_SINGLE_MANTISSA_BITS (23) #define VFP_SINGLE_EXPONENT_BITS (8) #define VFP_SINGLE_LOW_BITS (32 - VFP_SINGLE_MANTISSA_BITS - 2) #define VFP_SINGLE_LOW_BITS_MASK ((1 << VFP_SINGLE_LOW_BITS) - 1)
/* * The bit in an unpacked float which indicates that it is a quiet NaN
*/ #define VFP_SINGLE_SIGNIFICAND_QNAN (1 << (VFP_SINGLE_MANTISSA_BITS - 1 + VFP_SINGLE_LOW_BITS))
/* * Unpack a single-precision float. Note that this returns the magnitude * of the single-precision float mantissa with the 1. if necessary, * aligned to bit 30.
*/ staticinlinevoid vfp_single_unpack(struct vfp_single *s, s32 val)
{
u32 significand;
/* * Re-pack a single-precision float. This assumes that the float is * already normalised such that the MSB is bit 30, _not_ bit 31.
*/ staticinline s32 vfp_single_pack(struct vfp_single *s)
{
u32 val;
val = (s->sign << 16) +
(s->exponent << VFP_SINGLE_MANTISSA_BITS) +
(s->significand >> VFP_SINGLE_LOW_BITS); return (s32)val;
}
/* * VFP_REG_ZERO is a special register number for vfp_get_double * which returns (double)0.0. This is useful for the compare with * zero instructions.
*/ #ifdef CONFIG_VFPv3 #define VFP_REG_ZERO 32 #else #define VFP_REG_ZERO 16 #endif
asmlinkage u64 vfp_get_double(unsignedint reg);
asmlinkage void vfp_put_double(u64 val, unsignedint reg);
/* * The bit in an unpacked double which indicates that it is a quiet NaN
*/ #define VFP_DOUBLE_SIGNIFICAND_QNAN (1ULL << (VFP_DOUBLE_MANTISSA_BITS - 1 + VFP_DOUBLE_LOW_BITS))
/* * Unpack a double-precision float. Note that this returns the magnitude * of the double-precision float mantissa with the 1. if necessary, * aligned to bit 62.
*/ staticinlinevoid vfp_double_unpack(struct vfp_double *s, s64 val)
{
u64 significand;
/* * Re-pack a double-precision float. This assumes that the float is * already normalised such that the MSB is bit 30, _not_ bit 31.
*/ staticinline s64 vfp_double_pack(struct vfp_double *s)
{
u64 val;
val = ((u64)s->sign << 48) +
((u64)s->exponent << VFP_DOUBLE_MANTISSA_BITS) +
(s->significand >> VFP_DOUBLE_LOW_BITS); return (s64)val;
}
staticinlineint vfp_double_type(struct vfp_double *s)
{ int type = VFP_NUMBER; if (s->exponent == 2047) { if (s->significand == 0)
type = VFP_INFINITY; elseif (s->significand & VFP_DOUBLE_SIGNIFICAND_QNAN)
type = VFP_QNAN; else
type = VFP_SNAN;
} elseif (s->exponent == 0) { if (s->significand == 0)
type |= VFP_ZERO; else
type |= VFP_DENORMAL;
} return type;
}
/* * A special flag to tell the normalisation code not to normalise.
*/ #define VFP_NAN_FLAG 0x100
/* * A bit pattern used to indicate the initial (unset) value of the * exception mask, in case nothing handles an instruction. This * doesn't include the NAN flag, which get masked out before * we check for an error.
*/ #define VFP_EXCEPTION_ERROR ((u32)-1 & ~VFP_NAN_FLAG)
/* * A flag to tell vfp instruction type. * OP_SCALAR - this operation always operates in scalar mode * OP_SD - the instruction exceptionally writes to a single precision result. * OP_DD - the instruction exceptionally writes to a double precision result. * OP_SM - the instruction exceptionally reads from a single precision operand.
*/ #define OP_SCALAR (1 << 0) #define OP_SD (1 << 1) #define OP_DD (1 << 1) #define OP_SM (1 << 2)
struct op {
u32 (* const fn)(int dd, int dn, int dm, u32 fpscr);
u32 flags;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.