diff options
author | Michael Forney <mforney@mforney.org> | 2019-07-03 00:16:16 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-07-03 02:40:53 -0700 |
commit | d875bf74986b87378f80d7be4cd08e8eb8e91c65 (patch) | |
tree | 605f5b0b3339a9f9c049d63cb796f2d44f48ef15 /test/while-condition.qbe | |
parent | 94ff44d9f3df0ce081bd66c5ebebee660608342b (diff) |
Convert controlling expression of loops to bool
Diffstat (limited to 'test/while-condition.qbe')
-rw-r--r-- | test/while-condition.qbe | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/while-condition.qbe b/test/while-condition.qbe new file mode 100644 index 0000000..23b3b15 --- /dev/null +++ b/test/while-condition.qbe @@ -0,0 +1,23 @@ +export +function w $main() { +@start.1 + %.1 =l alloc8 8 +@body.2 + %.2 =l add %.1, 0 + %.3 =d swtof 1 + stored %.3, %.2 +@while_cond.3 + %.4 =d loadd %.1 + %.5 =w cned %.4, d_0 + jnz %.5, @while_body.4, @while_join.5 +@while_body.4 + %.6 =d loadd %.1 + %.7 =d swtof 2 + %.8 =d div %.6, %.7 + stored %.8, %.1 + jmp @while_cond.3 +@while_join.5 + %.9 =d loadd %.1 + %.10 =w dtosi %.9 + ret %.10 +} |