diff options
author | Michael Forney <mforney@mforney.org> | 2021-06-30 11:42:45 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2021-06-30 17:14:08 -0700 |
commit | ede6a5c91cd7d41cd025b26946ae5edb7080aeb3 (patch) | |
tree | eb5738e808cdc0879a8d1bcf68214424a25b85ce /test/do-loop.qbe | |
parent | d181fcde9c1825ba5b6fe36f70c2b6e730c1f535 (diff) |
stmt: Check that controlling expression is a scalar, and drop unneeded conversion
The conversion is only needed for floating types. QBE isn't able
to optimize it away for integer types yet, so removing this unnecessary
conversion has a substantial performance benefit.
Diffstat (limited to 'test/do-loop.qbe')
-rw-r--r-- | test/do-loop.qbe | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/test/do-loop.qbe b/test/do-loop.qbe index 2f0e12a..0d383e4 100644 --- a/test/do-loop.qbe +++ b/test/do-loop.qbe @@ -9,22 +9,20 @@ function w $main() { @do_body.3 %.3 =w loadsw %.1 %.4 =w ceqw %.3, 1 - %.5 =w cnew %.4, 0 - jnz %.5, @if_true.6, @if_false.7 + jnz %.4, @if_true.6, @if_false.7 @if_true.6 jmp @do_cond.4 @if_false.7 - %.6 =w loadsw %.2 - %.7 =w add %.6, 1 - storew %.7, %.2 + %.5 =w loadsw %.2 + %.6 =w add %.5, 1 + storew %.6, %.2 @do_cond.4 - %.8 =w loadsw %.1 - %.9 =w sub %.8, 1 - storew %.9, %.1 - %.10 =w cnew %.8, 0 - jnz %.10, @do_body.3, @do_join.5 + %.7 =w loadsw %.1 + %.8 =w sub %.7, 1 + storew %.8, %.1 + jnz %.7, @do_body.3, @do_join.5 @do_join.5 - %.11 =w loadsw %.2 - %.12 =w cnew %.11, 2 - ret %.12 + %.9 =w loadsw %.2 + %.10 =w cnew %.9, 2 + ret %.10 } |