1From f024b8937d8b614994b94e86d2240fafcc7d2d73 Mon Sep 17 00:00:00 2001 2From: Richard Henderson <richard.henderson@linaro.org> 3Date: Fri, 17 Dec 2021 17:57:15 +0100 4Subject: [PATCH 10/21] target/ppc: Split out do_fmadd 5MIME-Version: 1.0 6Content-Type: text/plain; charset=UTF-8 7Content-Transfer-Encoding: 8bit 8 9Create a common function for all of the madd helpers. 10Let the compiler tail call or inline as it chooses. 11 12Upstream-Status: Backport 13[https://git.qemu.org/?p=qemu.git;a=commit;h=ffdaff8e9c698061f57a6b1827570562c5a1c909] 14 15Signed-off-by: Richard Henderson <richard.henderson@linaro.org> 16Message-Id: <20211119160502.17432-20-richard.henderson@linaro.org> 17Signed-off-by: Cédric Le Goater <clg@kaod.org> 18Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com> 19--- 20 target/ppc/fpu_helper.c | 33 ++++++++++++++++++--------------- 21 1 file changed, 18 insertions(+), 15 deletions(-) 22 23diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c 24index 3b1cb25666..9a1e7e6244 100644 25--- a/target/ppc/fpu_helper.c 26+++ b/target/ppc/fpu_helper.c 27@@ -649,23 +649,26 @@ static void float_invalid_op_madd(CPUPPCState *env, int flags, 28 } 29 } 30 31-#define FPU_FMADD(op, madd_flags) \ 32-uint64_t helper_##op(CPUPPCState *env, uint64_t arg1, \ 33- uint64_t arg2, uint64_t arg3) \ 34-{ \ 35- uint32_t flags; \ 36- float64 ret = float64_muladd(arg1, arg2, arg3, madd_flags, \ 37- &env->fp_status); \ 38- flags = get_float_exception_flags(&env->fp_status); \ 39- if (flags) { \ 40- if (flags & float_flag_invalid) { \ 41- float_invalid_op_madd(env, flags, 1, GETPC()); \ 42- } \ 43- do_float_check_status(env, GETPC()); \ 44- } \ 45- return ret; \ 46+static float64 do_fmadd(CPUPPCState *env, float64 a, float64 b, 47+ float64 c, int madd_flags, uintptr_t retaddr) 48+{ 49+ float64 ret = float64_muladd(a, b, c, madd_flags, &env->fp_status); 50+ int flags = get_float_exception_flags(&env->fp_status); 51+ 52+ if (flags) { 53+ if (flags & float_flag_invalid) { 54+ float_invalid_op_madd(env, flags, 1, retaddr); 55+ } 56+ do_float_check_status(env, retaddr); 57+ } 58+ return ret; 59 } 60 61+#define FPU_FMADD(op, madd_flags) \ 62+ uint64_t helper_##op(CPUPPCState *env, uint64_t arg1, \ 63+ uint64_t arg2, uint64_t arg3) \ 64+ { return do_fmadd(env, arg1, arg2, arg3, madd_flags, GETPC()); } 65+ 66 #define MADD_FLGS 0 67 #define MSUB_FLGS float_muladd_negate_c 68 #define NMADD_FLGS float_muladd_negate_result 69-- 702.17.1 71 72