diff options
| author | 2026-03-02 17:52:57 +0100 | |
|---|---|---|
| committer | 2026-03-02 17:52:57 +0100 | |
| commit | f2285400e65dafe730a073b3ca92494d72c7295b (patch) | |
| tree | d5a96f09fbd0402ada3c39165a9d2d8202ee8e5d /ir/fold.c | |
| parent | a498f851ef2f50c9b8ac47e238137af52b54057d (diff) | |
add bswap16/32/64
- frontend: __builtin_bswapX intrinsics
- backend: ObswapX instructions
Diffstat (limited to 'ir/fold.c')
| -rw-r--r-- | ir/fold.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1,4 +1,5 @@ #include "ir.h" +#include "../endian.h" static union ref foldint(enum op op, enum irclass k, union ref lr, union ref rr) @@ -24,6 +25,9 @@ foldint(enum op op, enum irclass k, union ref lr, union ref rr) case Oextu16: x = (ushort)l.s; break; case Oexts32: x = (int)l.s; break; case Oextu32: x = (uint)l.s; break; + case Obswap16: x = bswap16(l.u); break; + case Obswap32: x = bswap32(l.u); break; + case Obswap64: x = bswap64(l.u); break; case Oadd: x = l.u + r.u; break; case Osub: x = l.u - r.u; break; case Omul: x = l.u * r.u; break; |