From patchwork Tue Jan 14 16:43:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 23190 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 123142066C for ; Tue, 14 Jan 2014 16:44:33 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id kq14sf6318939pab.9 for ; Tue, 14 Jan 2014 08:44:33 -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=h4jw9gthduShscITBVBoCo+8Yn4CzgdN6qTr73mp3Kk=; b=GNJQGJcwF8ZiBkEDr7Lkblv1xE40ppYo6AN40mrzZ6lDwzOZOGK0nwMmsS8PWKTL/q QZsfNc+VgPTf+8g9jy0kNXBMqE8Rbf7p1VtdmVBbordrGc91QYTqEylnu0adriqhccEm VmSWtReHgDVW9YW+Z1ddCZpXJPiRkPA3KIjnS0bWzUy1DprNK7ZH8n4agq1KrjxYSmKK 2ECUrI5bp4OlmR7OQOZA2aLApu7eB9HxWY99Dg5rZ7NvlPWmGJK9knrWp1putku2ASAP tnEeux3CeL5F5BmqsD2o144qoFIOzVHhltraVlJJOVH7pLPVP3HAf7E3X82sEdfIstCz orXg== X-Gm-Message-State: ALoCoQmjYLl5oXjBB5GMtntFy18Z0B7UtNBsnWUoepH+hImn4b4vx9LPh1wJ5PXeJBy/tPG0XkE3 X-Received: by 10.66.8.234 with SMTP id u10mr938812paa.40.1389717873306; Tue, 14 Jan 2014 08:44:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.131 with SMTP id 3ls190341qee.70.gmail; Tue, 14 Jan 2014 08:44:33 -0800 (PST) X-Received: by 10.52.157.38 with SMTP id wj6mr496184vdb.63.1389717873174; Tue, 14 Jan 2014 08:44:33 -0800 (PST) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id fi9si436028vcb.114.2014.01.14.08.44.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 08:44:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id ia6so366037vcb.38 for ; Tue, 14 Jan 2014 08:44:33 -0800 (PST) X-Received: by 10.58.73.193 with SMTP id n1mr186887vev.75.1389717873092; Tue, 14 Jan 2014 08:44:33 -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 ey3csp214643ved; Tue, 14 Jan 2014 08:44:32 -0800 (PST) X-Received: by 10.224.132.133 with SMTP id b5mr4410137qat.61.1389717872571; Tue, 14 Jan 2014 08:44:32 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o8si1377674qey.5.2014.01.14.08.44.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 14 Jan 2014 08:44:32 -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]:49206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W376O-00031W-5y for patch@linaro.org; Tue, 14 Jan 2014 11:44:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W375M-00027H-1z for qemu-devel@nongnu.org; Tue, 14 Jan 2014 11:43:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W375F-0001Hm-Rw for qemu-devel@nongnu.org; Tue, 14 Jan 2014 11:43:28 -0500 Received: from mail-we0-f180.google.com ([74.125.82.180]:52200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W375F-0001HU-M3 for qemu-devel@nongnu.org; Tue, 14 Jan 2014 11:43:21 -0500 Received: by mail-we0-f180.google.com with SMTP id q59so651971wes.11 for ; Tue, 14 Jan 2014 08:43:21 -0800 (PST) X-Received: by 10.194.76.231 with SMTP id n7mr28877450wjw.16.1389717800933; Tue, 14 Jan 2014 08:43:20 -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.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jan 2014 08:43:20 -0800 (PST) From: Will Newton To: qemu-devel@nongnu.org Date: Tue, 14 Jan 2014 16:43:02 +0000 Message-Id: <1389717790-30860-2-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.180 Cc: Peter Maydell Subject: [Qemu-devel] [PATCH 1/9] target-arm: Move arm_rmode_to_sf to a shared location. 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.220.179 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 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)