1
From 2b72a5ecbd70249e50c8b6458e8e4acbc8f93071 Mon Sep 17 00:00:00 2001
2
From: Will Newton <will.newton@linaro.org>
3
Date: Tue, 7 Jan 2014 17:19:13 +0000
4
Subject: [PATCH 102/158] target-arm: Prepare VFP_CONV_FIX helpers for A64 uses
6
Make the VFP_CONV_FIX helpers a little more flexible in
7
preparation for the A64 uses. This requires two changes:
8
* use the correct softfloat conversion function based on itype
9
rather than always the int32 one; this is possible now that
10
softfloat provides int16 versions and necessary for the
11
future conversion-to-int64 A64 variants. This also allows
12
us to drop the awkward 'sign' macro argument.
13
* split the 'fsz' argument which currently controls both
14
width of the input float type and width of the output
15
integer type into two; this will allow us to specify the
16
A64 64-bit-int-to-single conversion function, where the
17
two widths are different.
19
We can also drop the (itype##_t) cast now that softfloat
20
guarantees that all the itype##_to_float* functions take
21
an integer argument of exactly the correct type.
23
Signed-off-by: Will Newton <will.newton@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Reviewed-by: Richard Henderson <rth@twiddle.net>
27
target-arm/helper.c | 28 ++++++++++++++--------------
28
1 file changed, 14 insertions(+), 14 deletions(-)
30
diff --git a/target-arm/helper.c b/target-arm/helper.c
31
index 12d995d..d0754e0 100644
32
--- a/target-arm/helper.c
33
+++ b/target-arm/helper.c
34
@@ -4011,17 +4011,17 @@ float32 VFP_HELPER(fcvts, d)(float64 x, CPUARMState *env)
37
/* VFP3 fixed point conversion. */
38
-#define VFP_CONV_FIX(name, p, fsz, itype, sign) \
39
-float##fsz HELPER(vfp_##name##to##p)(uint##fsz##_t x, uint32_t shift, \
41
+#define VFP_CONV_FIX(name, p, fsz, isz, itype) \
42
+float##fsz HELPER(vfp_##name##to##p)(uint##isz##_t x, uint32_t shift, \
45
float_status *fpst = fpstp; \
47
- tmp = sign##int32_to_##float##fsz((itype##_t)x, fpst); \
48
+ tmp = itype##_to_##float##fsz(x, fpst); \
49
return float##fsz##_scalbn(tmp, -(int)shift, fpst); \
51
-uint##fsz##_t HELPER(vfp_to##name##p)(float##fsz x, uint32_t shift, \
53
+uint##isz##_t HELPER(vfp_to##name##p)(float##fsz x, uint32_t shift, \
56
float_status *fpst = fpstp; \
58
@@ -4033,14 +4033,14 @@ uint##fsz##_t HELPER(vfp_to##name##p)(float##fsz x, uint32_t shift, \
59
return float##fsz##_to_##itype##_round_to_zero(tmp, fpst); \
62
-VFP_CONV_FIX(sh, d, 64, int16, )
63
-VFP_CONV_FIX(sl, d, 64, int32, )
64
-VFP_CONV_FIX(uh, d, 64, uint16, u)
65
-VFP_CONV_FIX(ul, d, 64, uint32, u)
66
-VFP_CONV_FIX(sh, s, 32, int16, )
67
-VFP_CONV_FIX(sl, s, 32, int32, )
68
-VFP_CONV_FIX(uh, s, 32, uint16, u)
69
-VFP_CONV_FIX(ul, s, 32, uint32, u)
70
+VFP_CONV_FIX(sh, d, 64, 64, int16)
71
+VFP_CONV_FIX(sl, d, 64, 64, int32)
72
+VFP_CONV_FIX(uh, d, 64, 64, uint16)
73
+VFP_CONV_FIX(ul, d, 64, 64, uint32)
74
+VFP_CONV_FIX(sh, s, 32, 32, int16)
75
+VFP_CONV_FIX(sl, s, 32, 32, int32)
76
+VFP_CONV_FIX(uh, s, 32, 32, uint16)
77
+VFP_CONV_FIX(ul, s, 32, 32, uint32)
80
/* Half precision conversions. */