aboutsummaryrefslogtreecommitdiffhomepage
path: root/ir.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 /ir.c
parent023692751f66866dfc72c48d288f33875faa65f0 (diff)
simpler handling of large constants in IR
Diffstat (limited to 'ir.c')
-rw-r--r--ir.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/ir.c b/ir.c
index 432a10d..c2abe12 100644
--- a/ir.c
+++ b/ir.c
@@ -150,11 +150,10 @@ mkintcon(enum irclass k, vlong i)
{
if (i < 1l << 28 && i >= -(1l << 28)) {
return mkref(RICON, i);
- } else if (k == KI4) {
- struct xcon con = { .cls = k, .i4 = i };
- return mkref(RXCON, addcon(&con));
} else {
- struct xcon con = { .cls = k, .i8 = i };
+ struct xcon con = { .cls = k, .i = i };
+ if (cls2siz[k] == 4) /* check upper half is zero or -1 */
+ assert(in_range((i >> 32) + 1, 0, 1));
return mkref(RXCON, addcon(&con));
}
}
@@ -162,9 +161,7 @@ mkintcon(enum irclass k, vlong i)
union ref
mkfltcon(enum irclass k, double f)
{
- struct xcon con = { .cls = k };
- if (k == KF4) con.fs = f;
- else con.fd = f;
+ struct xcon con = { .cls = k, .f = k == KF4 ? (float) f : f };
return mkref(RXCON, addcon(&con));
}