From patchwork Tue Dec 3 15:58:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Musta X-Patchwork-Id: 296221 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 ECCC72C0087 for ; Wed, 4 Dec 2013 03:01:33 +1100 (EST) Received: from localhost ([::1]:43141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnsPj-0005ph-Ha for incoming@patchwork.ozlabs.org; Tue, 03 Dec 2013 11:01:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnsNW-0003ZB-VU for qemu-devel@nongnu.org; Tue, 03 Dec 2013 10:59:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnsNO-0006SF-F8 for qemu-devel@nongnu.org; Tue, 03 Dec 2013 10:59:14 -0500 Received: from mail-qc0-x230.google.com ([2607:f8b0:400d:c01::230]:60740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnsNO-0006S8-9s; Tue, 03 Dec 2013 10:59:06 -0500 Received: by mail-qc0-f176.google.com with SMTP id i8so2186107qcq.21 for ; Tue, 03 Dec 2013 07:59:05 -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=ipQw6LxQyY3nh/bl5SVFkSMIlVtugy1pWNmuhMa1MZI=; b=CdkIdRSOYxzNczteBx1vTvnQBXiyPhsiQXa2xUpf/+deFehn0BJetwwV5JIVzg1CXN AVUltl1MLgf7ybImU7hXkQn4r7TMNU9+APUljBePLDk+pi+VozKFALxZk3dhfQZ8cjfi IjdE0mviWvol1FvsGbA7kmGgf+ZtMMWu5v+F0K95uzRGZtKoLRjDHhcReyGMGIzCWAmf /zwCTWN6NW/NcW7kCyLP2KahShcygYOwXdHkR8H07Rc1r+OM+mZGoEZ4/pI2Lv/q9nGw 1jOlniRizLhANwH8nwS6DEhIwpCWdouwIIfLqv3rtwd8D38S0DI5m538Nuhuq6vIHlFP p1Qg== X-Received: by 10.49.127.101 with SMTP id nf5mr127734741qeb.61.1386086345759; Tue, 03 Dec 2013 07:59:05 -0800 (PST) Received: from tmusta-sc.rchland.ibm.com (rchp4.rochester.ibm.com. [129.42.161.36]) by mx.google.com with ESMTPSA id v3sm54494921qaj.12.2013.12.03.07.59.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 07:59:04 -0800 (PST) From: Tom Musta To: qemu-devel@nongnu.org Date: Tue, 3 Dec 2013 09:58:22 -0600 Message-Id: <1386086305-8163-12-git-send-email-tommusta@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386086305-8163-1-git-send-email-tommusta@gmail.com> References: <1386086305-8163-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:400d:c01::230 Cc: Tom Musta , qemu-ppc@nongnu.org Subject: [Qemu-devel] [V3 PATCH 11/14] target-ppc: VSX Stage 4: add xsrsqrtesp 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 Reciprocal Square Root Estimate Single Precision (xsrsqrtesp) instruction. The existing VSX_RSQRTE() macro is modified to support rounding of the intermediate double-precision result to single precision. V2: Updated conversion to single precision range. Signed-off-by: Tom Musta --- target-ppc/fpu_helper.c | 13 +++++++++---- target-ppc/helper.h | 1 + target-ppc/translate.c | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/target-ppc/fpu_helper.c b/target-ppc/fpu_helper.c index 34a8b66..8825db2 100644 --- a/target-ppc/fpu_helper.c +++ b/target-ppc/fpu_helper.c @@ -2018,7 +2018,7 @@ VSX_SQRT(xvsqrtsp, 4, float32, f32, 0, 0) * fld - vsr_t field (f32 or f64) * sfprf - set FPRF */ -#define VSX_RSQRTE(op, nels, tp, fld, sfprf) \ +#define VSX_RSQRTE(op, nels, tp, fld, sfprf, r2sp) \ void helper_##op(CPUPPCState *env, uint32_t opcode) \ { \ ppc_vsr_t xt, xb; \ @@ -2043,6 +2043,10 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) \ } \ } \ \ + if (r2sp) { \ + xt.fld[i] = helper_frsp(env, xt.fld[i]); \ + } \ + \ if (sfprf) { \ helper_compute_fprf(env, xt.fld[i], sfprf); \ } \ @@ -2052,9 +2056,10 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) \ helper_float_check_status(env); \ } -VSX_RSQRTE(xsrsqrtedp, 1, float64, f64, 1) -VSX_RSQRTE(xvrsqrtedp, 2, float64, f64, 0) -VSX_RSQRTE(xvrsqrtesp, 4, float32, f32, 0) +VSX_RSQRTE(xsrsqrtedp, 1, float64, f64, 1, 0) +VSX_RSQRTE(xsrsqrtesp, 1, float64, f64, 1, 1) +VSX_RSQRTE(xvrsqrtedp, 2, float64, f64, 0, 0) +VSX_RSQRTE(xvrsqrtesp, 4, float32, f32, 0, 0) static inline int ppc_float32_get_unbiased_exp(float32 f) { diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 0192043..84c6ee1 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -292,6 +292,7 @@ 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(xsrsqrtesp, 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 b9cd35b..ae80289 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -7347,6 +7347,7 @@ 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(xsrsqrtesp, 0x14, 0x00, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xvadddp, 0x00, 0x0C, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvsubdp, 0x00, 0x0D, 0, PPC2_VSX) @@ -10161,6 +10162,7 @@ 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_XX2FORM(xsrsqrtesp, 0x14, 0x00, PPC2_VSX207), GEN_XX3FORM(xvadddp, 0x00, 0x0C, PPC2_VSX), GEN_XX3FORM(xvsubdp, 0x00, 0x0D, PPC2_VSX),