aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/hexagon/test_clobber.S
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcg/hexagon/test_clobber.S')
-rw-r--r--tests/tcg/hexagon/test_clobber.S29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/tcg/hexagon/test_clobber.S b/tests/tcg/hexagon/test_clobber.S
new file mode 100644
index 0000000000..a7aeb2b60c
--- /dev/null
+++ b/tests/tcg/hexagon/test_clobber.S
@@ -0,0 +1,29 @@
+/*
+ * Purpose: demonstrate the succesful operation of the register save mechanism,
+ * in which the caller saves the registers that will be clobbered, and restores
+ * them after the call.
+ */
+
+ .text
+ .globl _start
+
+_start:
+ allocframe(#8)
+ {
+ r16 = #47
+ r17 = #155
+ }
+ memd(sp+#0) = r17:16
+ {
+ r16 = #255
+ r17 = #42
+ }
+ {
+ deallocframe
+ r17:16 = memd(sp+#0)
+ }
+ {
+ p0 = cmp.eq(r16, #47)
+ p0 = cmp.eq(r17, #155); if (p0.new) jump:t pass
+ jump fail
+ }