From patchwork Wed May 16 22:30:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 136075 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1545493lji; Wed, 16 May 2018 15:57:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpeQ9E/pThX8KUREFBlPKEbcN4CpPlWc0kLFZAdhWcknuzXKcbY/MPaMqhHxvFJ4Ap+oDip X-Received: by 2002:ac8:41cc:: with SMTP id o12-v6mr3073226qtm.227.1526511445354; Wed, 16 May 2018 15:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526511445; cv=none; d=google.com; s=arc-20160816; b=VFW+iumugg6NX+l7QRmvQKerX+wf8W5M2J8nPaakpBE+mF+hBamLclolwy5Qh0F3wW XnFpFVnk2xuYgMGXcS35zKBfcjEN11R+jTQE2Q80eIJIV6VeNnPOZeC3geh2dbsfTLpa E7EuqYZjkB0yoTzOe5uGy/I5vsGOjZ1a/i4fWXma9J1X4lXVvHh+DVU8ibakGrLd0Sys BrJnC5k8JFX1XuGqIq3dmVQD+rKyHxqCRmLnLjKgN981nVvgCxuxOFAoo8v5hNgNOHLQ d35lIWkEjOL5xBzxoZW7enScNHASMifvVJLdOXVrlP/6QNvW05eBA1WaqLimGpDW+qYJ NHtA== 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=SkJdca9df8jMesnr9raKZw5iQRhGtTAn4Z6Ps+A956I=; b=oOruqOgdbfdax61WVZmi8+n2rt+xA8ZR+QfjTtTMNVGRh/Mz0YyT+8VuviW05kPIx6 zn7Y6yomEuX0LUzrc4z0UzyNOZC0dLwVFDY1rSJL0VbmLrn7VhkAOVTR4XdhF5Ba3BUr LwFpadGVszvtoMkTSHVuR7ilOyVPrTgMATY1SZb3LtvtYTWVq7e3ULRkwghukr895K3/ bWgn/SVCwJckFJMFx5thjMIjO0LGuPTA9ze1yoV0z0Hq0zelfUT8IYcpwh2gu/0EGLCc XbeDOwbMShYwyUN9TtDecTRNV8LdtREOeND/yKeyW3CH/SFW4g78ulV7K6uglwEkwk6x GTFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZHCfuWvW; 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 p6-v6si2091959qkh.243.2018.05.16.15.57.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 16 May 2018 15:57:25 -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=ZHCfuWvW; 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]:45749 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ5MK-0003oz-RZ for patch@linaro.org; Wed, 16 May 2018 18:57:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ4wU-0007sv-A0 for qemu-devel@nongnu.org; Wed, 16 May 2018 18:30:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ4wS-0007gV-Tc for qemu-devel@nongnu.org; Wed, 16 May 2018 18:30:42 -0400 Received: from mail-pl0-x236.google.com ([2607:f8b0:400e:c01::236]:45807) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJ4wS-0007ez-OA for qemu-devel@nongnu.org; Wed, 16 May 2018 18:30:40 -0400 Received: by mail-pl0-x236.google.com with SMTP id bi12-v6so1235769plb.12 for ; Wed, 16 May 2018 15:30:40 -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=SkJdca9df8jMesnr9raKZw5iQRhGtTAn4Z6Ps+A956I=; b=ZHCfuWvWCHDMHTUfQub04lLmhDM4XD7NiFDQdInkUDH+ciOIrY9OXYWtY3xCx+X0SN nASiHqtZXFj+IAMul0xQtORF6wyfY5IaMIzMuUt6zCdpMy6Yv1O9a+rtRk9fChxKseIb ngld9ANJZIEisauYWsIlTI0+0ve2a0iKYgXb8= 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=SkJdca9df8jMesnr9raKZw5iQRhGtTAn4Z6Ps+A956I=; b=VPbKmoIcYaRgg7IpgKYAPQU8h5aBGwiVASfHkaKg2aIOlNdbVV0ZjXdTBWkffI7R4k Z+CzXJXTlvujJoLQqTjKu57N1EHYlYhJrEIkNwTScgtzwOGESQifMewCSK2nq/wh35wL FHIq/qiGp1c7IIJMcFdco3VYBfIPd7U7DBS/k5TvwvCuUD2/5+oXcpwJlkekIAluOm0+ FMBLTcWw/lfMhFPjfnQZD7ItrTIwHgoaLSrzNyy1WYmn1pj4wL7qxv1HG5+eWDzYKoev SyNqgfvC0PRbOrfppXjr6pEszZjAtQ/kAAVpoAZnTGRhrlQLTD9eJZqvGYirBmt5MSz+ 957w== X-Gm-Message-State: ALKqPwfkpeJxJJ6/Na1GkNm1sNXEtujysOvKLJ/Kn50+N/ZhdFfmu5St eQKuPnjZ8vNMXk8Trjcbc9jGbWvDOFg= X-Received: by 2002:a17:902:41:: with SMTP id 59-v6mr2696729pla.345.1526509839484; Wed, 16 May 2018 15:30:39 -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 j1-v6sm6640418pfc.159.2018.05.16.15.30.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 15:30:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 16 May 2018 15:30:01 -0700 Message-Id: <20180516223007.10256-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516223007.10256-1-richard.henderson@linaro.org> References: <20180516223007.10256-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:c01::236 Subject: [Qemu-devel] [PATCH v3-a 21/27] target/arm: Implement SVE floating-point trig select coefficient 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper-sve.h | 4 ++++ target/arm/sve_helper.c | 43 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 21 +++++++++++++++++++ target/arm/sve.decode | 4 ++++ 4 files changed, 72 insertions(+) -- 2.17.0 diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index e2925ff8ec..4f1bd5a62f 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -389,6 +389,10 @@ DEF_HELPER_FLAGS_3(sve_fexpa_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(sve_fexpa_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(sve_fexpa_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_ftssel_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_ftssel_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_ftssel_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_5(sve_and_pppp, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_bic_pppp, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_eor_pppp, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 6ffb126821..85a0639e3a 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -23,6 +23,7 @@ #include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" +#include "fpu/softfloat.h" /* Note that vector data is stored in host-endian 64-bit chunks, @@ -1192,3 +1193,45 @@ void HELPER(sve_fexpa_d)(void *vd, void *vn, uint32_t desc) d[i] = coeff[idx] | (exp << 52); } } + +void HELPER(sve_ftssel_h)(void *vd, void *vn, void *vm, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 2; + uint16_t *d = vd, *n = vn, *m = vm; + for (i = 0; i < opr_sz; i += 1) { + uint16_t nn = n[i]; + uint16_t mm = m[i]; + if (mm & 1) { + nn = float16_one; + } + d[i] = nn ^ (mm & 2) << 14; + } +} + +void HELPER(sve_ftssel_s)(void *vd, void *vn, void *vm, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 4; + uint32_t *d = vd, *n = vn, *m = vm; + for (i = 0; i < opr_sz; i += 1) { + uint32_t nn = n[i]; + uint32_t mm = m[i]; + if (mm & 1) { + nn = float32_one; + } + d[i] = nn ^ (mm & 2) << 30; + } +} + +void HELPER(sve_ftssel_d)(void *vd, void *vn, void *vm, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t *d = vd, *n = vn, *m = vm; + for (i = 0; i < opr_sz; i += 1) { + uint64_t nn = n[i]; + uint64_t mm = m[i]; + if (mm & 1) { + nn = float64_one; + } + d[i] = nn ^ (mm & 2) << 62; + } +} diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 54d774b5e0..ea8d2c4112 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -953,6 +953,27 @@ static bool trans_FEXPA(DisasContext *s, arg_rr_esz *a, uint32_t insn) return true; } +static bool trans_FTSSEL(DisasContext *s, arg_rrr_esz *a, uint32_t insn) +{ + static gen_helper_gvec_3 * const fns[4] = { + NULL, + gen_helper_sve_ftssel_h, + gen_helper_sve_ftssel_s, + gen_helper_sve_ftssel_d, + }; + if (a->esz == 0) { + return false; + } + if (sve_access_check(s)) { + unsigned vsz = vec_full_reg_size(s); + tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), + vec_full_reg_offset(s, a->rn), + vec_full_reg_offset(s, a->rm), + vsz, vsz, 0, fns[a->esz]); + } + return true; +} + /* *** SVE Predicate Logical Operations Group */ diff --git a/target/arm/sve.decode b/target/arm/sve.decode index cd53b95831..224dfdd1e9 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -295,6 +295,10 @@ ADR_p64 00000100 11 1 ..... 1010 .. ..... ..... @rd_rn_msz_rm # Note esz != 0 FEXPA 00000100 .. 1 00000 101110 ..... ..... @rd_rn +# SVE floating-point trig select coefficient +# Note esz != 0 +FTSSEL 00000100 .. 1 ..... 101100 ..... ..... @rd_rn_rm + ### SVE Predicate Logical Operations Group # SVE predicate logical operations