From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCYOv-0005Da-1s for qemu-devel@nongnu.org; Tue, 27 Mar 2012 11:33:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCYOq-0000Zr-AF for qemu-devel@nongnu.org; Tue, 27 Mar 2012 11:33:36 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:63464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCYOq-0000ZY-3K for qemu-devel@nongnu.org; Tue, 27 Mar 2012 11:33:32 -0400 Received: by yhoo21 with SMTP id o21so35827yho.4 for ; Tue, 27 Mar 2012 08:33:29 -0700 (PDT) Sender: Richard Henderson Message-ID: <4F71DDC6.10700@twiddle.net> Date: Tue, 27 Mar 2012 08:33:26 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1332840290-24553-1-git-send-email-proljc@gmail.com> <1332840290-24553-2-git-send-email-proljc@gmail.com> In-Reply-To: <1332840290-24553-2-git-send-email-proljc@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V3 01/12] add MIPS DSP internal functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jia Liu Cc: qemu-devel@nongnu.org, aurelien@aurel32.net On 03/27/12 02:24, Jia Liu wrote: > +ifeq ($(TARGET_BASE_ARCH), mips) > +libobj-y += dsp_helper.o > +endif ... > +#include "dyngen-exec.h" > + > +/*** MIPS DSP internal functions begin ***/ > +static inline void set_DSPControl_overflow_flag(uint32_t flag, int position) > +{ > + env->active_tc.DSPControl |= (target_ulong)flag << position; > +} In order to use dyngen-exec.h, and the global ENV variable, you must also do dsp_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) in the Makefile.target. If you had tested i386 host instead of x86_64, you should have seen this failure. Better, from the point of view of one working toward eliminating dyngen-exec.h and these special calling conventions, is to actually pass down env in the helper. E.g. +/** DSP Arithmetic Sub-class insns **/ +uint32_t helper_addq_ph(CPUMIPSState *env, uint32_t rs, uint32_t rt) +DEF_HELPER_FLAGS_3(addq_ph, 0, i32, env, i32, i32) where mipsdsp_add_i16 and thence set_DSPControl_overflow_flag also grow ENV parameters. In addition, we can't use TCG_CALL_CONST | TCG_CALL_PURE on any function that sets DSPControl, because that's the cpu_dspctrl tcg variable. You might get better performance out of TCG if you do *not* make DSPControl a TCG variable, but instead perform explicit loads from that slot in the few places that need it. That way you can at least set TCG_CALL_CONST. (Though not TCG_CALL_PURE, because the functions do have side effects.) > + if (len == 2) > + env->active_tc.DSPControl &= 0xFCFFFFFF; > + else if (len == 4) > + env->active_tc.DSPControl &= 0xF0FFFFFF; Run all your patches through ./scripts/checkpatch.pl and fix the errors that will report. r~