diff options
author | Damien George <damien.p.george@gmail.com> | 2015-02-13 10:43:05 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-02-13 10:43:05 +0000 |
commit | 32f0b7942cf44b7a722db30c554cfc70d3f70289 (patch) | |
tree | 1215d637b956ce93d5c36dd2a4e2bd0bd6999882 /tests/inlineasm | |
parent | 0d967b8ae4f26815549aa2fb301e7bbaa5e262c2 (diff) | |
download | micropython-32f0b7942cf44b7a722db30c554cfc70d3f70289.tar.gz micropython-32f0b7942cf44b7a722db30c554cfc70d3f70289.zip |
py: Implement sdiv/udiv for inline Thumb assembler.
Diffstat (limited to 'tests/inlineasm')
-rw-r--r-- | tests/inlineasm/asmdiv.py | 16 | ||||
-rw-r--r-- | tests/inlineasm/asmdiv.py.exp | 7 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/inlineasm/asmdiv.py b/tests/inlineasm/asmdiv.py new file mode 100644 index 0000000000..b97d566eb5 --- /dev/null +++ b/tests/inlineasm/asmdiv.py @@ -0,0 +1,16 @@ +@micropython.asm_thumb +def sdiv(r0, r1): + sdiv(r0, r0, r1) + +@micropython.asm_thumb +def udiv(r0, r1): + udiv(r0, r0, r1) + +print(sdiv(1234, 3)) +print(sdiv(-1234, 3)) +print(sdiv(1234, -3)) +print(sdiv(-1234, -3)) + +print(udiv(1234, 3)) +print(udiv(0xffffffff, 0x7fffffff)) +print(udiv(0xffffffff, 0xffffffff)) diff --git a/tests/inlineasm/asmdiv.py.exp b/tests/inlineasm/asmdiv.py.exp new file mode 100644 index 0000000000..f1b80deb32 --- /dev/null +++ b/tests/inlineasm/asmdiv.py.exp @@ -0,0 +1,7 @@ +411 +-411 +-411 +411 +411 +2 +1 |