From 620277c004b247559d53e4d6ef8053705be9b110 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Fri, 3 May 2024 21:48:02 +0200 Subject: [PATCH] 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. --- ssa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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;