aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/hexagon/test_round.S
diff options
context:
space:
mode:
authorNiccolò Izzo <nizzo@rev.ng>2022-09-23 19:38:31 +0200
committerTaylor Simpson <tsimpson@quicinc.com>2022-12-16 12:30:28 -0800
commit585a86b1041a45c3b4074440c7f1b54944570867 (patch)
tree03f9d2c29c782da50ac2324c3298a2a1a4576826 /tests/tcg/hexagon/test_round.S
parente71fdc4f1bd5632f2d152a08cbecd82b5aa9e954 (diff)
target/hexagon: import additional tests
Signed-off-by: Alessandro Di Federico <ale@rev.ng> Signed-off-by: Niccolò Izzo <nizzo@rev.ng> Signed-off-by: Anton Johansson <anjo@rev.ng> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20220923173831.227551-12-anjo@rev.ng>
Diffstat (limited to 'tests/tcg/hexagon/test_round.S')
-rw-r--r--tests/tcg/hexagon/test_round.S29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/tcg/hexagon/test_round.S b/tests/tcg/hexagon/test_round.S
new file mode 100644
index 0000000000..3c83812fe8
--- /dev/null
+++ b/tests/tcg/hexagon/test_round.S
@@ -0,0 +1,29 @@
+/*
+ * Purpose: test example, verify the soundness of the cround operation
+ * 106 = 0b1101010 with the comma at third digit is 12.5 which is crounded to 12
+ * but rounded to 13.
+ */
+
+ .text
+ .globl _start
+
+_start:
+ {
+ r1 = #200
+ }
+ {
+ r2 = round(r1, #4)
+ }
+ {
+ p0 = cmp.eq(r2, #13); if (p0.new) jump:t test2
+ jump fail
+ }
+
+test2:
+ {
+ r2 = cround(r1, #4)
+ }
+ {
+ p0 = cmp.eq(r2, #12); if (p0.new) jump:t pass
+ jump fail
+ }