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

Reply via email to