aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-12-17 17:57:15 +0100
committerCédric Le Goater <clg@kaod.org>2021-12-17 17:57:15 +0100
commitffdaff8e9c698061f57a6b1827570562c5a1c909 (patch)
tree2422faa260a32612b275ae141ffcf554d02897c6
parente4052bb773cc829a27786d68caa22f28cff19d39 (diff)
target/ppc: Split out do_fmadd
Create a common function for all of the madd helpers. Let the compiler tail call or inline as it chooses. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20211119160502.17432-20-richard.henderson@linaro.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
-rw-r--r--target/ppc/fpu_helper.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index f5d6bb4eba..d7e0362e80 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -693,23 +693,26 @@ static void float_invalid_op_madd(CPUPPCState *env, int flags,
}
}
-#define FPU_FMADD(op, madd_flags) \
-uint64_t helper_##op(CPUPPCState *env, uint64_t arg1, \
- uint64_t arg2, uint64_t arg3) \
-{ \
- uint32_t flags; \
- float64 ret = float64_muladd(arg1, arg2, arg3, madd_flags, \
- &env->fp_status); \
- flags = get_float_exception_flags(&env->fp_status); \
- if (flags) { \
- if (flags & float_flag_invalid) { \
- float_invalid_op_madd(env, flags, 1, GETPC()); \
- } \
- do_float_check_status(env, GETPC()); \
- } \
- return ret; \
+static float64 do_fmadd(CPUPPCState *env, float64 a, float64 b,
+ float64 c, int madd_flags, uintptr_t retaddr)
+{
+ float64 ret = float64_muladd(a, b, c, madd_flags, &env->fp_status);
+ int flags = get_float_exception_flags(&env->fp_status);
+
+ if (flags) {
+ if (flags & float_flag_invalid) {
+ float_invalid_op_madd(env, flags, 1, retaddr);
+ }
+ do_float_check_status(env, retaddr);
+ }
+ return ret;
}
+#define FPU_FMADD(op, madd_flags) \
+ uint64_t helper_##op(CPUPPCState *env, uint64_t arg1, \
+ uint64_t arg2, uint64_t arg3) \
+ { return do_fmadd(env, arg1, arg2, arg3, madd_flags, GETPC()); }
+
#define MADD_FLGS 0
#define MSUB_FLGS float_muladd_negate_c
#define NMADD_FLGS float_muladd_negate_result