diff options
author | Bor Grošelj Simić <bor.groseljsimic@telemach.net> | 2022-01-28 02:06:18 +0100 |
---|---|---|
committer | Quentin Carbonneaux <quentin@c9x.me> | 2022-01-28 09:24:15 +0100 |
commit | 3964574a8325ab802f98856195b8214dcce3124c (patch) | |
tree | 0ac6128a201088b186d642b990a02c6e78cf715a /fold.c | |
parent | 74d022f975f22fda20c0d1fe09a3f6fc7680f64f (diff) | |
download | roux-3964574a8325ab802f98856195b8214dcce3124c.tar.gz |
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.
Diffstat (limited to 'fold.c')
-rw-r--r-- | fold.c | 2 |
1 files changed, 2 insertions, 0 deletions
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) { |