From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X74EC-0007te-Rl for qemu-devel@nongnu.org; Tue, 15 Jul 2014 11:01:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X74E3-0005XD-Rm for qemu-devel@nongnu.org; Tue, 15 Jul 2014 11:01:12 -0400 Received: from mail-ie0-x229.google.com ([2607:f8b0:4001:c03::229]:56125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X74E3-0005X9-F0 for qemu-devel@nongnu.org; Tue, 15 Jul 2014 11:01:03 -0400 Received: by mail-ie0-f169.google.com with SMTP id tp5so4648337ieb.0 for ; Tue, 15 Jul 2014 08:01:02 -0700 (PDT) Sender: Richard Henderson Message-ID: <53C5422B.7020404@twiddle.net> Date: Tue, 15 Jul 2014 08:00:59 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1405359671-25985-1-git-send-email-kbastian@mail.uni-paderborn.de> <1405359671-25985-8-git-send-email-kbastian@mail.uni-paderborn.de> In-Reply-To: <1405359671-25985-8-git-send-email-kbastian@mail.uni-paderborn.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 07/15] target-tricore: Add instructions of SRR opcode format List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bastian Koppelmann , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org On 07/14/2014 10:41 AM, Bastian Koppelmann wrote: > + if ((arg & 0x80000000) | (arg & 0x40000000)) { \ > + env->PSW |= MASK_USB_AV; \ > + env->PSW |= MASK_USB_SAV; \ > + } else { \ > + env->PSW &= ~MASK_USB_AV; \ > + } \ The condition is wrong. It should be (arg ^ arg *2u) & 0x80000000 Although before you go too far down the road for representing PSW as a bitmask, consider splitting it apart into separate fields as we do on ARM. If you define S/AV as being bit 31 of two dedicated fields, then you don't even need the mask. You can do env->PSW_AV = arg ^ arg * 2u; env->PSW_SAV |= env->PSW_AV; which will most definitely be faster. Especially when you'll be wanting to inline that after most every arithmetic insn. r~