aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/xtensa/macros.inc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcg/xtensa/macros.inc')
-rw-r--r--tests/tcg/xtensa/macros.inc41
1 files changed, 36 insertions, 5 deletions
diff --git a/tests/tcg/xtensa/macros.inc b/tests/tcg/xtensa/macros.inc
index 4ebd30ab86..aa8f95bce8 100644
--- a/tests/tcg/xtensa/macros.inc
+++ b/tests/tcg/xtensa/macros.inc
@@ -23,11 +23,14 @@ main:
movi a0, result
sub a2, a2, a0
movi a3, 0
- loopnez a2, 1f
- l8ui a2, a0, 0
- or a3, a3, a2
- addi a0, a0, 1
+ beqz a2, 2f
1:
+ l8ui a1, a0, 0
+ or a3, a3, a1
+ addi a0, a0, 1
+ addi a2, a2, -1
+ bnez a2, 1b
+2:
exit
.endm
@@ -49,7 +52,9 @@ main:
.endm
.macro test name
- //print test_\name
+#ifdef DEBUG
+ print test_\name
+#endif
test_init
test_\name:
.global test_\name
@@ -74,6 +79,9 @@ test_\name:
l32i a2, a2, 0
movi a3, 1
s8i a3, a2, 0
+#ifdef DEBUG
+ print failed
+#endif
j 99f
.endm
@@ -89,3 +97,26 @@ test_\name:
movi a3, \addr
s32i a3, a2, 0
.endm
+
+.macro dump r
+#ifdef DEBUG
+.data
+.align 4
+1: .word 0
+.text
+ movi a4, 1b
+ s32i a2, a4, 0
+ movi a2, 4
+ movi a3, 1
+ movi a5, 4
+ simcall
+ movi a4, 1b
+ l32i a2, a4, 0
+#endif
+.endm
+
+#define glue(a, b) _glue(a, b)
+#define _glue(a, b) a ## b
+
+#define glue3(a, b, c) _glue3(a, b, c)
+#define _glue3(a, b, c) a ## b ## c