From patchwork Wed Nov 6 20:31:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Musta X-Patchwork-Id: 289023 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 BF7FE2C0127 for ; Thu, 7 Nov 2013 08:21:27 +1100 (EST) Received: from localhost ([::1]:35950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve9sY-0007fv-Iu for incoming@patchwork.ozlabs.org; Wed, 06 Nov 2013 15:39:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve9mi-0000P7-5J for qemu-devel@nongnu.org; Wed, 06 Nov 2013 15:33:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ve9mZ-0003X7-Ip for qemu-devel@nongnu.org; Wed, 06 Nov 2013 15:33:04 -0500 Received: from mail-vb0-x230.google.com ([2607:f8b0:400c:c02::230]:51543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve9mZ-0003X3-E8; Wed, 06 Nov 2013 15:32:55 -0500 Received: by mail-vb0-f48.google.com with SMTP id o19so18842vbm.35 for ; Wed, 06 Nov 2013 12:32:55 -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=m/S+3OGITa+YoMo3yOQmmpk8HFWkQ5CeBk0FJU8tJGs=; b=JT3q6XEoHiuEIoyY00W1ybTFvbk4yV735kXWTsIGj2J7brCBobJkw0IHKJ2dfy8wSj xVtKtDs1WYmQmNZBbKBwMaEUTOmUfEgfq5W1n0cIQi9unNqPSrnvgsy6S1KahRW91pAp AzPMpGvDNOX31ypvQPTy2pxakLUNnoaz83Lp9p0oWlTySc7xKPVQw78pj86yXYyxRr9p PpzTg/HbvizZvIhQR7MhmTfHwN1hu7ebtJALTczOsQuKEFFzVxUiWzoLR3g7kX15W+vJ 8KpwQJG0uNklwHInVIYNEVl6HMEYyDG5BhOEe2U/K7zVxRiY8/CpZgf8UFoEYuyW+T/I DkjQ== X-Received: by 10.221.53.74 with SMTP id vp10mr83378vcb.54.1383769975068; Wed, 06 Nov 2013 12:32:55 -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.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 12:32:54 -0800 (PST) From: Tom Musta To: qemu-devel@nongnu.org, tommusta@gmail.com Date: Wed, 6 Nov 2013 14:31:52 -0600 Message-Id: <1383769916-5582-11-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:c02::230 Cc: qemu-ppc@nongnu.org Subject: [Qemu-devel] [PATCH 10/14] VSX Stage 4: Add xssqrtsp 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 Square Root Single Precision (xssqrtsp) instruction. The existing VSX_SQRT() macro is modified to support rounding of the intermediate double-precision 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 862f855..c4e52ea 100644 --- a/target-ppc/fpu_helper.c +++ b/target-ppc/fpu_helper.c @@ -1973,7 +1973,7 @@ VSX_RE(xvresp, 4, float32, f32, 0, 0) * fld - vsr_t field (f32 or f64) * sfprf - set FPRF */ -#define VSX_SQRT(op, nels, tp, fld, sfprf) \ +#define VSX_SQRT(op, nels, tp, fld, sfprf, r2sp) \ void helper_##op(CPUPPCState *env, uint32_t opcode) \ { \ ppc_vsr_t xt, xb; \ @@ -1997,6 +1997,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); \ } \ @@ -2006,9 +2011,10 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) \ helper_float_check_status(env); \ } -VSX_SQRT(xssqrtdp, 1, float64, f64, 1) -VSX_SQRT(xvsqrtdp, 2, float64, f64, 0) -VSX_SQRT(xvsqrtsp, 4, float32, f32, 0) +VSX_SQRT(xssqrtdp, 1, float64, f64, 1, 0) +VSX_SQRT(xssqrtsp, 1, float64, f64, 1, 1) +VSX_SQRT(xvsqrtdp, 2, float64, f64, 0, 0) +VSX_SQRT(xvsqrtsp, 4, float32, f32, 0, 0) /* VSX_RSQRTE - VSX floating point reciprocal square root estimate * op - instruction mnemonic diff --git a/target-ppc/helper.h b/target-ppc/helper.h index b1cf3c0..0192043 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -291,6 +291,7 @@ DEF_HELPER_2(xssubsp, void, env, i32) DEF_HELPER_2(xsmulsp, void, env, i32) DEF_HELPER_2(xsdivsp, void, env, i32) DEF_HELPER_2(xsresp, void, env, i32) +DEF_HELPER_2(xssqrtsp, 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 c4c57a1..b9cd35b 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -7346,6 +7346,7 @@ GEN_VSX_HELPER_2(xssubsp, 0x00, 0x01, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xsmulsp, 0x00, 0x02, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xsdivsp, 0x00, 0x03, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xsresp, 0x14, 0x01, 0, PPC2_VSX207) +GEN_VSX_HELPER_2(xssqrtsp, 0x16, 0x00, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xvadddp, 0x00, 0x0C, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvsubdp, 0x00, 0x0D, 0, PPC2_VSX) @@ -10159,6 +10160,7 @@ GEN_XX3FORM(xssubsp, 0x00, 0x01, PPC2_VSX207), GEN_XX3FORM(xsmulsp, 0x00, 0x02, PPC2_VSX207), GEN_XX3FORM(xsdivsp, 0x00, 0x03, PPC2_VSX207), GEN_XX2FORM(xsresp, 0x14, 0x01, PPC2_VSX207), +GEN_XX2FORM(xssqrtsp, 0x16, 0x00, PPC2_VSX207), GEN_XX3FORM(xvadddp, 0x00, 0x0C, PPC2_VSX), GEN_XX3FORM(xvsubdp, 0x00, 0x0D, PPC2_VSX),