From: Taylor Simpson <tsimpson@quicinc.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, tsimpson@quicinc.com,
richard.henderson@linaro.org, f4bug@amsat.org,
zongyuan.li@smartx.com
Subject: [PULL v2 09/12] Hexagon (tests/tcg/hexagon) fix inline asm in preg_alias.c
Date: Sat, 12 Mar 2022 12:13:16 -0800 [thread overview]
Message-ID: <20220312201319.29040-10-tsimpson@quicinc.com> (raw)
In-Reply-To: <20220312201319.29040-1-tsimpson@quicinc.com>
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 <tsimpson@quicinc.com>
Message-Id: <20220210021556.9217-10-tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
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..79febeca97 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 Reserved.
+ * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Reserved.
*
* 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 {
static inline void creg_alias(int cval, PRegs *pregs)
{
- unsigned char val;
- asm volatile("c4 = %0" : : "r"(cval));
-
- asm volatile("%0 = p0" : "=r"(val));
- pregs->pregs.p0 = val;
- asm volatile("%0 = p1" : "=r"(val));
- pregs->pregs.p1 = val;
- asm volatile("%0 = p2" : "=r"(val));
- pregs->pregs.p2 = val;
- asm volatile("%0 = p3" : "=r"(val));
- pregs->pregs.p3 = val;
+ asm("c4 = %4\n\t"
+ "%0 = p0\n\t"
+ "%1 = p1\n\t"
+ "%2 = p2\n\t"
+ "%3 = p3\n\t"
+ : "=r"(pregs->pregs.p0), "=r"(pregs->pregs.p1),
+ "=r"(pregs->pregs.p2), "=r"(pregs->pregs.p3)
+ : "r"(cval)
+ : "p0", "p1", "p2", "p3");
}
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 = (0xdeadbeefULL << 32) | cval;
- unsigned char val;
int c5;
- asm volatile("c5:4 = %0" : : "r"(cval_pair));
-
- asm volatile("%0 = p0" : "=r"(val));
- pregs->pregs.p0 = val;
- asm volatile("%0 = p1" : "=r"(val));
- pregs->pregs.p1 = val;
- asm volatile("%0 = p2" : "=r"(val));
- pregs->pregs.p2 = val;
- asm volatile("%0 = p3" : "=r"(val));
- pregs->pregs.p3 = val;
- asm volatile("%0 = c5" : "=r"(c5));
+
+ asm ("c5:4 = %5\n\t"
+ "%0 = p0\n\t"
+ "%1 = p1\n\t"
+ "%2 = p2\n\t"
+ "%3 = p3\n\t"
+ "%4 = c5\n\t"
+ : "=r"(pregs->pregs.p0), "=r"(pregs->pregs.p1),
+ "=r"(pregs->pregs.p2), "=r"(pregs->pregs.p3), "=r"(c5)
+ : "r"(cval_pair)
+ : "p0", "p1", "p2", "p3");
+
check(c5, 0xdeadbeef);
}
--
2.17.1
next prev parent reply other threads:[~2022-03-12 20:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-12 20:13 [PULL v2 00/12] Hexagon (target/hexagon) queue Taylor Simpson
2022-03-12 20:13 ` [PULL v2 01/12] Hexagon (target/hexagon) fix bug in circular addressing Taylor Simpson
2022-03-12 20:13 ` [PULL v2 02/12] Hexagon HVX (target/hexagon) fix bug in HVX saturate instructions Taylor Simpson
2022-03-12 20:13 ` [PULL v2 03/12] Hexagon (target/hexagon) properly set FPINVF bit in sfcmp.uo and dfcmp.uo Taylor Simpson
2022-03-12 20:13 ` [PULL v2 04/12] Hexagon (target/hexagon) properly handle denorm in arch_sf_recip_common Taylor Simpson
2022-03-12 20:13 ` [PULL v2 05/12] Hexagon (target/hexagon) properly handle NaN in dfmin/dfmax/sfmin/sfmax Taylor Simpson
2022-03-12 20:13 ` [PULL v2 06/12] Hexagon (tests/tcg/hexagon) test instructions that might set bits in USR Taylor Simpson
2022-03-12 20:13 ` [PULL v2 07/12] Hexagon (tests/tcg/hexagon) add floating point instructions to usr.c Taylor Simpson
2022-03-12 20:13 ` [PULL v2 08/12] Hexagon (tests/tcg/hexagon) update overflow test Taylor Simpson
2022-03-12 20:13 ` Taylor Simpson [this message]
2022-03-12 20:13 ` [PULL v2 10/12] Hexagon (target/hexagon) fix bug in conv_df2uw_chop Taylor Simpson
2022-03-12 20:13 ` [PULL v2 11/12] Hexagon (target/hexagon) assignment to c4 should wait until packet commit Taylor Simpson
2022-03-12 20:13 ` [PULL v2 12/12] target/hexagon: remove unused variable Taylor Simpson
2022-03-14 13:22 ` [PULL v2 00/12] Hexagon (target/hexagon) queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220312201319.29040-10-tsimpson@quicinc.com \
--to=tsimpson@quicinc.com \
--cc=f4bug@amsat.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=zongyuan.li@smartx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).