From patchwork Tue Jan 14 16:43:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 23194 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A97F62066C for ; Tue, 14 Jan 2014 16:46:20 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id x13sf2017926ief.2 for ; Tue, 14 Jan 2014 08:46:20 -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=7QVCl61fCcREMtNBsi5eoKz+1SocqrzQsWwAdOuC00g=; b=QqwZnIzzyu+q11lKCI1FTCPsnu6XiLS/fBETx64Zw572gvDSUnvphgrzlHJWxcTMl3 DZ0RVqzucdJ1zts9d7wtdkcpbqrFP4WDcm9dBnhSqDgHPbQZFHIyEx/3+N/dG4PMGX7V Nbz6eOpzEnkKVrYqFizl1+vLka/uaHM5iAtjDu/Lf2u91tx4pQ6q4iUumk6tqtdvMBSw oydWeYkV6d8mnn3VfoU86jpqN9T4UrXqc00INE0CsnjswJwTNWeTjk7wQ9WqCEbEbRM+ eSu6lExSWPedDo6piA0mnSROSqnG9xTmAbU3xPZ+Je4V05ht2a5YloZbh/bJmqMPkHRm CpeQ== X-Gm-Message-State: ALoCoQmPm6ICPD13PhMN05ef9W3qY+t+0DmkuQvGuYkW09L/htxGlqA8dWJkyvny/qpkMkR1doiw X-Received: by 10.43.161.202 with SMTP id mh10mr9889422icc.23.1389717979838; Tue, 14 Jan 2014 08:46:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.39.102 with SMTP id o6ls188727qek.28.gmail; Tue, 14 Jan 2014 08:46:19 -0800 (PST) X-Received: by 10.52.26.77 with SMTP id j13mr1352442vdg.33.1389717979675; Tue, 14 Jan 2014 08:46:19 -0800 (PST) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id gq3si455516vdc.2.2014.01.14.08.46.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 08:46:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jw12so6083127veb.3 for ; Tue, 14 Jan 2014 08:46:19 -0800 (PST) X-Received: by 10.220.95.139 with SMTP id d11mr1208931vcn.21.1389717979581; Tue, 14 Jan 2014 08:46:19 -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 ey3csp214791ved; Tue, 14 Jan 2014 08:46:19 -0800 (PST) X-Received: by 10.49.30.197 with SMTP id u5mr4580827qeh.33.1389717979133; Tue, 14 Jan 2014 08:46:19 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b11si1338345qen.103.2014.01.14.08.46.19 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 14 Jan 2014 08:46:19 -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]:49228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3786-0005U0-GB for patch@linaro.org; Tue, 14 Jan 2014 11:46:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W375S-00027S-IK for qemu-devel@nongnu.org; Tue, 14 Jan 2014 11:43:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W375H-0001I6-2m for qemu-devel@nongnu.org; Tue, 14 Jan 2014 11:43:34 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:59847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W375G-0001Hy-T7 for qemu-devel@nongnu.org; Tue, 14 Jan 2014 11:43:23 -0500 Received: by mail-wi0-f169.google.com with SMTP id e4so2768945wiv.0 for ; Tue, 14 Jan 2014 08:43:22 -0800 (PST) X-Received: by 10.194.104.66 with SMTP id gc2mr3244624wjb.75.1389717802128; Tue, 14 Jan 2014 08:43:22 -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.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jan 2014 08:43:21 -0800 (PST) From: Will Newton To: qemu-devel@nongnu.org Date: Tue, 14 Jan 2014 16:43:03 +0000 Message-Id: <1389717790-30860-3-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: 209.85.212.169 Cc: Peter Maydell Subject: [Qemu-devel] [PATCH 2/9] target-arm: Add AArch32 FP VRINTA, VRINTN, VRINTP and VRINTM 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.128.172 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 Add support for AArch32 ARMv8 FP VRINTA, VRINTN, VRINTP and VRINTM instructions. Signed-off-by: Will Newton --- target-arm/translate.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/target-arm/translate.c b/target-arm/translate.c index 8d240e1..f688f6d 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -2759,6 +2759,51 @@ static int handle_vminmaxnm(uint32_t insn, uint32_t rd, uint32_t rn, return 0; } +static int handle_vrint(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, + int rounding) +{ + TCGv_ptr fpst = get_fpstatus_ptr(0); + TCGv_i32 tcg_rmode; + + tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rounding)); + gen_helper_set_rmode(tcg_rmode, tcg_rmode, cpu_env); + + if (dp) { + TCGv_i64 tcg_op; + TCGv_i64 tcg_res; + tcg_op = tcg_temp_new_i64(); + tcg_res = tcg_temp_new_i64(); + tcg_gen_ld_f64(tcg_op, cpu_env, vfp_reg_offset(dp, rm)); + gen_helper_rintd(tcg_res, tcg_op, fpst); + tcg_gen_st_f64(tcg_res, cpu_env, vfp_reg_offset(dp, rd)); + tcg_temp_free_i64(tcg_op); + tcg_temp_free_i64(tcg_res); + } else { + TCGv_i32 tcg_op; + TCGv_i32 tcg_res; + tcg_op = tcg_temp_new_i32(); + tcg_res = tcg_temp_new_i32(); + tcg_gen_ld_f32(tcg_op, cpu_env, vfp_reg_offset(dp, rm)); + gen_helper_rints(tcg_res, tcg_op, fpst); + tcg_gen_st_f32(tcg_res, cpu_env, vfp_reg_offset(dp, rd)); + tcg_temp_free_i32(tcg_op); + tcg_temp_free_i32(tcg_res); + } + + gen_helper_set_rmode(tcg_rmode, tcg_rmode, cpu_env); + tcg_temp_free_i32(tcg_rmode); + + tcg_temp_free_ptr(fpst); + return 0; +} + +static const uint8_t fp_decode_rm[] = { + FPROUNDING_TIEAWAY, + FPROUNDING_TIEEVEN, + FPROUNDING_POSINF, + FPROUNDING_NEGINF, +}; + static int disas_vfp_v8_insn(CPUARMState *env, DisasContext *s, uint32_t insn) { uint32_t rd, rn, rm, dp = extract32(insn, 8, 1); @@ -2781,6 +2826,10 @@ static int disas_vfp_v8_insn(CPUARMState *env, DisasContext *s, uint32_t insn) return handle_vsel(insn, rd, rn, rm, dp); } else if ((insn & 0x0fb00e10) == 0x0e800a00) { return handle_vminmaxnm(insn, rd, rn, rm, dp); + } else if ((insn & 0x0fbc0ed0) == 0x0eb80a40) { + /* VRINTA, VRINTN, VRINTP, VRINTM */ + int rounding = fp_decode_rm[extract32(insn, 16, 2)]; + return handle_vrint(insn, rd, rm, dp, rounding); } return 1; }