From patchwork Mon Jul 23 20:17:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 142661 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp6520112ljj; Mon, 23 Jul 2018 14:35:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpetdA/am3s2br0eclLhUp8wFlfbA4pqjhpEbxjuTQVt/6UvbF/7JP3nUsROSPwrnjPkRPW9 X-Received: by 2002:ac8:1738:: with SMTP id w53-v6mr14078909qtj.421.1532381745702; Mon, 23 Jul 2018 14:35:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532381745; cv=none; d=google.com; s=arc-20160816; b=Xnq7GbDHxiGCTy/XzYknOfCiJiY6PTg6ctBm1aTTdIS+eGA/UXjkDCpcFfeuBcHjNQ FuZ8Qp3UTC4C68aIxg4A9BzRDOWD25w3qp6mcu4VkfiXdG/EK3W1mF23d8kD9304JkJ6 X4idfH6R63deX6gyrCK/WfVey2wSBf+ifX+UwWk43GnsjUTtv1hVxiCjGUp5ewpprHCL kmyVXT4I4VctDdjoyZV794fnhFlUEXWR9x4Tla6dPM1IgiTrsKbeTzTJ0M4LN6NT+etD DkD/iQRCS/eY9y1y+REV4Mo/ycUA15OW9gwfapsaDXAnTR/zpAoVOSg/HhuEEzVzCVk3 HQkw== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=6hjUj8XyV2DypjsCvz3iBwG01puPwJvqRnMj7VRoXbI=; b=ozqO6Rf9Me3oeqsf3EuRIlycUVj6QkbNu0G0nc0AMK1RqB4mPY1ji/1nBU1sTFxaqT 6+Jm/1L6A2MI55fnnH8caZie6M+CMN/4UfXwyCUx6cS0wG31mHgIE6dTEuROlBAJ30pn jo+m0SXTAymTMXvc/PRAeDQx379I22+K7mDJifGKZeyc+ot/lgtI4zeZ58NJf+ymx9+q mdl4Iu93Ypq6Nu/F/17ovYSgGJUsKv2O271CP5cSVvHpP33HtsTUCEMAgI6Prto0goRN VbwVIoE1PJ+60iPycQ5VWUGUfR3p/mS0wiSs6BQCx7w5+/P38htYW5TLebUvYinXnBpL 7d0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=S430aq4Y; 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 u27-v6si4769549qte.81.2018.07.23.14.35.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 23 Jul 2018 14:35:45 -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=S430aq4Y; 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]:36820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhiUb-00030I-5V for patch@linaro.org; Mon, 23 Jul 2018 17:35:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhKm-0003wk-8Y for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhKk-0005PE-Fb for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:31 -0400 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]:41190) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhKk-0005Od-9H; Mon, 23 Jul 2018 16:21:30 -0400 Received: by mail-oi0-x241.google.com with SMTP id k12-v6so3470408oiw.8; Mon, 23 Jul 2018 13:21:30 -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 :mime-version:content-transfer-encoding; bh=6hjUj8XyV2DypjsCvz3iBwG01puPwJvqRnMj7VRoXbI=; b=S430aq4YdmQqd/oMMSA3umegvasrKD15r+RUcNBu+hVDpmtbzhf/DE6XIqu9W7pnPV 4U9qlz/jNV64GcsinejNJUjQCep3D7tXWgwG22+VZlxvA0se3IBf1lldE3TjhKeUlqmw hcGW/2+j4x/s0vsg1TdIPPXGJei5QJje1mAw+p9VvyNtI7Qcl9AgxQQ89ukiOKUm6tVk Fiempz9M9AQIsa+RKg8Ujlj2P+Xq8vWaCVLQnK3dwSPm1J8UAwSifqLMcWIR/Pc5OaDc E3ff+CGiPinLOQvV5j1O2LKkINnBJipDsayzkisCvePexDf3AjChpM1yNW4HTOAClIrX 2ufQ== 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:mime-version:content-transfer-encoding; bh=6hjUj8XyV2DypjsCvz3iBwG01puPwJvqRnMj7VRoXbI=; b=lDnS+pZb5ERNNa/c8SP2ksbhoMuUgiGqNxE7h6FeS9Fa6eVcawed681tqwf3WjHIXr NllP6/3SCyurrRjvbWhTMWXiBzQsTPMbGcLS6+YiEfaNf/qY6xgP50Z3VAtVCtvnhxvU n9BA9sKQacWHLw7x4b6gVQ+q+k5aFyB00cyybYxPjKoHN7vJbGy1tWO2yGeXDLCS33MX TOpl2xpUUcHCoNG+7TePa3xWzU3ZKBlZoxKkvG0ijzXcQFWaMFFN7b2SSDL8dglqAQeF vMu7Y/bnM5s8emiidOCgN2Dbmci593Gpu7enRHneCIaJKucAviBF92hfUUlDZSGXXPzH cEMg== X-Gm-Message-State: AOUpUlGt2TTJms9b57eVLFsiOHUpegs7hyD+WIb6ErHm3s5JD1Y9GosM xJ2aPGoc8xvoj30H0wobAPs2Q7SqZi7S1w== X-Received: by 2002:aca:d5cd:: with SMTP id m196-v6mr306652oig.160.1532377289113; Mon, 23 Jul 2018 13:21:29 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id q124-v6sm7914349oif.8.2018.07.23.13.21.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:21:28 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:17:29 -0500 Message-Id: <20180723201748.25573-81-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> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::241 Subject: [Qemu-devel] [PATCH 80/99] target/arm: Implement FP data-processing (2 source) 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 We missed all of the scalar fp16 binary operations. Cc: qemu-stable@nongnu.org Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Tested-by: Alex Bennée Message-id: 20180512003217.9105-7-richard.henderson@linaro.org Signed-off-by: Peter Maydell (cherry picked from commit b8f5171cf01420a9f0ee895c5591e9b9914f391a) Signed-off-by: Michael Roth --- target/arm/translate-a64.c | 65 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) -- 2.17.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index bcb3b5c5e7..5260849f03 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5056,6 +5056,61 @@ static void handle_fp_2src_double(DisasContext *s, int opcode, tcg_temp_free_i64(tcg_res); } +/* Floating-point data-processing (2 source) - half precision */ +static void handle_fp_2src_half(DisasContext *s, int opcode, + int rd, int rn, int rm) +{ + TCGv_i32 tcg_op1; + TCGv_i32 tcg_op2; + TCGv_i32 tcg_res; + TCGv_ptr fpst; + + tcg_res = tcg_temp_new_i32(); + fpst = get_fpstatus_ptr(true); + tcg_op1 = read_fp_hreg(s, rn); + tcg_op2 = read_fp_hreg(s, rm); + + switch (opcode) { + case 0x0: /* FMUL */ + gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x1: /* FDIV */ + gen_helper_advsimd_divh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x2: /* FADD */ + gen_helper_advsimd_addh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x3: /* FSUB */ + gen_helper_advsimd_subh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x4: /* FMAX */ + gen_helper_advsimd_maxh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x5: /* FMIN */ + gen_helper_advsimd_minh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x6: /* FMAXNM */ + gen_helper_advsimd_maxnumh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x7: /* FMINNM */ + gen_helper_advsimd_minnumh(tcg_res, tcg_op1, tcg_op2, fpst); + break; + case 0x8: /* FNMUL */ + gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst); + tcg_gen_xori_i32(tcg_res, tcg_res, 0x8000); + break; + default: + g_assert_not_reached(); + } + + write_fp_sreg(s, rd, tcg_res); + + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tcg_op1); + tcg_temp_free_i32(tcg_op2); + tcg_temp_free_i32(tcg_res); +} + /* Floating point data-processing (2 source) * 31 30 29 28 24 23 22 21 20 16 15 12 11 10 9 5 4 0 * +---+---+---+-----------+------+---+------+--------+-----+------+------+ @@ -5088,6 +5143,16 @@ static void disas_fp_2src(DisasContext *s, uint32_t insn) } handle_fp_2src_double(s, opcode, rd, rn, rm); break; + case 3: + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { + unallocated_encoding(s); + return; + } + if (!fp_access_check(s)) { + return; + } + handle_fp_2src_half(s, opcode, rd, rn, rm); + break; default: unallocated_encoding(s); }