From patchwork Wed Jan 9 15:27:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 210743 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 B27082C018B for ; Thu, 10 Jan 2013 03:12:14 +1100 (EST) Received: from localhost ([::1]:54678 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsxaA-0007w9-1d for incoming@patchwork.ozlabs.org; Wed, 09 Jan 2013 10:28:46 -0500 Received: from eggs.gnu.org ([208.118.235.92]:57175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsxZX-0006Tm-3W for qemu-devel@nongnu.org; Wed, 09 Jan 2013 10:28:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsxZU-0007q9-Eg for qemu-devel@nongnu.org; Wed, 09 Jan 2013 10:28:07 -0500 Received: from hall.aurel32.net ([2001:470:1f15:c4f::1]:56149) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsxZU-0007pv-88 for qemu-devel@nongnu.org; Wed, 09 Jan 2013 10:28:04 -0500 Received: from [37.160.19.124] (helo=ohm.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1TsxZQ-0004ht-VS; Wed, 09 Jan 2013 16:28:03 +0100 Received: from aurel32 by ohm.aurel32.net with local (Exim 4.80) (envelope-from ) id 1TsxZG-0002xL-Nn; Wed, 09 Jan 2013 16:27:50 +0100 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Wed, 9 Jan 2013 16:27:44 +0100 Message-Id: <1357745265-16084-8-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1357745265-16084-1-git-send-email-aurelien@aurel32.net> References: <1357745265-16084-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:470:1f15:c4f::1 Cc: Aurelien Jarno Subject: [Qemu-devel] [PATCH v2 7/8] target-mips: use DSP unions for reduction add instructions 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 Signed-off-by: Aurelien Jarno --- target-mips/dsp_helper.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c index 1bc77a2..ea7a99f 100644 --- a/target-mips/dsp_helper.c +++ b/target-mips/dsp_helper.c @@ -1352,31 +1352,29 @@ target_ulong helper_modsub(target_ulong rs, target_ulong rt) target_ulong helper_raddu_w_qb(target_ulong rs) { - uint8_t rs3, rs2, rs1, rs0; - uint16_t temp; - - MIPSDSP_SPLIT32_8(rs, rs3, rs2, rs1, rs0); - - temp = (uint16_t)rs3 + (uint16_t)rs2 + (uint16_t)rs1 + (uint16_t)rs0; + target_ulong ret = 0; + DSP32Value ds; + unsigned int i; - return (target_ulong)temp; + ds.uw[0] = rs; + for (i = 0 ; i < 4 ; i++) { + ret += ds.ub[i]; + } + return ret; } #if defined(TARGET_MIPS64) target_ulong helper_raddu_l_ob(target_ulong rs) { - int i; - uint16_t rs_t[8]; - uint64_t temp; - - temp = 0; + target_ulong ret = 0; + DSP64Value ds; + unsigned int i; - for (i = 0; i < 8; i++) { - rs_t[i] = (rs >> (8 * i)) & MIPSDSP_Q0; - temp += (uint64_t)rs_t[i]; + ds.ul[0] = rs; + for (i = 0 ; i < 8 ; i++) { + ret += ds.ub[i]; } - - return temp; + return ret; } #endif