From patchwork Wed Nov 6 20:31:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Musta X-Patchwork-Id: 289007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B56A32C0091 for ; Thu, 7 Nov 2013 07:36:32 +1100 (EST) Received: from localhost ([::1]:35918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve9q2-0003bg-L9 for incoming@patchwork.ozlabs.org; Wed, 06 Nov 2013 15:36:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve9mW-00008S-Hj for qemu-devel@nongnu.org; Wed, 06 Nov 2013 15:33:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ve9mN-0003V1-GL for qemu-devel@nongnu.org; Wed, 06 Nov 2013 15:32:52 -0500 Received: from mail-ve0-x231.google.com ([2607:f8b0:400c:c01::231]:54070) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve9mN-0003Ux-BW; Wed, 06 Nov 2013 15:32:43 -0500 Received: by mail-ve0-f177.google.com with SMTP id oz11so22860veb.8 for ; Wed, 06 Nov 2013 12:32:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4/AIko36et47HBk4d9Fp0GR6l76UY/43om6xPK8cH4o=; b=NM/AuADkmkXEoSucIb5nB1+a9ZA+4nIBldc0bz9ux1BJXaJSzKxooVQJVUU+ma9zde VDY+IAHTqo7mH5VrxI0Pg46jFUs/QqilMFT8d3trprWQ8fKDqWzs0HXVDlcBMvcQp+Pz +EaGByRcypHgfGLbm5KE835fwNl+p4QDcGViVNMHVMI5Zus44jCxl1n73jegdQq66/hX ElLv5rWHzSovzbBqhK+tCrTuobRxOuDQVnP/+LivcxRhySnikRNzgmcPTbR1RMIcFnz2 lvJfA3dk9yPcYATG5Zt/5EFcAvV5uFwynyq0NY1A9/Nnrdw4XH/bsLYlp+YSm6dxLyPZ 4p0A== X-Received: by 10.52.77.38 with SMTP id p6mr81828vdw.60.1383769962927; Wed, 06 Nov 2013 12:32:42 -0800 (PST) Received: from tmusta-sc.rchland.ibm.com (rchp4.rochester.ibm.com. [129.42.161.36]) by mx.google.com with ESMTPSA id rx6sm28375094vec.6.2013.11.06.12.32.39 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 12:32:42 -0800 (PST) From: Tom Musta To: qemu-devel@nongnu.org, tommusta@gmail.com Date: Wed, 6 Nov 2013 14:31:49 -0600 Message-Id: <1383769916-5582-8-git-send-email-tommusta@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1383769916-5582-1-git-send-email-tommusta@gmail.com> References: <1383769916-5582-1-git-send-email-tommusta@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400c:c01::231 Cc: qemu-ppc@nongnu.org Subject: [Qemu-devel] [PATCH 07/14] VSX Stage 4: Add xsmulsp 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 This patch adds the VSX Scalar Multiply Single-Precision (xsmulsp) instruction. The existing VSX_MUL macro is modified to support rounding of the intermediate result to single precision. Signed-off-by: Tom Musta --- target-ppc/fpu_helper.c | 14 ++++++++++---- target-ppc/helper.h | 1 + target-ppc/translate.c | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/target-ppc/fpu_helper.c b/target-ppc/fpu_helper.c index 7b4958a..e5127b2 100644 --- a/target-ppc/fpu_helper.c +++ b/target-ppc/fpu_helper.c @@ -1823,7 +1823,7 @@ VSX_ADD_SUB(xvsubsp, sub, 4, float32, f32, 0, 0) * fld - vsr_t field (f32 or f64) * sfprf - set FPRF */ -#define VSX_MUL(op, nels, tp, fld, sfprf) \ +#define VSX_MUL(op, nels, tp, fld, sfprf, r2sp) \ void helper_##op(CPUPPCState *env, uint32_t opcode) \ { \ ppc_vsr_t xt, xa, xb; \ @@ -1850,6 +1850,11 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) \ } \ } \ \ + if (r2sp) { \ + float32 tmp32 = float64_to_float32(xt.fld[i], &env->fp_status); \ + xt.fld[i] = float32_to_float64(tmp32, &env->fp_status); \ + } \ + \ if (sfprf) { \ helper_compute_fprf(env, xt.fld[i], sfprf); \ } \ @@ -1859,9 +1864,10 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) \ helper_float_check_status(env); \ } -VSX_MUL(xsmuldp, 1, float64, f64, 1) -VSX_MUL(xvmuldp, 2, float64, f64, 0) -VSX_MUL(xvmulsp, 4, float32, f32, 0) +VSX_MUL(xsmuldp, 1, float64, f64, 1, 0) +VSX_MUL(xsmulsp, 1, float64, f64, 1, 1) +VSX_MUL(xvmuldp, 2, float64, f64, 0, 0) +VSX_MUL(xvmulsp, 4, float32, f32, 0, 0) /* VSX_DIV - VSX floating point divide * op - instruction mnemonic diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 696b9d3..0ccdc96 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -288,6 +288,7 @@ DEF_HELPER_2(xsrdpiz, void, env, i32) DEF_HELPER_2(xsaddsp, void, env, i32) DEF_HELPER_2(xssubsp, void, env, i32) +DEF_HELPER_2(xsmulsp, void, env, i32) DEF_HELPER_2(xvadddp, void, env, i32) DEF_HELPER_2(xvsubdp, void, env, i32) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index bd639cc..450ab88 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -7343,6 +7343,7 @@ GEN_VSX_HELPER_2(xsrdpiz, 0x12, 0x05, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsaddsp, 0x00, 0x00, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xssubsp, 0x00, 0x01, 0, PPC2_VSX207) +GEN_VSX_HELPER_2(xsmulsp, 0x00, 0x02, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xvadddp, 0x00, 0x0C, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvsubdp, 0x00, 0x0D, 0, PPC2_VSX) @@ -10153,6 +10154,7 @@ GEN_XX2FORM(xsrdpiz, 0x12, 0x05, PPC2_VSX), GEN_XX3FORM(xsaddsp, 0x00, 0x00, PPC2_VSX207), GEN_XX3FORM(xssubsp, 0x00, 0x01, PPC2_VSX207), +GEN_XX3FORM(xsmulsp, 0x00, 0x02, PPC2_VSX207), GEN_XX3FORM(xvadddp, 0x00, 0x0C, PPC2_VSX), GEN_XX3FORM(xvsubdp, 0x00, 0x0D, PPC2_VSX),