From patchwork Mon Jul 23 20:17:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 142646 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp6510889ljj; Mon, 23 Jul 2018 14:24:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcEgj3+ofJK1vdOlQoyTLbjl+eW5SrokVUUwNrow9/+tggx5ilyKWx+1sGcsPU0vc+aWutq X-Received: by 2002:ae9:dec4:: with SMTP id s187-v6mr12581968qkf.322.1532381052277; Mon, 23 Jul 2018 14:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532381052; cv=none; d=google.com; s=arc-20160816; b=ghsWVzdL+4bddHIy2+ky2PL6hB9n+OTJjy5UQ2HBzQriYLmX73SPljPJoCWoJywwGj tTpivx+aHYHsmSir13sGyUsiHHZN6MQajvsVLCSuawnmGLdiO0M7uDd9XnkCU/jW+WaW VgxEdqgtueuPlxX+vQ5B4Sm18vTfqsIgAi0d24CfLhQn8PrMjXx4mC/iavx18MlQHlmO EjvH80f2rTviO7afOiMM/Vd86KcZPnhE8MlO9dFhOXcOca0rTDuudcwlvuoqAv9higyB cHWX986XmWPG94+7LSnvd+kzjfgTvDQivmwDCDblPz/rntfpSyv1BUq/a1QLa0In36d6 Antg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=oQgVzzLW/AKZnSBdmcngVIFMbjpCsGBPKm5s95XcOIA=; b=rM3B5JTND5vM9NZ3FwuxW1xPnffZEFittdsVPTHBb9rAUKcm+azYJJ5oXjS9gFb1vi FlzJDZOsw/STNaYi8qM7+mqZTIyj8XHT+vWszwRdnFOYt90oeH9dh7McamR0gdgXSsNr YGUvGRrC8Xb6dApYI+pFJRw3cD8BWcQnLAMdBfygWCBE7wtPaTHggrlE10nfchVyLuN+ uMjk7TrRh29nk+EGYrPnps+zJLtzhI9jT+Zu18oWMLbCuoW1mXcWxKftyqrFVokFCiAC lsLHYyJNLYH3VBY+H22sGBjKP3tpyc+FEQj5aSBsk2lY6J2L5UO4VkMWdCfIYv8MUXHx TqWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Ip7x2sTS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r6-v6si6983309qvb.185.2018.07.23.14.24.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 23 Jul 2018 14:24:12 -0700 (PDT) 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; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Ip7x2sTS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from localhost ([::1]:36749 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhiJP-0001e7-Ma for patch@linaro.org; Mon, 23 Jul 2018 17:24:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhKU-0003iR-23 for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhKS-0005Gj-OT for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:14 -0400 Received: from mail-oi0-x22c.google.com ([2607:f8b0:4003:c06::22c]:39355) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhKS-0005GR-HJ; Mon, 23 Jul 2018 16:21:12 -0400 Received: by mail-oi0-x22c.google.com with SMTP id d189-v6so3486480oib.6; Mon, 23 Jul 2018 13:21:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=oQgVzzLW/AKZnSBdmcngVIFMbjpCsGBPKm5s95XcOIA=; b=Ip7x2sTSV6hxgjoBfiyCMEeRDW6iIu2tUCViLCFMCgTFmF4TMx7aP6lQlaTvnTd7IY j607RreVB+lhLr4qTGMnwFYocpGfQzu8Rcvm68wRtHxmHhUKduQiL2H7E/7+wNZWy/OI xr8zOlYImn3K9ZNZ3+9uhoJ0jvzkqGgz7UNgLogr0ik+/QvYaPlm6440cr9QEOOr3RyZ a1cX2HZsmnUc5kQIoH14OlVUbrJmOHuCm3EelFxitE2sfbYE4I2IzdrB2u27cQfiPAih WgVxZl6dlmi8pGtvR5SEFbWqF37VE46aL9+xyjsTHk9Lz2wMRvPK1GVpT1voYuhZC362 NzYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=oQgVzzLW/AKZnSBdmcngVIFMbjpCsGBPKm5s95XcOIA=; b=shBd+iTv04eC+A4pbI68yvjedo+wO7OsNzE31m8wgQD1514yjDbDCpaPt9M2Cp2NS6 4rrEAjSmoo4ETlshBv1ftGQ/YxM9/4XxviOB5QjTXtq+MRa7immnuEaI/yVofFv38s7i hjyS8xp72eKCy9vq6MyjrFrDDbAI86W0LfJ/WZk0rfqncW930HPxILzzglqap4lgTY5n lQD9efwnjgU9oukWpAZLFRnfVbLHFtM9drSg9kujTfuDeuuqS/iNGOUyQKxnDrx5OGtl 4icWGN4VhcURZfbe0ET8w0LG4vgqW/WIETXXF7yfqt6nDF9ZkoSU3kyXsGjjHWPrz0KH HHXg== X-Gm-Message-State: AOUpUlEhGnRYJfJbFH/+eQbQtg+jtXfDDD1HXo9HayNLvQQ2aC5X52g4 byVB79K3vvFRnppHQ6sET7MvDH8p5K/UZw== X-Received: by 2002:aca:dbc2:: with SMTP id s185-v6mr259183oig.251.1532377271394; Mon, 23 Jul 2018 13:21:11 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id x126-v6sm5000488oig.15.2018.07.23.13.21.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:21:10 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:17:21 -0500 Message-Id: <20180723201748.25573-73-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::22c Subject: [Qemu-devel] [PATCH 72/99] target/arm: Implement vector shifted FCVT for fp16 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Richard Henderson , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson While we have some of the scalar paths for FCVT for fp16, we failed to decode the fp16 version of these instructions. Cc: qemu-stable@nongnu.org Signed-off-by: Richard Henderson Message-id: 20180502221552.3873-3-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell (cherry picked from commit d0ba8e74acd299b092786ffc30b306638d395a9e) Signed-off-by: Michael Roth --- target/arm/translate-a64.c | 63 +++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 18 deletions(-) -- 2.17.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index f0fa6045e4..61735dc185 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -7202,19 +7202,28 @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, bool is_q, bool is_u, int immh, int immb, int rn, int rd) { - bool is_double = extract32(immh, 3, 1); int immhb = immh << 3 | immb; - int fracbits = (is_double ? 128 : 64) - immhb; - int pass; + int pass, size, fracbits; TCGv_ptr tcg_fpstatus; TCGv_i32 tcg_rmode, tcg_shift; - if (!extract32(immh, 2, 2)) { - unallocated_encoding(s); - return; - } - - if (!is_scalar && !is_q && is_double) { + if (immh & 0x8) { + size = MO_64; + if (!is_scalar && !is_q) { + unallocated_encoding(s); + return; + } + } else if (immh & 0x4) { + size = MO_32; + } else if (immh & 0x2) { + size = MO_16; + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + unallocated_encoding(s); + return; + } + } else { + /* Should have split out AdvSIMD modified immediate earlier. */ + assert(immh == 1); unallocated_encoding(s); return; } @@ -7226,11 +7235,12 @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, assert(!(is_scalar && is_q)); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(FPROUNDING_ZERO)); - tcg_fpstatus = get_fpstatus_ptr(false); + tcg_fpstatus = get_fpstatus_ptr(size == MO_16); gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); + fracbits = (16 << size) - immhb; tcg_shift = tcg_const_i32(fracbits); - if (is_double) { + if (size == MO_64) { int maxpass = is_scalar ? 1 : 2; for (pass = 0; pass < maxpass; pass++) { @@ -7247,20 +7257,37 @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, } clear_vec_high(s, is_q, rd); } else { - int maxpass = is_scalar ? 1 : is_q ? 4 : 2; - for (pass = 0; pass < maxpass; pass++) { - TCGv_i32 tcg_op = tcg_temp_new_i32(); + void (*fn)(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); + int maxpass = is_scalar ? 1 : ((8 << is_q) >> size); - read_vec_element_i32(s, tcg_op, rn, pass, MO_32); + switch (size) { + case MO_16: + if (is_u) { + fn = gen_helper_vfp_toulh; + } else { + fn = gen_helper_vfp_toslh; + } + break; + case MO_32: if (is_u) { - gen_helper_vfp_touls(tcg_op, tcg_op, tcg_shift, tcg_fpstatus); + fn = gen_helper_vfp_touls; } else { - gen_helper_vfp_tosls(tcg_op, tcg_op, tcg_shift, tcg_fpstatus); + fn = gen_helper_vfp_tosls; } + break; + default: + g_assert_not_reached(); + } + + for (pass = 0; pass < maxpass; pass++) { + TCGv_i32 tcg_op = tcg_temp_new_i32(); + + read_vec_element_i32(s, tcg_op, rn, pass, size); + fn(tcg_op, tcg_op, tcg_shift, tcg_fpstatus); if (is_scalar) { write_fp_sreg(s, rd, tcg_op); } else { - write_vec_element_i32(s, tcg_op, rd, pass, MO_32); + write_vec_element_i32(s, tcg_op, rd, pass, size); } tcg_temp_free_i32(tcg_op); }