From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcWPT-00014m-IJ for qemu-devel@nongnu.org; Fri, 10 Oct 2014 05:22:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XcWPN-0000f6-7w for qemu-devel@nongnu.org; Fri, 10 Oct 2014 05:22:51 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:16179) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcWPN-0000e2-1k for qemu-devel@nongnu.org; Fri, 10 Oct 2014 05:22:45 -0400 Message-ID: <5437A55D.8000707@imgtec.com> Date: Fri, 10 Oct 2014 10:22:37 +0100 From: Leon Alrae MIME-Version: 1.0 References: <1405331763-57126-1-git-send-email-yongbok.kim@imgtec.com> <1405331763-57126-4-git-send-email-yongbok.kim@imgtec.com> In-Reply-To: <1405331763-57126-4-git-send-email-yongbok.kim@imgtec.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 03/20] target-mips: move common funcs to cpu.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yongbok Kim , qemu-devel@nongnu.org Cc: cristian.cuna@imgtec.com, aurelien@aurel32.net Hi Yongbok, On 14/07/2014 10:55, Yongbok Kim wrote: > +#include "exec/cpu_ldst.h" > + > +#if defined(CONFIG_USER_ONLY) > +#define HELPER_LD(name, insn, type) \ > +static inline type do_##name(CPUMIPSState *env, target_ulong addr, \ > + int mem_idx) \ > +{ \ > + return (type) insn##_raw(addr); \ > +} > +#else > +#define HELPER_LD(name, insn, type) \ > +static inline type do_##name(CPUMIPSState *env, target_ulong addr, \ > + int mem_idx) \ > +{ \ > + switch (mem_idx) { \ > + case 0: \ > + return (type) cpu_##insn##_kernel(env, addr); \ > + break; \ > + case 1: \ > + return (type) cpu_##insn##_super(env, addr); \ > + break; \ > + default: \ > + case 2: \ > + return (type) cpu_##insn##_user(env, addr); \ > + break; \ > + } \ > +} > +#endif > +HELPER_LD(lbu, ldub, uint8_t) > +HELPER_LD(lw, ldl, int32_t) > +#ifdef TARGET_MIPS64 > +HELPER_LD(ld, ldq, int64_t) > +#endif > +#undef HELPER_LD > + > +#if defined(CONFIG_USER_ONLY) > +#define HELPER_ST(name, insn, type) \ > +static inline void do_##name(CPUMIPSState *env, target_ulong addr, \ > + type val, int mem_idx) \ > +{ \ > + insn##_raw(addr, val); \ > +} > +#else > +#define HELPER_ST(name, insn, type) \ > +static inline void do_##name(CPUMIPSState *env, target_ulong addr, \ > + type val, int mem_idx) \ > +{ \ > + switch (mem_idx) { \ > + case 0: \ > + cpu_##insn##_kernel(env, addr, val); \ > + break; \ > + case 1: \ > + cpu_##insn##_super(env, addr, val); \ > + break; \ > + default: \ > + case 2: \ > + cpu_##insn##_user(env, addr, val); \ > + break; \ > + } \ > +} > +#endif > +HELPER_ST(sb, stb, uint8_t) > +HELPER_ST(sw, stl, uint32_t) > +#ifdef TARGET_MIPS64 > +HELPER_ST(sd, stq, uint64_t) > +#endif > +#undef HELPER_ST > + I'm not sure if moving this to cpu.h is a good idea - it won't be used anywhere else than in op_helper.c and msa_helper.c (and probably these static inlines will generate warnings in clang). Only msa_ld_df and msa_st_df in msa_helper.c need them, thus in my opinion it will be better just to move these 2 functions from msa_helper.c to op_helper.c. Regards, Leon