From patchwork Tue Jan 28 11:22:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 23777 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f70.google.com (mail-pb0-f70.google.com [209.85.160.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 61FB9202FA for ; Tue, 28 Jan 2014 11:22:44 +0000 (UTC) Received: by mail-pb0-f70.google.com with SMTP id rq2sf482525pbb.5 for ; Tue, 28 Jan 2014 03:22:43 -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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=ab3XIDsfe16w826J349i/ZGrBNoVKiGQZHGYb8pwF/U=; b=Q1nrtmaPsqsB2nxo/51HR7hvKzmtp9whfu0kUYjma65X3XaZMDNMt/vi0GIx5YcGsd FspwPC6W2SfxYbqo1XAPVKBN2XsQrN6NcFfQ4QlL9kWJbzrTOaGVn7xg+rHa8E9/fUG9 Pwtw84MECZHyUTR3Y1gnd/G5I1E/KX+6mtaDau4w7TqAIHBzqM2bfZ7wQej3vZWZLYwI NPs0gly7b3JgD5rKAM7KxwtIYrtsnkk7kvp1sJOB8BXQjXea9zE8fFwmFcs4Cc3W4CVL Vf6lQn3m/ejJhOxKzwT4zUcNtpSdiz4oiOlHtcA9hUg/m2ain/9xpYT4M0+5gM3+PdnM NUnQ== X-Gm-Message-State: ALoCoQlFg1cXg11jvEF9aIyPKz9mm7PWrajoO7MD4LA1R6PZQvzDgJkSJeJibazAPLuex8xHl2+i X-Received: by 10.66.66.163 with SMTP id g3mr313767pat.3.1390908163662; Tue, 28 Jan 2014 03:22:43 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.240 with SMTP id b103ls2075171qge.57.gmail; Tue, 28 Jan 2014 03:22:43 -0800 (PST) X-Received: by 10.220.124.65 with SMTP id t1mr73975vcr.26.1390908163515; Tue, 28 Jan 2014 03:22:43 -0800 (PST) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id cy15si6235305veb.106.2014.01.28.03.22.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Jan 2014 03:22:43 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.41 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.41; Received: by mail-vb0-f41.google.com with SMTP id g10so151777vbg.28 for ; Tue, 28 Jan 2014 03:22:43 -0800 (PST) X-Received: by 10.58.169.7 with SMTP id aa7mr626758vec.24.1390908163427; Tue, 28 Jan 2014 03:22:43 -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 u4csp22902vcz; Tue, 28 Jan 2014 03:22:42 -0800 (PST) X-Received: by 10.152.36.8 with SMTP id m8mr631721laj.24.1390908162246; Tue, 28 Jan 2014 03:22:42 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by mx.google.com with ESMTPS id z4si6622334lal.179.2014.01.28.03.22.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Jan 2014 03:22:42 -0800 (PST) Received-SPF: neutral (google.com: 209.85.217.177 is neither permitted nor denied by best guess record for domain of will.newton@linaro.org) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id z5so196275lbh.22 for ; Tue, 28 Jan 2014 03:22:41 -0800 (PST) X-Received: by 10.112.43.70 with SMTP id u6mr574002lbl.30.1390908161603; Tue, 28 Jan 2014 03:22:41 -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.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jan 2014 03:22:40 -0800 (PST) From: Will Newton To: qemu-devel@nongnu.org Cc: Peter Maydell , patches@linaro.org Subject: [PATCH v2 01/11] target-arm: Move arm_rmode_to_sf to a shared location. Date: Tue, 28 Jan 2014 11:22:25 +0000 Message-Id: <1390908155-23475-1-git-send-email-will.newton@linaro.org> X-Mailer: git-send-email 1.8.1.4 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.41 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 function will be needed for AArch32 ARMv8 support, so move it to helper.c where it can be used by both targets. Also moves the code out of line, but as it is quite a large function I don't believe this should be a significant performance impact. Signed-off-by: Will Newton Reviewed-by: Peter Maydell --- target-arm/cpu.h | 2 ++ target-arm/helper.c | 28 ++++++++++++++++++++++++++++ target-arm/translate-a64.c | 28 ---------------------------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 198b6b8..383c582 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -496,6 +496,8 @@ enum arm_fprounding { FPROUNDING_ODD }; +int arm_rmode_to_sf(int rmode); + enum arm_cpu_mode { ARM_CPU_MODE_USR = 0x10, ARM_CPU_MODE_FIQ = 0x11, diff --git a/target-arm/helper.c b/target-arm/helper.c index c708f15..b1541b9 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -4418,3 +4418,31 @@ float64 HELPER(rintd)(float64 x, void *fp_status) return ret; } + +/* Convert ARM rounding mode to softfloat */ +int arm_rmode_to_sf(int rmode) +{ + switch (rmode) { + case FPROUNDING_TIEAWAY: + rmode = float_round_ties_away; + break; + case FPROUNDING_ODD: + /* FIXME: add support for TIEAWAY and ODD */ + qemu_log_mask(LOG_UNIMP, "arm: unimplemented rounding mode: %d\n", + rmode); + case FPROUNDING_TIEEVEN: + default: + rmode = float_round_nearest_even; + break; + case FPROUNDING_POSINF: + rmode = float_round_up; + break; + case FPROUNDING_NEGINF: + rmode = float_round_down; + break; + case FPROUNDING_ZERO: + rmode = float_round_to_zero; + break; + } + return rmode; +} diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index cf80c46..8effbe2 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -3186,34 +3186,6 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn) } } -/* Convert ARM rounding mode to softfloat */ -static inline int arm_rmode_to_sf(int rmode) -{ - switch (rmode) { - case FPROUNDING_TIEAWAY: - rmode = float_round_ties_away; - break; - case FPROUNDING_ODD: - /* FIXME: add support for TIEAWAY and ODD */ - qemu_log_mask(LOG_UNIMP, "arm: unimplemented rounding mode: %d\n", - rmode); - case FPROUNDING_TIEEVEN: - default: - rmode = float_round_nearest_even; - break; - case FPROUNDING_POSINF: - rmode = float_round_up; - break; - case FPROUNDING_NEGINF: - rmode = float_round_down; - break; - case FPROUNDING_ZERO: - rmode = float_round_to_zero; - break; - } - return rmode; -} - static void handle_fp_compare(DisasContext *s, bool is_double, unsigned int rn, unsigned int rm, bool cmp_with_zero, bool signal_all_nans)