From patchwork Wed May 2 22:15:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 134865 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1203179lji; Wed, 2 May 2018 15:19:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrcRQBzSO5jLFHlmDZk1pEVqs+mjOHfyZUDdHylim5KMLMrBPdQhStx9umhvHBIUBpu9eV2 X-Received: by 2002:ac8:18c8:: with SMTP id o8-v6mr9586007qtk.400.1525299580867; Wed, 02 May 2018 15:19:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525299580; cv=none; d=google.com; s=arc-20160816; b=QJyzkm+dns7Yg3TCeYpl1UH1uIWUMt+mJTMVoLkdrYamxDGBw9CnhZYuKBxr+Kguug Y6SDt6JarWT3iweFJtEx/1ZkEvWrj7AlMyx+/V4jAng6OrryI+/tDPHLiPMP6NfahYUO G6laKxPwqBqO4JrFFxKseFjXRbyKXckkbDnzR+HFP8uvyMj3qyXpO/MoNsYoi2A3hQn3 UA58vpY82o14+h8eBW68u5qGABUqe13k4dOcF53z6SzkSzL4t2vmaWx1K2ROr6TjwBNu KsZEEfi5fMrT2LYyzWq9HfxckJqQBuulvz6W7vzpQRHG/9MqgIfqlS4wRVqeA+qj/O2u Ba6Q== 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=/7Is7JNJJAWMsuntBwVi2s5wQjfXgdNNCqqq9DMfcWs=; b=RY10s3s6bMeGdEipkn9AuZEWoeoBALWpXYXFLt1Nk5nvbVWJbJFOJFg/eGnZRTUab5 HfrXdCwEsLVwkQmIr3HwclNkFH+1r+iPTEVkI1irtkfFvtUhXYMJ6MR+A7KYs23gfntZ iw9lnTdb9bAHJgKdbkT6KZm3yhYtQGIIw+ko/upHG+1ULgTO7PDmw1kY89K+yLIffxGf KTNIykaO4xYq7Gk4bJM+Yb/8SIQfC4CXjFhES4lnJ1rbemEPs18ToC/WfJEWX5ZbGief gAvVfgh0ey8kRE7F9hV2sDykk8HV50MpjDmLupFbgpoQpYoV97AnUZ63hZdZNCmMpjLF 19pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Dib89hnS; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v68si4552621qkv.99.2018.05.02.15.19.40 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 02 May 2018 15:19:40 -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=@linaro.org header.s=google header.b=Dib89hnS; 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=linaro.org Received: from localhost ([::1]:52803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fE068-0002v3-Bi for patch@linaro.org; Wed, 02 May 2018 18:19:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fE02a-0000at-BS for qemu-devel@nongnu.org; Wed, 02 May 2018 18:16:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fE02Y-0007qJ-RC for qemu-devel@nongnu.org; Wed, 02 May 2018 18:16:00 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:42513) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fE02Y-0007pV-L3 for qemu-devel@nongnu.org; Wed, 02 May 2018 18:15:58 -0400 Received: by mail-pf0-x242.google.com with SMTP id p14so1579040pfh.9 for ; Wed, 02 May 2018 15:15:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/7Is7JNJJAWMsuntBwVi2s5wQjfXgdNNCqqq9DMfcWs=; b=Dib89hnSudeq1lR9lqlhhXVKPx83azCNoCDwFPf98GK0UNgQ4Z4+VHEHoiLeY998kt +J8QsjiEzPL9mxKpSYN7RU46lzMn0Nkg453QDOZmLE6p2ktdHzgxJfECBZKzkmxjItpw AVu2WPLKgJP9XRyND5hUxRsU9Tr9MBYtnC5/U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/7Is7JNJJAWMsuntBwVi2s5wQjfXgdNNCqqq9DMfcWs=; b=JVvKmcDab4v5hIMzoz92yd+CBY+HehhUUkZAa2cE0x8AhKk7zz4e9FDmWXtNuuZqdv 1kNDF0nhSHHOJ/kKigH/O1XI1oTM7fuX8jqVj8qgnzknrhozyIvN9Kn0i/Jy7qz6ijxd /vtQkaPWxTEiMu8lHTHcGMtC8RdRY+d/wwB6/zX4uNxmjfLunTiIJvB9luJGcdakKXpl HBBYMW3DMa69dj8VopVG5/iYb8X+o7pHrQmh1mJHunVOsiIOEzeY5SpnOyXumEnytfKU ilpxIG8rsKV8mmqg6GdaPhPLnhmzbiDmBQGfZX0ztkdd8uF4143TH4XDxyVYIMm5FF7i 9PmQ== X-Gm-Message-State: ALQs6tD1WSjSqa/qiMAjLK98mHOgm38ivEP1MgsQNkY6O/TmbfQtgrNB o5O2UEqO0PiGJ3b/FBcxnSJHUBZ3BBU= X-Received: by 2002:a65:6117:: with SMTP id z23-v6mr17103294pgu.72.1525299357362; Wed, 02 May 2018 15:15:57 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id 65sm26170145pft.74.2018.05.02.15.15.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 May 2018 15:15:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 2 May 2018 15:15:40 -0700 Message-Id: <20180502221552.3873-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180502221552.3873-1-richard.henderson@linaro.org> References: <20180502221552.3873-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::242 Subject: [Qemu-devel] [PATCH v2 02/14] 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@linaro.org, qemu-arm@nongnu.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- v2: Use parens with (x << y) >> z. --- target/arm/translate-a64.c | 65 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 19 deletions(-) -- 2.14.3 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 68ca445691..a64673575a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -7208,19 +7208,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; } @@ -7232,11 +7241,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++) { @@ -7253,20 +7263,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; + void (*fn)(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr); + int maxpass = is_scalar ? 1 : ((8 << is_q) >> size); + + 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) { + fn = gen_helper_vfp_touls; + } else { + 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, MO_32); - if (is_u) { - gen_helper_vfp_touls(tcg_op, tcg_op, tcg_shift, tcg_fpstatus); - } else { - gen_helper_vfp_tosls(tcg_op, tcg_op, tcg_shift, tcg_fpstatus); - } + 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); }