From d875bf74986b87378f80d7be4cd08e8eb8e91c65 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Wed, 3 Jul 2019 00:16:16 -0700 Subject: Convert controlling expression of loops to bool --- test/while-condition.qbe | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/while-condition.qbe (limited to 'test/while-condition.qbe') 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 +} -- cgit v1.2.3