aboutsummaryrefslogtreecommitdiff
path: root/test/_gcm1.ssa
diff options
context:
space:
mode:
Diffstat (limited to 'test/_gcm1.ssa')
-rw-r--r--test/_gcm1.ssa48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/_gcm1.ssa b/test/_gcm1.ssa
new file mode 100644
index 0000000..719cddb
--- /dev/null
+++ b/test/_gcm1.ssa
@@ -0,0 +1,48 @@
+export
+function w $ifmv(w %p1, w %p2, w %p3) {
+@start
+@entry
+ %rt =w add %p2, %p3 # gcm moves to @true
+ %rf =w sub %p2, %p3 # gcm moves to @false
+ jnz %p1, @true, @false
+@true
+ %r =w copy %rt
+ jmp @exit
+@false
+ %r =w copy %rf
+ jmp @exit
+@exit
+ ret %r
+}
+
+export
+function w $hoist1(w %p1, w %p2, w %p3) {
+@start
+@entry
+ %n =w copy 0
+ %i =w copy %p1
+@loop
+ %base =w add %p2, %p3 # gcm moves to @exit
+ %i =w sub %i, 1
+ %n =w add %n, 1
+ jnz %i, @loop, @exit
+@exit
+ %r =w add %base, %n
+ ret %r
+}
+
+export
+function w $hoist2(w %p1, w %p2, w %p3) {
+@start
+@entry
+ %n =w copy 0
+ %i =w copy %p1
+@loop
+ %base =w add %p2, %p3 # gcm moves to @entry
+ %i =w sub %i, 1
+ %n =w add %n, %base
+ jnz %i, @loop, @exit
+@exit
+ %r =w add %base, %n
+ ret %r
+}