aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2024-05-03 21:48:02 +0200
committerQuentin Carbonneaux <[email protected]>2024-05-03 21:51:30 +0200
commit620277c004b247559d53e4d6ef8053705be9b110 (patch)
tree7ff2c50b850dd363083b007fa9caf0737011decb
parent1dd22a9b4741b668e9d63a98c95a102dc456634b (diff)
add width info for comparisons
Comparisons return a 1-bit value, in theory we could add a Wu1 width for them but I did not bother and just used Wub. This simply means that if a frontend generates an extsb of a comparison result (silly), we will not generate good code.
-rw-r--r--ssa.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ssa.c b/ssa.c
index 356135b..929301e 100644
--- a/ssa.c
+++ b/ssa.c
@@ -40,7 +40,7 @@ filluse(Fn *fn)
Blk *b;
Phi *p;
Ins *i;
- int m, t, tp, w;
+ int m, t, tp, w, x;
uint a;
Tmp *tmp;
@@ -84,6 +84,8 @@ filluse(Fn *fn)
w = Wsb + (i->op - Oloadsb);
if (isext(i->op))
w = Wsb + (i->op - Oextsb);
+ if (iscmp(i->op, &x, &x))
+ w = Wub;
if (w == Wsw || w == Wuw)
if (i->cls == Kw)
w = WFull;