aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTaylor Simpson <tsimpson@quicinc.com>2022-02-09 18:15:56 -0800
committerTaylor Simpson <tsimpson@quicinc.com>2022-03-12 09:14:22 -0800
commitc0d86060f033fc8d591b0163e380ff6cd04f213a (patch)
tree2cdcbf0c3bc5425e35458d995a8362a112e23db3 /tests
parent3977ba3078503fca0f182aa8a39fad2388f43cb1 (diff)
downloadqemu-c0d86060f033fc8d591b0163e380ff6cd04f213a.zip
qemu-c0d86060f033fc8d591b0163e380ff6cd04f213a.tar.gz
qemu-c0d86060f033fc8d591b0163e380ff6cd04f213a.tar.bz2
Hexagon (target/hexagon) assignment to c4 should wait until packet commit
On Hexagon, c4 is an alias for predicate registers P3:0. If we assign to c4 inside a packet with reads from predicate registers, the predicate reads should get the old values. Test case added to tests/tcg/hexagon/preg_alias.c Co-authored-by: Michael Lambert <mlambert@cuicinc.com> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20220210021556.9217-13-tsimpson@quicinc.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/tcg/hexagon/preg_alias.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/tcg/hexagon/preg_alias.c b/tests/tcg/hexagon/preg_alias.c
index 79febec..b44a811 100644
--- a/tests/tcg/hexagon/preg_alias.c
+++ b/tests/tcg/hexagon/preg_alias.c
@@ -97,6 +97,42 @@ static inline void creg_alias_pair(unsigned int cval, PRegs *pregs)
check(c5, 0xdeadbeef);
}
+static void test_packet(void)
+{
+ /*
+ * Test that setting c4 inside a packet doesn't impact the predicates
+ * that are read during the packet.
+ */
+
+ int result;
+ int old_val = 0x0000001c;
+
+ /* Test a predicated register transfer */
+ result = old_val;
+ asm (
+ "c4 = %1\n\t"
+ "{\n\t"
+ " c4 = %2\n\t"
+ " if (!p2) %0 = %3\n\t"
+ "}\n\t"
+ : "+r"(result)
+ : "r"(0xffffffff), "r"(0xff00ffff), "r"(0x837ed653)
+ : "p0", "p1", "p2", "p3");
+ check(result, old_val);
+
+ /* Test a predicated store */
+ result = 0xffffffff;
+ asm ("c4 = %0\n\t"
+ "{\n\t"
+ " c4 = %1\n\t"
+ " if (!p2) memw(%2) = #0\n\t"
+ "}\n\t"
+ :
+ : "r"(0), "r"(0xffffffff), "r"(&result)
+ : "p0", "p1", "p2", "p3", "memory");
+ check(result, 0x0);
+}
+
int main()
{
int c4;
@@ -162,6 +198,8 @@ int main()
creg_alias_pair(0xffffffff, &pregs);
check(pregs.creg, 0xffffffff);
+ test_packet();
+
puts(err ? "FAIL" : "PASS");
return err;
}