diff options
-rw-r--r-- | test/strspn.ssa | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/test/strspn.ssa b/test/strspn.ssa new file mode 100644 index 0000000..a64ea19 --- /dev/null +++ b/test/strspn.ssa @@ -0,0 +1,77 @@ +# the C strspn function generated by scc + +export function w $strspn_(l %s1.81.val,l %s2.82.val) +{ +@.64 + %s1.81 =l alloc8 8 + %s2.82 =l alloc8 8 + %n.83 =l alloc4 4 + %c.84 =l alloc4 4 + %p.85 =l alloc8 8 + storel %s1.81.val,%s1.81 + storel %s2.82.val,%s2.82 + storew 0,%n.83 + jmp @.27 +@.28 + %.39 =l loadl %s2.82 + storel %.39,%p.85 + jmp @.29 +@.30 +@.31 + %.40 =l loadl %p.85 + %.41 =l add %.40,1 + storel %.41,%p.85 +@.29 + %.43 =l loadl %p.85 + %.44 =w loadsb %.43 + %.45 =w extsb %.44 + %.46 =w cnew %.45,0 + jnz %.46,@.42,@.36 +@.42 + %.47 =l loadl %p.85 + %.48 =w loadsb %.47 + %.49 =w extsb %.48 + %.50 =w loadsw %c.84 + %.51 =w cnew %.49,%.50 + jnz %.51,@.30,@.36 +@.36 +@.32 + %.52 =l loadl %p.85 + %.53 =w loadsb %.52 + %.54 =w extsb %.53 + %.55 =w cnew %.54,0 + jnz %.55,@.33,@.37 +@.37 + jmp @.34 +@.33 +@.35 + %.56 =w loaduw %n.83 + %.57 =w add %.56,1 + storew %.57,%n.83 +@.27 + %.58 =l loadl %s1.81 + %.59 =l add %.58,1 + storel %.59,%s1.81 + %.60 =w loadsb %.58 + %.61 =w extsb %.60 + storew %.61,%c.84 + %.62 =w cnew %.61,0 + jnz %.62,@.28,@.38 +@.38 +@.34 + %.63 =w loaduw %n.83 + ret %.63 +} + +# >>> driver +# extern unsigned strspn_(const char *, const char *); +# int main() { +# return !( +# strspn_("", "abc") == 0 && +# strspn_("abc", "") == 0 && +# strspn_("abc", "bac") == 3 && +# strspn_("xabc", "bac") == 0 && +# strspn_("axbc", "bca") == 1 +# ); +# } +# <<< |