From patchwork Tue Jan 14 16:43:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 23197 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F14852066C for ; Tue, 14 Jan 2014 16:47:58 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id i7sf3243888oag.1 for ; Tue, 14 Jan 2014 08:47:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=tNJFBDL+ACBRHt3N9aFJjto7AwZloH9/PWBNzZ15js8=; b=f6lTt49almr9eNm+TjhyrGzPCCgYhOHunzDvDJJidZFnc4tTqaVcUCWQK9JU/UHw3t 7AQOWQ4zvUpzmKupvrI5McimT1vmOe7NYJvOUynCjQQglOzQuO2M6c6E4kObR5pa5NBq uOkmk2tCSBQOH7mG0Nl5/w2lYyGeaPXKnaOUWCzhqVweHxIl4gmoL79HXVv1KEYnlgoH 8+ZsXQof//mzWKGLCj226TAAJXK3Zi/Cs66b7pKkjzvjw48H9eZ/nIkEFZWiUVHSG81X yj1obfVDqjFhCgxVZoCFgWKml08cXOQLuzuJ9MHgkCAyWCiBrfx6S0D0v5Jgq3EAE/rF 4xLg== X-Gm-Message-State: ALoCoQnwNdMQq/dpLEhi34qTDBY1bM86WzISeqz06jv4MmOeBp5Txd/Pp6T/aVMr7mw2ofRnK9De X-Received: by 10.42.64.74 with SMTP id f10mr10645949ici.12.1389718078119; Tue, 14 Jan 2014 08:47:58 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.132.231 with SMTP id ox7ls217433qeb.49.gmail; Tue, 14 Jan 2014 08:47:57 -0800 (PST) X-Received: by 10.53.4.38 with SMTP id cb6mr441176vdd.89.1389718077951; Tue, 14 Jan 2014 08:47:57 -0800 (PST) Received: from mail-vb0-f43.google.com (mail-vb0-f43.google.com [209.85.212.43]) by mx.google.com with ESMTPS id vi9si443143vec.94.2014.01.14.08.47.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 08:47:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.43 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.43; Received: by mail-vb0-f43.google.com with SMTP id p5so1110575vbn.16 for ; Tue, 14 Jan 2014 08:47:57 -0800 (PST) X-Received: by 10.58.73.193 with SMTP id n1mr192249vev.75.1389718077880; Tue, 14 Jan 2014 08:47:57 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp214932ved; Tue, 14 Jan 2014 08:47:57 -0800 (PST) X-Received: by 10.224.97.7 with SMTP id j7mr4445415qan.81.1389718077375; Tue, 14 Jan 2014 08:47:57 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id q10si1368827qaj.46.2014.01.14.08.47.56 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 14 Jan 2014 08:47:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:49244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W379g-0007y5-GQ for patch@linaro.org; Tue, 14 Jan 2014 11:47:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W375V-0002AB-P4 for qemu-devel@nongnu.org; Tue, 14 Jan 2014 11:43:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W375N-0001KN-UZ for qemu-devel@nongnu.org; Tue, 14 Jan 2014 11:43:37 -0500 Received: from mail-wg0-f52.google.com ([74.125.82.52]:47791) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W375N-0001KA-OZ for qemu-devel@nongnu.org; Tue, 14 Jan 2014 11:43:29 -0500 Received: by mail-wg0-f52.google.com with SMTP id b13so640291wgh.19 for ; Tue, 14 Jan 2014 08:43:29 -0800 (PST) X-Received: by 10.180.90.79 with SMTP id bu15mr3797077wib.33.1389717809036; Tue, 14 Jan 2014 08:43:29 -0800 (PST) Received: from localhost.localdomain (cpc6-seac21-2-0-cust453.7-2.cable.virginm.net. [82.1.113.198]) by mx.google.com with ESMTPSA id jw4sm971156wjc.20.2014.01.14.08.43.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jan 2014 08:43:28 -0800 (PST) From: Will Newton To: qemu-devel@nongnu.org Date: Tue, 14 Jan 2014 16:43:08 +0000 Message-Id: <1389717790-30860-8-git-send-email-will.newton@linaro.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1389717790-30860-1-git-send-email-will.newton@linaro.org> References: <1389717790-30860-1-git-send-email-will.newton@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.52 Cc: Peter Maydell Subject: [Qemu-devel] [PATCH 7/9] target-arm: Add set_neon_rmode helper 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.43 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This helper sets the rounding mode in the standard_fp_status word to allow NEON instructions to modify the rounding mode whilst using the standard FPSCR values for everything else. Signed-off-by: Will Newton Reviewed-by: Peter Maydell --- target-arm/helper.c | 17 +++++++++++++++++ target-arm/helper.h | 1 + 2 files changed, 18 insertions(+) diff --git a/target-arm/helper.c b/target-arm/helper.c index b1541b9..ca5b000 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -4048,6 +4048,23 @@ uint32_t HELPER(set_rmode)(uint32_t rmode, CPUARMState *env) return prev_rmode; } +/* Set the current fp rounding mode in the standard fp status and return + * the old one. This is for NEON instructions that need to change the + * rounding mode but wish to use the standard FPSCR values for everything + * else. Always set the rounding mode back to the correct value after + * modifying it. + * The argument is a softfloat float_round_ value. + */ +uint32_t HELPER(set_neon_rmode)(uint32_t rmode, CPUARMState *env) +{ + float_status *fp_status = &env->vfp.standard_fp_status; + + uint32_t prev_rmode = get_float_rounding_mode(fp_status); + set_float_rounding_mode(rmode, fp_status); + + return prev_rmode; +} + /* Half precision conversions. */ static float32 do_fcvt_f16_to_f32(uint32_t a, CPUARMState *env, float_status *s) { diff --git a/target-arm/helper.h b/target-arm/helper.h index 70872df..71b8411 100644 --- a/target-arm/helper.h +++ b/target-arm/helper.h @@ -149,6 +149,7 @@ DEF_HELPER_3(vfp_ultod, f64, i64, i32, ptr) DEF_HELPER_3(vfp_uqtod, f64, i64, i32, ptr) DEF_HELPER_FLAGS_2(set_rmode, TCG_CALL_NO_RWG, i32, i32, env) +DEF_HELPER_FLAGS_2(set_neon_rmode, TCG_CALL_NO_RWG, i32, i32, env) DEF_HELPER_2(vfp_fcvt_f16_to_f32, f32, i32, env) DEF_HELPER_2(vfp_fcvt_f32_to_f16, i32, f32, env)