aboutsummaryrefslogtreecommitdiffhomepage
path: root/c.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2023-06-14 09:58:50 +0200
committerlemon <lsof@mailbox.org>2023-06-14 10:00:47 +0200
commit8d8cf6584bf4081b54cd91fcaa42578cbd794440 (patch)
treefe9d36de11813a80e30fd71adce19ade0dd9d111 /c.c
parent023692751f66866dfc72c48d288f33875faa65f0 (diff)
simpler handling of large constants in IR
Diffstat (limited to 'c.c')
-rw-r--r--c.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/c.c b/c.c
index 022ef8a..fed56c3 100644
--- a/c.c
+++ b/c.c
@@ -1125,7 +1125,8 @@ cvt(struct function *fn, enum typetag to, enum typetag from, union ref ref)
}
else if (kfrom == KI4 && issignedt(from)) ins.op = Oexts4;
else if (kfrom == KI4) ins.op = Oextu4;
- else if (ref.t == RXCON && kfrom == KI8) return mkintcon(KI4, (int)(conht[ref.i].i8));
+ else if (kto == KI4 && isintcon(ref))
+ return issignedt(to) ? mkintcon(kto, (int)intconval(ref)) : mkintcon(kto, (uint)intconval(ref));
else ins.op = Ocopy;
}
return addinstr(fn, ins);