target/arm: Make VFP_CONV_FIX macros take separate float type and float size
Currently the VFP_CONV_FIX macros take a single fsz argument for the size of the float type, which is used both to select the name of the functions to call (eg float32_is_any_nan()) and also for the type to use for the float inputs and outputs (eg float32). Separate these into fsz and ftype arguments, so that we can use them for fp16, which uses 'float16' in the function names but is still passing inputs and outputs in a 32-bit sized type. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20200828183354.27913-14-peter.maydell@linaro.org
This commit is contained in:
parent
0094e9f475
commit
5366f6ad7d
|
@ -394,13 +394,13 @@ float32 VFP_HELPER(fcvts, d)(float64 x, CPUARMState *env)
|
|||
}
|
||||
|
||||
/* VFP3 fixed point conversion. */
|
||||
#define VFP_CONV_FIX_FLOAT(name, p, fsz, isz, itype) \
|
||||
float##fsz HELPER(vfp_##name##to##p)(uint##isz##_t x, uint32_t shift, \
|
||||
#define VFP_CONV_FIX_FLOAT(name, p, fsz, ftype, isz, itype) \
|
||||
ftype HELPER(vfp_##name##to##p)(uint##isz##_t x, uint32_t shift, \
|
||||
void *fpstp) \
|
||||
{ return itype##_to_##float##fsz##_scalbn(x, -shift, fpstp); }
|
||||
|
||||
#define VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, isz, itype, ROUND, suff) \
|
||||
uint##isz##_t HELPER(vfp_to##name##p##suff)(float##fsz x, uint32_t shift, \
|
||||
#define VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, ftype, isz, itype, ROUND, suff) \
|
||||
uint##isz##_t HELPER(vfp_to##name##p##suff)(ftype x, uint32_t shift, \
|
||||
void *fpst) \
|
||||
{ \
|
||||
if (unlikely(float##fsz##_is_any_nan(x))) { \
|
||||
|
@ -410,30 +410,30 @@ uint##isz##_t HELPER(vfp_to##name##p##suff)(float##fsz x, uint32_t shift, \
|
|||
return float##fsz##_to_##itype##_scalbn(x, ROUND, shift, fpst); \
|
||||
}
|
||||
|
||||
#define VFP_CONV_FIX(name, p, fsz, isz, itype) \
|
||||
VFP_CONV_FIX_FLOAT(name, p, fsz, isz, itype) \
|
||||
VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, isz, itype, \
|
||||
#define VFP_CONV_FIX(name, p, fsz, ftype, isz, itype) \
|
||||
VFP_CONV_FIX_FLOAT(name, p, fsz, ftype, isz, itype) \
|
||||
VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, ftype, isz, itype, \
|
||||
float_round_to_zero, _round_to_zero) \
|
||||
VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, isz, itype, \
|
||||
VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, ftype, isz, itype, \
|
||||
get_float_rounding_mode(fpst), )
|
||||
|
||||
#define VFP_CONV_FIX_A64(name, p, fsz, isz, itype) \
|
||||
VFP_CONV_FIX_FLOAT(name, p, fsz, isz, itype) \
|
||||
VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, isz, itype, \
|
||||
#define VFP_CONV_FIX_A64(name, p, fsz, ftype, isz, itype) \
|
||||
VFP_CONV_FIX_FLOAT(name, p, fsz, ftype, isz, itype) \
|
||||
VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, ftype, isz, itype, \
|
||||
get_float_rounding_mode(fpst), )
|
||||
|
||||
VFP_CONV_FIX(sh, d, 64, 64, int16)
|
||||
VFP_CONV_FIX(sl, d, 64, 64, int32)
|
||||
VFP_CONV_FIX_A64(sq, d, 64, 64, int64)
|
||||
VFP_CONV_FIX(uh, d, 64, 64, uint16)
|
||||
VFP_CONV_FIX(ul, d, 64, 64, uint32)
|
||||
VFP_CONV_FIX_A64(uq, d, 64, 64, uint64)
|
||||
VFP_CONV_FIX(sh, s, 32, 32, int16)
|
||||
VFP_CONV_FIX(sl, s, 32, 32, int32)
|
||||
VFP_CONV_FIX_A64(sq, s, 32, 64, int64)
|
||||
VFP_CONV_FIX(uh, s, 32, 32, uint16)
|
||||
VFP_CONV_FIX(ul, s, 32, 32, uint32)
|
||||
VFP_CONV_FIX_A64(uq, s, 32, 64, uint64)
|
||||
VFP_CONV_FIX(sh, d, 64, float64, 64, int16)
|
||||
VFP_CONV_FIX(sl, d, 64, float64, 64, int32)
|
||||
VFP_CONV_FIX_A64(sq, d, 64, float64, 64, int64)
|
||||
VFP_CONV_FIX(uh, d, 64, float64, 64, uint16)
|
||||
VFP_CONV_FIX(ul, d, 64, float64, 64, uint32)
|
||||
VFP_CONV_FIX_A64(uq, d, 64, float64, 64, uint64)
|
||||
VFP_CONV_FIX(sh, s, 32, float32, 32, int16)
|
||||
VFP_CONV_FIX(sl, s, 32, float32, 32, int32)
|
||||
VFP_CONV_FIX_A64(sq, s, 32, float32, 64, int64)
|
||||
VFP_CONV_FIX(uh, s, 32, float32, 32, uint16)
|
||||
VFP_CONV_FIX(ul, s, 32, float32, 32, uint32)
|
||||
VFP_CONV_FIX_A64(uq, s, 32, float32, 64, uint64)
|
||||
|
||||
#undef VFP_CONV_FIX
|
||||
#undef VFP_CONV_FIX_FLOAT
|
||||
|
|
Loading…
Reference in a new issue