From patchwork Tue Mar 31 03:54:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185080 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp3244645ilr; Mon, 30 Mar 2020 21:00:02 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtn4XJfEQId1eUlAs61ZCp0kTR1AM9Vfk885sH0JmR7nZA40LerF+KAhQY00I0v76Yjtcek X-Received: by 2002:ad4:5448:: with SMTP id h8mr14924527qvt.23.1585627202125; Mon, 30 Mar 2020 21:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585627202; cv=none; d=google.com; s=arc-20160816; b=HPET0Cw7XXa6gk1wYzThz5sMX1kA0EqHQFJcvxvwAOHriz8sTbJkdFgyWnZKDvRlYC wNFPCLLaWlW/ZyMWjQbqIX/WaIu0b+NHvSzxOi01oDUOchmHSyLoexFMAVgqdTWyRVIM IwwCzkRBMoc9Y2xWvVqHHC6F5ashvnU8c5EP7hfSF5gLwzfzkLK1HAiC9DzWzEK8JVSP d+lBPDdGSrO9Y7Yw8d4wigtZm65S0hj7KC3pgDti70g9yzhCXmHKeSZZ72J8ogL2NbbA petziQQNjR8ZiGfyzoDbNNM33zF9tKxqriO2AS/W/S+RWoVhSplF+eSs5IwyXxqTMRDe Ti/g== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=sVWQh9CNUJ7u635QOP+H3s5ThKzTlbDf/81J3QrEWMc=; b=wUSVUBTR/aiumAIPvV2IGKrCa/WUPo/TZqcZxjuXx036c18NbnRyPPMDXDnVKwR0GL SW/cByiorst1SIvqzPz7zWeGMqcnJ+jmnuPAJjWqKyQbdsa++wRXzj7qJ7CJ8lU80368 1KH6RiTSWD2yIPx0X3+cjnlgIJ8XLUHadxKGlVcwRlLzPzu2E6WsAOh5sXOQUxCdMUrM s6F34s69IYcEhYGbaaCLyqvknMjkjqvmSZeWKHSS+2a80Hiqa/kpExUt7KWFhqTMvb0e 3qTkZXE0aP1s5V1S8ebe9rjlkfiEReSKKvvrqGDiq0jwrfSYNrclO3Shao/uyMVByx4n 1MWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=abAIrGDB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id v83si9580418qka.245.2020.03.30.21.00.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Mar 2020 21:00:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=abAIrGDB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:60082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJ84H-0005jy-F9 for patch@linaro.org; Tue, 31 Mar 2020 00:00:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60917) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJ7zd-0004oi-04 for qemu-devel@nongnu.org; Mon, 30 Mar 2020 23:55:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJ7zb-0008H9-Nr for qemu-devel@nongnu.org; Mon, 30 Mar 2020 23:55:12 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:43560) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJ7zb-0008Gm-I5 for qemu-devel@nongnu.org; Mon, 30 Mar 2020 23:55:11 -0400 Received: by mail-pl1-x635.google.com with SMTP id v23so7599934ply.10 for ; Mon, 30 Mar 2020 20:55:11 -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 :mime-version:content-transfer-encoding; bh=sVWQh9CNUJ7u635QOP+H3s5ThKzTlbDf/81J3QrEWMc=; b=abAIrGDBGlAjvpm2YYOvX3gKhR8abmRXTe5lzZVK1+hVb36wpznzeeQc+D/nenODF8 ukNo/c5+Cd8SALKDryLq2RwVE+MIhgQKViSnx1okcLhLE4eWGM1xCjZ434oz/RCc0qWy UZeEIdDYabKA8jfaLhltxG3lUKskCFqHnI7BXM7LMrsy/kSvv7Ipuhs60+r4pEltl0bV BK7cpzlN4YeB5+a/Ulhneb15ccTLITNV5EI1Ju4DWnp8UQSEFrNI0VFPN/kF031udfCa EXC7Pd3nQklulbetaZcqO3sApCddrGv+Bz81ZiAQ8k77Ai2XZ9UZ0Z8AShX+cIpkuAtQ jbwg== 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:mime-version:content-transfer-encoding; bh=sVWQh9CNUJ7u635QOP+H3s5ThKzTlbDf/81J3QrEWMc=; b=r+F4PtObjMXNOcaryYh3yyxaSlXiYxHjE270HQCtAzI8oZqtu1HCclZ3U2v5B/41Rj p4muet5fsszQNf1mDdJT/mZ3fjjxgkHcQc3fS+nfGAvDfBr7W4qHAEUO7vHlI5CIBwTe jLH4ZvwQRfCdzU8xDM8AepotllDDWLDWWzdGGiZ5qTvoVowAvaxfgwo1Zl5zXGNRlqZG 8MPnvoTFk2myD7EEUI2c8zgigYe9jM4sT+Wv/QStzp+D5kE97fIICPI9iOLe+D1IrtPY uHBWuYDw/Ln5a7JRchT05TUDmPHa47zJ+pmv65OlBf6kyafODKXnfyHf18Jd2+SdEFr6 NgEQ== X-Gm-Message-State: AGi0PuZkGnc1Ad3g9AlzA5DCfzUald9kSCNoLSXrpJSk/n6Ga/rvf+A7 nCyO4fK3WSCh2ysiLt5winpTUGBKRws= X-Received: by 2002:a17:90a:2801:: with SMTP id e1mr1592143pjd.78.1585626910274; Mon, 30 Mar 2020 20:55:10 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id h11sm11386174pfq.56.2020.03.30.20.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 20:55:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL for-5.0 08/10] target/mips: Fix loongson multimedia condition instructions Date: Mon, 30 Mar 2020 20:54:54 -0700 Message-Id: <20200331035456.6494-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200331035456.6494-1-richard.henderson@linaro.org> References: <20200331035456.6494-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::635 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, Aleksandar Markovic , Jiaxun Yang , Huacai Chen Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jiaxun Yang Loongson multimedia condition instructions were previously implemented as write 0 to rd due to lack of documentation. So I just confirmed with Loongson about their encoding and implemented them correctly. Signed-off-by: Jiaxun Yang Acked-by: Huacai Chen Reviewed-by: Richard Henderson Reviewed-by: Aleksandar Markovic Message-Id: <20200324122212.11156-1-jiaxun.yang@flygoat.com> Signed-off-by: Richard Henderson --- target/mips/translate.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/target/mips/translate.c b/target/mips/translate.c index d745bd2803..25b595a17d 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -5529,6 +5529,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) { uint32_t opc, shift_max; TCGv_i64 t0, t1; + TCGCond cond; opc = MASK_LMI(ctx->opcode); switch (opc) { @@ -5862,14 +5863,39 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) case OPC_SEQU_CP2: case OPC_SEQ_CP2: + cond = TCG_COND_EQ; + goto do_cc_cond; + break; case OPC_SLTU_CP2: + cond = TCG_COND_LTU; + goto do_cc_cond; + break; case OPC_SLT_CP2: + cond = TCG_COND_LT; + goto do_cc_cond; + break; case OPC_SLEU_CP2: + cond = TCG_COND_LEU; + goto do_cc_cond; + break; case OPC_SLE_CP2: - /* - * ??? Document is unclear: Set FCC[CC]. Does that mean the - * FD field is the CC field? - */ + cond = TCG_COND_LE; + do_cc_cond: + { + int cc = (ctx->opcode >> 8) & 0x7; + TCGv_i64 t64 = tcg_temp_new_i64(); + TCGv_i32 t32 = tcg_temp_new_i32(); + + tcg_gen_setcond_i64(cond, t64, t0, t1); + tcg_gen_extrl_i64_i32(t32, t64); + tcg_gen_deposit_i32(fpu_fcr31, fpu_fcr31, t32, + get_fp_bit(cc), 1); + + tcg_temp_free_i32(t32); + tcg_temp_free_i64(t64); + } + goto no_rd; + break; default: MIPS_INVAL("loongson_cp2"); generate_exception_end(ctx, EXCP_RI); @@ -5878,6 +5904,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) gen_store_fpr64(ctx, t0, rd); +no_rd: tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); }