From 3964574a8325ab802f98856195b8214dcce3124c Mon Sep 17 00:00:00 2001 From: Bor Grošelj Simić Date: Fri, 28 Jan 2022 02:06:18 +0100 Subject: implement float -> unsigned casts amd64 lacks instruction for this so it has to be implemented with float -> signed casts. The approach is borrowed from llvm. --- fold.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fold.c') diff --git a/fold.c b/fold.c index 30e21d2..5d3c83c 100644 --- a/fold.c +++ b/fold.c @@ -387,7 +387,9 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr) case Oextsw: x = (int32_t)l.u; break; case Oextuw: x = (uint32_t)l.u; break; case Ostosi: x = w ? (int64_t)cl->bits.s : (int32_t)cl->bits.s; break; + case Ostoui: x = w ? (uint64_t)cl->bits.s : (uint32_t)cl->bits.s; break; case Odtosi: x = w ? (int64_t)cl->bits.d : (int32_t)cl->bits.d; break; + case Odtoui: x = w ? (uint64_t)cl->bits.d : (uint32_t)cl->bits.d; break; case Ocast: x = l.u; if (cl->type == CAddr) { -- cgit v1.2.3