From patchwork Tue Jun 25 13:06:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastian Koppelmann X-Patchwork-Id: 1122058 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mail.uni-paderborn.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mail.uni-paderborn.de header.i=@mail.uni-paderborn.de header.b="simB5cLD"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Y6Sn3y24z9s4V for ; Tue, 25 Jun 2019 23:29:13 +1000 (AEST) Received: from localhost ([::1]:60230 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hflVX-0007rv-KF for incoming@patchwork.ozlabs.org; Tue, 25 Jun 2019 09:29:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50897) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hflAL-0001CT-0p for qemu-devel@nongnu.org; Tue, 25 Jun 2019 09:07:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hflAH-0007hJ-7o for qemu-devel@nongnu.org; Tue, 25 Jun 2019 09:07:15 -0400 Received: from telepax.uni-paderborn.de ([131.234.189.14]:50734) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hflAD-0007cr-HD for qemu-devel@nongnu.org; Tue, 25 Jun 2019 09:07:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6Km5mnnJTNxAqdc3WDVjMnfm+q6og2AMP+Yvh7bmX+g=; b=simB5cLDZCu+K9rtPKnaZ087IZ ZqqLsmkFoXiCan4iYHvDHzYQXo5ClBPrnhPezTjhIiul/3D+g23S8p+3MyuqYwzvpfaDiCsliaEEr YkOzbSYAccirsFrsmDWMpCwkcR2paUFl1F5XL+7Ts9d70xIKD96kpvEGgPeQ+Pi1MRt8=; From: Bastian Koppelmann To: qemu-devel@nongnu.org Date: Tue, 25 Jun 2019 15:06:54 +0200 Message-Id: <20190625130658.24895-2-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190625130658.24895-1-kbastian@mail.uni-paderborn.de> References: <20190625130658.24895-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 X-IMT-Spam-Score: 0.0 () X-PMX-Version: 6.4.6.2792898, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2019.6.25.125716, AntiVirus-Engine: 5.63.0, AntiVirus-Data: 2019.6.18.5630002 X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 131.234.189.14 Subject: [Qemu-devel] [PULL 1/5] tricore: add FTOIZ instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Lars Biermanski , Georg Hofstetter , David Brenken , Robert Rasche , Andreas Konopik Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: David Brenken Signed-off-by: Andreas Konopik Signed-off-by: David Brenken Signed-off-by: Georg Hofstetter Signed-off-by: Robert Rasche Signed-off-by: Lars Biermanski Reviewed-by: Bastian Koppelmann Message-Id: <20190624070339.4408-2-david.brenken@efs-auto.org> Signed-off-by: Bastian Koppelmann --- target/tricore/fpu_helper.c | 25 +++++++++++++++++++++++++ target/tricore/helper.h | 1 + target/tricore/translate.c | 3 +++ 3 files changed, 29 insertions(+) diff --git a/target/tricore/fpu_helper.c b/target/tricore/fpu_helper.c index d8a6c0d25b..f079d9e939 100644 --- a/target/tricore/fpu_helper.c +++ b/target/tricore/fpu_helper.c @@ -303,6 +303,31 @@ uint32_t helper_itof(CPUTriCoreState *env, uint32_t arg) return (uint32_t)f_result; } +uint32_t helper_ftoiz(CPUTriCoreState *env, uint32_t arg) +{ + float32 f_arg = make_float32(arg); + uint32_t result; + int32_t flags; + + result = float32_to_int32_round_to_zero(f_arg, &env->fp_status); + + flags = f_get_excp_flags(env); + if (flags & float_flag_invalid) { + flags &= ~float_flag_inexact; + if (float32_is_any_nan(f_arg)) { + result = 0; + } + } + + if (flags) { + f_update_psw_flags(env, flags); + } else { + env->FPU_FS = 0; + } + + return result; +} + uint32_t helper_ftouz(CPUTriCoreState *env, uint32_t arg) { float32 f_arg = make_float32(arg); diff --git a/target/tricore/helper.h b/target/tricore/helper.h index f60e81096b..16b62edf7f 100644 --- a/target/tricore/helper.h +++ b/target/tricore/helper.h @@ -111,6 +111,7 @@ DEF_HELPER_4(fmsub, i32, env, i32, i32, i32) DEF_HELPER_3(fcmp, i32, env, i32, i32) DEF_HELPER_2(ftoi, i32, env, i32) DEF_HELPER_2(itof, i32, env, i32) +DEF_HELPER_2(ftoiz, i32, env, i32) DEF_HELPER_2(ftouz, i32, env, i32) DEF_HELPER_2(updfl, void, env, i32) /* dvinit */ diff --git a/target/tricore/translate.c b/target/tricore/translate.c index 06c4485e55..5e1c4f54b9 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -6747,6 +6747,9 @@ static void decode_rr_divide(CPUTriCoreState *env, DisasContext *ctx) case OPC2_32_RR_UPDFL: gen_helper_updfl(cpu_env, cpu_gpr_d[r1]); break; + case OPC2_32_RR_FTOIZ: + gen_helper_ftoiz(cpu_gpr_d[r3], cpu_env, cpu_gpr_d[r1]); + break; default: generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); }