From 8d8cf6584bf4081b54cd91fcaa42578cbd794440 Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 14 Jun 2023 09:58:50 +0200 Subject: simpler handling of large constants in IR --- ir.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'ir.c') 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)); } -- cgit v1.2.3