From patchwork Tue Jan 28 11:22:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 23783 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DCC2C202FA for ; Tue, 28 Jan 2014 11:22:54 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id j5sf458869qaq.6 for ; Tue, 28 Jan 2014 03:22:54 -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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=uJyfBCEZVJGRHa5fxo/DLr/cOT14DbMbyLan5FZU+Ts=; b=mlqWdO5VArrxertoIa1/USMev8HTVuH5DF6Fnj5mcGv9x4++t1IRHWUurJfBKeMWEg Gfj+WRqHcjFy9qWbnjhrTOVlzaCpncuCKq/f5WqFYX02beSIxfcFfR9lAia1rWtqi1Eb vO2bifPC+Sm1kSJG6flL7NtWe71bkaj2X5x4I3ChxEHwr3R/xy791HF8rJFnQEHlvIEE 5rEdQK7a1O8P7McA2LCVdtD0zpfwVhA4dhTF1BXsZgNJHxPVxxwlXlgnMuUOeeEZQgGo YW3nd5XU8VTN9zXB45F5Ax74jkZYtupaUo5/XNHtZM6XFGdKpwBYQAfNv0hN87xEfy83 BcSg== X-Gm-Message-State: ALoCoQkJZ4N7l5uWWHcdkF/E2B/zJ+jZtjG/PE8ifUvMPg9K6hBwkNModlO3Sh5bVInxUbDxgfd4 X-Received: by 10.58.189.73 with SMTP id gg9mr4585490vec.34.1390908174053; Tue, 28 Jan 2014 03:22:54 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.71 with SMTP id k65ls95602qgd.89.gmail; Tue, 28 Jan 2014 03:22:53 -0800 (PST) X-Received: by 10.58.229.164 with SMTP id sr4mr619807vec.18.1390908173954; Tue, 28 Jan 2014 03:22:53 -0800 (PST) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by mx.google.com with ESMTPS id x5si6226195veb.149.2014.01.28.03.22.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Jan 2014 03:22:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.44 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.44; Received: by mail-vb0-f44.google.com with SMTP id f12so148233vbg.17 for ; Tue, 28 Jan 2014 03:22:53 -0800 (PST) X-Received: by 10.220.186.202 with SMTP id ct10mr619795vcb.14.1390908173879; Tue, 28 Jan 2014 03:22:53 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp22921vcz; Tue, 28 Jan 2014 03:22:53 -0800 (PST) X-Received: by 10.152.3.10 with SMTP id 10mr580596lay.35.1390908172768; Tue, 28 Jan 2014 03:22:52 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) by mx.google.com with ESMTPS id 1si6622922laj.156.2014.01.28.03.22.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Jan 2014 03:22:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.217.174 is neither permitted nor denied by best guess record for domain of will.newton@linaro.org) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id l4so197611lbv.5 for ; Tue, 28 Jan 2014 03:22:52 -0800 (PST) X-Received: by 10.152.22.201 with SMTP id g9mr581680laf.27.1390908172195; Tue, 28 Jan 2014 03:22:52 -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 a8sm22366424lae.5.2014.01.28.03.22.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jan 2014 03:22:51 -0800 (PST) From: Will Newton To: qemu-devel@nongnu.org Cc: Peter Maydell , patches@linaro.org Subject: [PATCH v2 07/11] target-arm: Add set_neon_rmode helper Date: Tue, 28 Jan 2014 11:22:31 +0000 Message-Id: <1390908155-23475-7-git-send-email-will.newton@linaro.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1390908155-23475-1-git-send-email-will.newton@linaro.org> References: <1390908155-23475-1-git-send-email-will.newton@linaro.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.44 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)