aboutsummaryrefslogtreecommitdiff
path: root/tests/subtract-pointer.qbe
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-02-14 01:18:40 -0800
committerMichael Forney <mforney@mforney.org>2019-02-14 01:18:40 -0800
commit22338bdfd0346e85a0e88ca5470302a4775e9054 (patch)
treee8924419046fbd909d1c9e559a30e62ffa7b4cf6 /tests/subtract-pointer.qbe
parent3206949a9f5fda4683362ca2adead62cc3de508b (diff)
When subtracting pointers, divide after subtraction
The pointers might be global addresses, and it doesn't make sense to divide them before subtracting.
Diffstat (limited to 'tests/subtract-pointer.qbe')
-rw-r--r--tests/subtract-pointer.qbe9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/subtract-pointer.qbe b/tests/subtract-pointer.qbe
index 9e49d9c..0e7e9a3 100644
--- a/tests/subtract-pointer.qbe
+++ b/tests/subtract-pointer.qbe
@@ -8,10 +8,9 @@ function $f(l %.1, l %.3) {
@body.2
%.5 =l loadl %.2
%.6 =l copy %.5
- %.7 =l udiv %.6, 4
- %.8 =l loadl %.4
- %.9 =l copy %.8
- %.10 =l udiv %.9, 4
- %.11 =l sub %.7, %.10
+ %.7 =l loadl %.4
+ %.8 =l copy %.7
+ %.9 =l sub %.6, %.8
+ %.10 =l div %.9, 4
ret
}