From patchwork Wed Jan 16 16:49:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 212823 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8BFA22C0080 for ; Thu, 17 Jan 2013 03:55:19 +1100 (EST) Received: from localhost ([::1]:52391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvWGj-00033s-M7 for incoming@patchwork.ozlabs.org; Wed, 16 Jan 2013 11:55:17 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvWGU-0002vA-Tw for qemu-devel@nongnu.org; Wed, 16 Jan 2013 11:55:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvWGT-0006h5-6I for qemu-devel@nongnu.org; Wed, 16 Jan 2013 11:55:02 -0500 Received: from mail-ie0-f178.google.com ([209.85.223.178]:65416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvWGT-0006gm-1I; Wed, 16 Jan 2013 11:55:01 -0500 Received: by mail-ie0-f178.google.com with SMTP id c12so2983935ieb.9 for ; Wed, 16 Jan 2013 08:55:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=I3A2JOEuUElLFdhYm2+SAgCDStCkmZ2pKWiKeBXg0wQ=; b=XK5Z88QVv3o0RMtxPhBwsIFu0XPEteqWwpx911e1P84woW9yQw9mDua17ne7Tb1Ie6 GDA1YR5spczayd4ezDEJd7fC3sO6Z4D7RPUr7vQJwusRm58xXoCYgHX6zkzMGJoNzi4l Vq4lAK+k9en5Q0v6atADLYxjMbqdxmWWFAAJVjwVq578ahBlLgyHHDneBJjx1MnlQmaW GzO1ghlpLEneEAseme8rtz/73FxxE98ZMlnN8GOfUA94/C8kEz1EiPup7az9hGpgIpHA 8kLh60xa0h/6Tq1KSvCn1FdVTvB3fDhFiRnhsHbqotAcv2LTlHfS3jBY9FTw015FQHjB qnIg== X-Received: by 10.50.41.136 with SMTP id f8mr1207815igl.105.1358355300406; Wed, 16 Jan 2013 08:55:00 -0800 (PST) Received: from localhost ([32.97.110.59]) by mx.google.com with ESMTPS id ww6sm4746189igb.2.2013.01.16.08.54.59 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 16 Jan 2013 08:54:59 -0800 (PST) From: Michael Roth To: qemu-devel@nongnu.org Date: Wed, 16 Jan 2013 10:49:07 -0600 Message-Id: <1358354963-9070-6-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1358354963-9070-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1358354963-9070-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.223.178 Cc: aliguori@us.ibm.com, qemu-stable@nongnu.org Subject: [Qemu-devel] [PATCH 05/21] target-mips: Fix incorrect code and test for INSV X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Petar Jovanovic Content of register rs should be shifted for pos before applying a mask. This change contains both fix for the instruction and to the existing test. Signed-off-by: Petar Jovanovic Reviewed-by: Eric Johnson Signed-off-by: Aurelien Jarno (cherry picked from commit 34f5606ee101f82a247d09d05644ad2a63c8e342) Signed-off-by: Michael Roth --- target-mips/dsp_helper.c | 2 +- tests/tcg/mips/mips32-dsp/insv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c index e7949c2..fda5f04 100644 --- a/target-mips/dsp_helper.c +++ b/target-mips/dsp_helper.c @@ -3152,7 +3152,7 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong rs, \ \ filter = ((int32_t)0x01 << size) - 1; \ filter = filter << pos; \ - temprs = rs & filter; \ + temprs = (rs << pos) & filter; \ temprt = rt & ~filter; \ temp = temprs | temprt; \ \ diff --git a/tests/tcg/mips/mips32-dsp/insv.c b/tests/tcg/mips/mips32-dsp/insv.c index 7e3b047..243b007 100644 --- a/tests/tcg/mips/mips32-dsp/insv.c +++ b/tests/tcg/mips/mips32-dsp/insv.c @@ -10,7 +10,7 @@ int main() dsp = 0x305; rt = 0x12345678; rs = 0x87654321; - result = 0x12345338; + result = 0x12345438; __asm ("wrdsp %2, 0x03\n\t" "insv %0, %1\n\t"