From nobody Wed May 15 04:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1621379123; cv=none; d=zohomail.com; s=zohoarc; b=Wm4G1ES0hFPBLULmYnMBqv2TCB/EQt3QENhIdCeM3KD6CT/PJIE2fLUKOq2mrJuuzhhcYD6CaHplIw1dTKkAA16gUZ9Dp7QVItPtO2qmvqEsePpF38X+y1NAIhZKqg52rDn9KKh86YVg/R3Cor+83sdIAC99jQ6E8/jXXQTBrX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621379123; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Sj0Uk8PYsvIc7vs41394HwVDEr8ScZlhm0Ps3RSJ62Y=; b=fzHPxIQCYeTZ+n+bFIf/X2Pj38aVhUnVM3qia8dveuK6lZcczo0dUrAzOPtrCDcY+GcjA3Uxv9vf7J0cU+Y45+fY6+CfSm1VdRuXXZmUXZL/cqKSkTEoHzFLiATYgv3g9bYapj+QFfwhJ/tEiCxqi1bIKalQGNsI4DvSYv8oyrg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16213791236341016.871051553521; Tue, 18 May 2021 16:05:23 -0700 (PDT) Received: from localhost ([::1]:45000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lj8mA-0008Fh-8M for importer@patchew.org; Tue, 18 May 2021 19:05:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lj8hO-000363-Pq for qemu-devel@nongnu.org; Tue, 18 May 2021 19:00:28 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:28261) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lj8hJ-0001fx-9s for qemu-devel@nongnu.org; Tue, 18 May 2021 19:00:25 -0400 Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-01.qualcomm.com with ESMTP; 18 May 2021 16:00:20 -0700 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg04-sd.qualcomm.com with ESMTP; 18 May 2021 16:00:18 -0700 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id 764F616C4; Tue, 18 May 2021 18:00:18 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1621378821; x=1652914821; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Sj0Uk8PYsvIc7vs41394HwVDEr8ScZlhm0Ps3RSJ62Y=; b=zEam5T4yMvZ0tBNk3WBro6pdWwkdrTUwifzN65gHlF8MtI6Kken/zTF9 GrLqHOxcf4dXAMFAX/xlAkcsb6NNEagzJX1CN8pOOcwINvTWoeEr06lAM gsdmXJnryMV7t5lEMMXzEzW1mYFRdb0P1dvcvp+dl+wJy1YzHk59ohc+g k=; X-QCInternal: smtphost From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [PATCH 1/2] Hexagon (target/hexagon) fix bug in fLSBNEW* Date: Tue, 18 May 2021 18:00:09 -0500 Message-Id: <1621378810-5284-2-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621378810-5284-1-git-send-email-tsimpson@quicinc.com> References: <1621378810-5284-1-git-send-email-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=199.106.114.38; envelope-from=tsimpson@qualcomm.com; helo=alexa-out-sd-01.qualcomm.com X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: ale@rev.ng, philmd@redhat.com, tsimpson@quicinc.com, richard.henderson@linaro.org, bcain@quicinc.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Change fLSBNEW/fLSBNEW0/fLSBNEW1 from copy to "x & 1" Remove gen_logical_not function Clean up fLSBNEWNOT to use andi-1 followed by xori-1 Test cases added to tests/tcg/hexagon/misc.c Signed-off-by: Taylor Simpson --- target/hexagon/macros.h | 27 ++++++++++----------------- target/hexagon/op_helper.c | 5 ----- tests/tcg/hexagon/misc.c | 39 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 48 insertions(+), 23 deletions(-) diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h index b726c3b..2b208f3 100644 --- a/target/hexagon/macros.h +++ b/target/hexagon/macros.h @@ -239,33 +239,26 @@ static inline void gen_pred_cancel(TCGv pred, int slo= t_num) #endif =20 #ifdef QEMU_GENERATE -#define fLSBNEW(PVAL) tcg_gen_mov_tl(LSB, (PVAL)) -#define fLSBNEW0 tcg_gen_mov_tl(LSB, hex_new_pred_value[0]) -#define fLSBNEW1 tcg_gen_mov_tl(LSB, hex_new_pred_value[1]) +#define fLSBNEW(PVAL) tcg_gen_andi_tl(LSB, (PVAL), 1) +#define fLSBNEW0 tcg_gen_andi_tl(LSB, hex_new_pred_value[0], 1) +#define fLSBNEW1 tcg_gen_andi_tl(LSB, hex_new_pred_value[1], 1) #else -#define fLSBNEW(PVAL) (PVAL) -#define fLSBNEW0 new_pred_value(env, 0) -#define fLSBNEW1 new_pred_value(env, 1) +#define fLSBNEW(PVAL) ((PVAL) & 1) +#define fLSBNEW0 (env->new_pred_value[0] & 1) +#define fLSBNEW1 (env->new_pred_value[1] & 1) #endif =20 #ifdef QEMU_GENERATE -static inline void gen_logical_not(TCGv dest, TCGv src) -{ - TCGv one =3D tcg_const_tl(1); - TCGv zero =3D tcg_const_tl(0); - - tcg_gen_movcond_tl(TCG_COND_NE, dest, src, zero, zero, one); - - tcg_temp_free(one); - tcg_temp_free(zero); -} #define fLSBOLDNOT(VAL) \ do { \ tcg_gen_andi_tl(LSB, (VAL), 1); \ tcg_gen_xori_tl(LSB, LSB, 1); \ } while (0) #define fLSBNEWNOT(PNUM) \ - gen_logical_not(LSB, (PNUM)) + do { \ + tcg_gen_andi_tl(LSB, (PNUM), 1); \ + tcg_gen_xori_tl(LSB, LSB, 1); \ + } while (0) #else #define fLSBNEWNOT(PNUM) (!fLSBNEW(PNUM)) #define fLSBOLDNOT(VAL) (!fLSBOLD(VAL)) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 63dd685..4595559 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -128,11 +128,6 @@ void HELPER(debug_start_packet)(CPUHexagonState *env) } } =20 -static int32_t new_pred_value(CPUHexagonState *env, int pnum) -{ - return env->new_pred_value[pnum]; -} - /* Checks for bookkeeping errors between disassembly context and runtime */ void HELPER(debug_check_store_width)(CPUHexagonState *env, int slot, int c= heck) { diff --git a/tests/tcg/hexagon/misc.c b/tests/tcg/hexagon/misc.c index 17c3919..9e139f3 100644 --- a/tests/tcg/hexagon/misc.c +++ b/tests/tcg/hexagon/misc.c @@ -181,6 +181,19 @@ static inline void S4_storeirifnew_io(void *p, int pre= d) : "p0", "memory"); } =20 +static int L2_ploadrifnew_pi(void *p, int pred) +{ + int result; + asm volatile("%0 =3D #31\n\t" + "{\n\t" + " p0 =3D cmp.eq(%1, #1)\n\t" + " if (!p0.new) %0 =3D memw(%2++#4)\n\t" + "}\n\t" + : "=3Dr"(result) : "r"(pred), "r"(p) + : "p0"); + return result; +} + /* * Test that compound-compare-jump is executed in 2 parts * First we have to do all the compares in the packet and @@ -298,8 +311,24 @@ static int auto_and(void) return retval; } =20 +void test_lsbnew(void) +{ + int result; + + asm("r0 =3D #2\n\t" + "r1 =3D #5\n\t" + "{\n\t" + " p0 =3D r0\n\t" + " if (p0.new) r1 =3D #3\n\t" + "}\n\t" + "%0 =3D r1\n\t" + : "=3Dr"(result) :: "r0", "r1", "p0"); + check(result, 5); +} + int main() { + int res; long long res64; int pred; =20 @@ -394,6 +423,12 @@ int main() S4_storeirifnew_io(&array[8], 1); check(array[9], 9); =20 + memcpy(array, init, sizeof(array)); + res =3D L2_ploadrifnew_pi(&array[6], 0); + check(res, 6); + res =3D L2_ploadrifnew_pi(&array[7], 1); + check(res, 31); + int x =3D cmpnd_cmp_jump(); check(x, 12); =20 @@ -406,7 +441,7 @@ int main() check((int)pair, 5); check((int)(pair >> 32), 7); =20 - int res =3D test_clrtnew(1, 7); + res =3D test_clrtnew(1, 7); check(res, 0); res =3D test_clrtnew(2, 7); check(res, 7); @@ -422,6 +457,8 @@ int main() res =3D auto_and(); check(res, 0); =20 + test_lsbnew(); + puts(err ? "FAIL" : "PASS"); return err; } --=20 2.7.4 From nobody Wed May 15 04:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1621378917; cv=none; d=zohomail.com; s=zohoarc; b=BqAMFTERypEVpmJU8z4gbAt/vyctMQI4xoy8owhJiPoV7shtTjlQ5/Cx3fQr7OmYCyx3hSF0l5NIAaaDfAsuH5K4BPxN2+MjUEG/yKJLN5iAhBkoS64wh1CUiuBzKQkJQpR+U3AZ5ywcpRoD7xC6aQsu27g3UL5B701kkKqb7NA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621378917; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tWHtKBgnflOpZom5LwTNqGs6gHFhKWBork947kc3apk=; b=BsO9nK9EKBkDuB1lGvKX3PjrMWOpgLd3TGJE7y6PbcaGOVf5bM0hcv9po5KhPaGTkhtIt0LV779QkaXfMJpbJCZeIclDd1hGT8KIbNBX+UjQs7O2Tv0NIS96PZ+wjp4E+vokIzS5F6+CVXGsUk8CcnQC0xcdBzuRQfNHoTOop2Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621378917599810.1208572779537; Tue, 18 May 2021 16:01:57 -0700 (PDT) Received: from localhost ([::1]:40124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lj8iq-0004tM-8s for importer@patchew.org; Tue, 18 May 2021 19:01:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lj8hN-00035H-65 for qemu-devel@nongnu.org; Tue, 18 May 2021 19:00:25 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:43008) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lj8hJ-0001ft-9h for qemu-devel@nongnu.org; Tue, 18 May 2021 19:00:24 -0400 Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-02.qualcomm.com with ESMTP; 18 May 2021 16:00:19 -0700 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg03-sd.qualcomm.com with ESMTP; 18 May 2021 16:00:18 -0700 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id 88C4116EA; Tue, 18 May 2021 18:00:18 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1621378821; x=1652914821; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tWHtKBgnflOpZom5LwTNqGs6gHFhKWBork947kc3apk=; b=lplkgSJe9jK5dJxdXIifCTPgsN3fcb1m8kxCFVCH/xO0DsJpm33EPAcj 7LEaWubLveiHqSlgnsM1rc1zxnp0U6FlZZGrpxgRH+12P68gsVvmjQ7h+ ABDFHe9zwW49iZzwCRCxsh71Keiznc0KFG8ueB2tcdY2OZdmXHCpiOcHf I=; X-QCInternal: smtphost From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [PATCH 2/2] Hexagon (target/hexagon) fix l2fetch instructions Date: Tue, 18 May 2021 18:00:10 -0500 Message-Id: <1621378810-5284-3-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621378810-5284-1-git-send-email-tsimpson@quicinc.com> References: <1621378810-5284-1-git-send-email-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=199.106.114.39; envelope-from=tsimpson@qualcomm.com; helo=alexa-out-sd-02.qualcomm.com X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: ale@rev.ng, philmd@redhat.com, tsimpson@quicinc.com, richard.henderson@linaro.org, bcain@quicinc.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Y4_l2fetch =3D=3D l2fetch(Rs32, Rt32) Y5_l2fetch =3D=3D l2fetch(Rs32, Rtt32) The semantics for these instructions are present, but the encodings are missing. Note that these are treated as nops in qemu, so we add overrides. Test case added to tests/tcg/hexagon/misc.c Signed-off-by: Taylor Simpson --- target/hexagon/gen_tcg.h | 11 +++++++++++ tests/tcg/hexagon/misc.c | 9 +++++++++ target/hexagon/imported/encode_pp.def | 3 +++ 3 files changed, 23 insertions(+) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index 18fcdbc..a375d6a 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -734,4 +734,15 @@ #define fGEN_TCG_F2_dfmpyhh(SHORTCODE) \ gen_helper_dfmpyhh(RxxV, cpu_env, RxxV, RssV, RttV) =20 +/* Nothing to do for these in qemu, need to suppress compiler warnings */ +#define fGEN_TCG_Y4_l2fetch(SHORTCODE) \ + do { \ + RsV =3D RsV; \ + RtV =3D RtV; \ + } while (0) +#define fGEN_TCG_Y5_l2fetch(SHORTCODE) \ + do { \ + RsV =3D RsV; \ + } while (0) + #endif diff --git a/tests/tcg/hexagon/misc.c b/tests/tcg/hexagon/misc.c index 9e139f3..f0b1947 100644 --- a/tests/tcg/hexagon/misc.c +++ b/tests/tcg/hexagon/misc.c @@ -326,6 +326,13 @@ void test_lsbnew(void) check(result, 5); } =20 +void test_l2fetch(void) +{ + /* These don't do anything in qemu, just make sure they don't assert */ + asm volatile ("l2fetch(r0, r1)\n\t" + "l2fetch(r0, r3:2)\n\t"); +} + int main() { int res; @@ -459,6 +466,8 @@ int main() =20 test_lsbnew(); =20 + test_l2fetch(); + puts(err ? "FAIL" : "PASS"); return err; } diff --git a/target/hexagon/imported/encode_pp.def b/target/hexagon/importe= d/encode_pp.def index 35ae3d2..939c6fc 100644 --- a/target/hexagon/imported/encode_pp.def +++ b/target/hexagon/imported/encode_pp.def @@ -493,6 +493,9 @@ DEF_ENC32(Y2_dccleana, ICLASS_ST" 000 00 00sssss PP= ------ --------") DEF_ENC32(Y2_dcinva, ICLASS_ST" 000 00 01sssss PP------ --------") DEF_ENC32(Y2_dccleaninva, ICLASS_ST" 000 00 10sssss PP------ --------") =20 +DEF_ENC32(Y4_l2fetch, ICLASS_ST" 011 00 00sssss PP-ttttt 000-----") +DEF_ENC32(Y5_l2fetch, ICLASS_ST" 011 01 00sssss PP-ttttt --------") + /*******************************/ /* */ /* */ --=20 2.7.4