From nobody Mon Feb 9 12:11:24 2026 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16443440285131016.7322231274699; Tue, 8 Feb 2022 10:13:48 -0800 (PST) Received: from localhost ([::1]:46266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHUzr-0002HT-FK for importer@patchew.org; Tue, 08 Feb 2022 13:13:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHU8D-0006hD-Ab for qemu-devel@nongnu.org; Tue, 08 Feb 2022 12:18:21 -0500 Received: from alexa-out.qualcomm.com ([129.46.98.28]:61003) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1nHU80-0002Z6-33 for qemu-devel@nongnu.org; Tue, 08 Feb 2022 12:18:19 -0500 Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 08 Feb 2022 09:17:56 -0800 Received: from hu-tsimpson-lv.qualcomm.com (HELO hu-devc-lv-u18-c.qualcomm.com) ([10.47.235.220]) by ironmsg-lv-alpha.qualcomm.com with ESMTP; 08 Feb 2022 09:17:56 -0800 Received: by hu-devc-lv-u18-c.qualcomm.com (Postfix, from userid 47164) id DAA8C500175; Tue, 8 Feb 2022 09:16:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1644340688; x=1675876688; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=01Bbm5zoY43+gfseMEAlRWX3keMDKpLh5hrxe5L2EQE=; b=kJLSuFpk/gcKsU1XtlwVGkqNyyeilm6YS2E7vO9Fa6ioOtzQM3bQrJ82 Gy8nP/VcN91Iroul2gMPOp2OXRuBquwhRZxW54rxVx4kGWjsWvw2BIJ77 ccLPtT9fXz/2y6eBW9fVH1R1A0aPAY1wUCA1HvgAwHD22nTvGzx78xQOE w=; X-QCInternal: smtphost From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [PATCH] Hexagon (tests/tcg/hexagon) fix inline asm in preg_alias.c Date: Tue, 8 Feb 2022 09:16:52 -0800 Message-Id: <20220208171652.31085-1-tsimpson@quicinc.com> X-Mailer: git-send-email 2.17.1 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=129.46.98.28; envelope-from=tsimpson@qualcomm.com; helo=alexa-out.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.248, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ale@rev.ng, bcain@quicinc.com, richard.henderson@linaro.org, f4bug@amsat.org, tsimpson@quicinc.com, mlambert@quicinc.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644344029830100003 Replace consecutive inline asm blocks with a single one with proper outputs/inputs/clobbers rather than making assumptions about register values being carried between separate blocks. Signed-off-by: Taylor Simpson Reviewed-by: Richard Henderson --- tests/tcg/hexagon/preg_alias.c | 46 ++++++++++++++++------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/tests/tcg/hexagon/preg_alias.c b/tests/tcg/hexagon/preg_alias.c index 0cac469b78..9f7b125998 100644 --- a/tests/tcg/hexagon/preg_alias.c +++ b/tests/tcg/hexagon/preg_alias.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,17 +57,15 @@ typedef union { =20 static inline void creg_alias(int cval, PRegs *pregs) { - unsigned char val; - asm volatile("c4 =3D %0" : : "r"(cval)); - - asm volatile("%0 =3D p0" : "=3Dr"(val)); - pregs->pregs.p0 =3D val; - asm volatile("%0 =3D p1" : "=3Dr"(val)); - pregs->pregs.p1 =3D val; - asm volatile("%0 =3D p2" : "=3Dr"(val)); - pregs->pregs.p2 =3D val; - asm volatile("%0 =3D p3" : "=3Dr"(val)); - pregs->pregs.p3 =3D val; + asm("c4 =3D %4\n\t" + "%0 =3D p0\n\t" + "%1 =3D p1\n\t" + "%2 =3D p2\n\t" + "%3 =3D p3\n\t" + : "=3Dr"(pregs->pregs.p0), "=3Dr"(pregs->pregs.p1), + "=3Dr"(pregs->pregs.p2), "=3Dr"(pregs->pregs.p3) + : "r"(cval) + : "c4", "p0", "p1", "p2", "p3"); } =20 int err; @@ -83,19 +81,19 @@ static void check(int val, int expect) static inline void creg_alias_pair(unsigned int cval, PRegs *pregs) { unsigned long long cval_pair =3D (0xdeadbeefULL << 32) | cval; - unsigned char val; int c5; - asm volatile("c5:4 =3D %0" : : "r"(cval_pair)); - - asm volatile("%0 =3D p0" : "=3Dr"(val)); - pregs->pregs.p0 =3D val; - asm volatile("%0 =3D p1" : "=3Dr"(val)); - pregs->pregs.p1 =3D val; - asm volatile("%0 =3D p2" : "=3Dr"(val)); - pregs->pregs.p2 =3D val; - asm volatile("%0 =3D p3" : "=3Dr"(val)); - pregs->pregs.p3 =3D val; - asm volatile("%0 =3D c5" : "=3Dr"(c5)); + + asm ("c5:4 =3D %5\n\t" + "%0 =3D p0\n\t" + "%1 =3D p1\n\t" + "%2 =3D p2\n\t" + "%3 =3D p3\n\t" + "%4 =3D c5\n\t" + : "=3Dr"(pregs->pregs.p0), "=3Dr"(pregs->pregs.p1), + "=3Dr"(pregs->pregs.p2), "=3Dr"(pregs->pregs.p3), "=3Dr"(c5) + : "r"(cval_pair) + : "c4", "c5", "p0", "p1", "p2", "p3"); + check(c5, 0xdeadbeef); } =20 --=20 2.17.1