summaryrefslogtreecommitdiff
path: root/tests/inlineasm/asmsum.py
diff options
context:
space:
mode:
authorAlessandro Gatti <a.gatti@frob.it>2024-08-20 07:21:55 +0200
committerAlessandro Gatti <a.gatti@frob.it>2025-01-01 10:44:50 +0100
commita5270c84cfdab6136d0dd4e63d41007f9a37b108 (patch)
tree2d7a26eccb35c85941fb511f2b7640eddd90f071 /tests/inlineasm/asmsum.py
parentc73204128e16cfa62abd42b07981bd8e5adeb321 (diff)
tests/inlineasm: Make room for RV32IMC inline asm tests.
Thumb/Thumb2 tests are now into their own subdirectory, as RV32IMC-specific tests will be added as part of the RV32 inline assembler support. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Diffstat (limited to 'tests/inlineasm/asmsum.py')
-rw-r--r--tests/inlineasm/asmsum.py61
1 files changed, 0 insertions, 61 deletions
diff --git a/tests/inlineasm/asmsum.py b/tests/inlineasm/asmsum.py
deleted file mode 100644
index 51613ef6a..000000000
--- a/tests/inlineasm/asmsum.py
+++ /dev/null
@@ -1,61 +0,0 @@
-@micropython.asm_thumb
-def asm_sum_words(r0, r1):
- # r0 = len
- # r1 = ptr
- # r2 = sum
- # r3 = dummy
- mov(r2, 0)
-
- b(loop_entry)
-
- label(loop1)
- ldr(r3, [r1, 0])
- add(r2, r2, r3)
-
- add(r1, r1, 4)
- sub(r0, r0, 1)
-
- label(loop_entry)
- cmp(r0, 0)
- bgt(loop1)
-
- mov(r0, r2)
-
-
-@micropython.asm_thumb
-def asm_sum_bytes(r0, r1):
- # r0 = len
- # r1 = ptr
- # r2 = sum
- # r3 = dummy
- mov(r2, 0)
-
- b(loop_entry)
-
- label(loop1)
- ldrb(r3, [r1, 0])
- add(r2, r2, r3)
-
- add(r1, r1, 1)
- sub(r0, r0, 1)
-
- label(loop_entry)
- cmp(r0, 0)
- bgt(loop1)
-
- mov(r0, r2)
-
-
-import array
-
-b = array.array("l", (100, 200, 300, 400))
-n = asm_sum_words(len(b), b)
-print(b, n)
-
-b = array.array("b", (10, 20, 30, 40, 50, 60, 70, 80))
-n = asm_sum_bytes(len(b), b)
-print(b, n)
-
-b = b"\x01\x02\x03\x04"
-n = asm_sum_bytes(len(b), b)
-print(b, n)