Re: [PATCH v2 01/50] accel/tcg: Add bitreverse and funnel-shift runtime helper functions
Philippe Mathieu-Daudé <[email protected]>
| Newsgroups | gmane.comp.emulators.qemu |
|---|---|
| Message-ID | <[email protected]> |
On 30/7/26 05:09, Anton Johansson via qemu development wrote: > Adds necessary helper functions for mapping LLVM IR onto TCG. > Specifically, helpers corresponding to the bitreverse and funnel-shift > intrinsics in LLVM. > > Note: these may be converted to more efficient implementations in the > future, but for the time being it allows helper-to-tcg to support a > wider subset of LLVM IR. > > Signed-off-by: Anton Johansson <[email protected]> > -- > TODO: `tcg_gen_*()` variants will be added in the next version, it > slipped through (Richard). > --- > accel/tcg/tcg-runtime.c | 28 ++++++++++++++++++++++++++++ > accel/tcg/tcg-runtime.h | 6 ++++++ > 2 files changed, 34 insertions(+) > +uint32_t HELPER(bitreverse8_i32)(uint32_t x) > +{ > + return revbit8((uint8_t) x); > +} > + > +uint32_t HELPER(bitreverse16_i32)(uint32_t x) > +{ > + return revbit16((uint16_t) x); > +} > + > +uint32_t HELPER(bitreverse32_i32)(uint32_t x) > +{ > + return revbit32(x); > +} Please split in 2 patches, adding bitreverse family in one, and fshl_i64 in another. For bitreverse: Reviewed-by: Philippe Mathieu-Daudé <[email protected]> > /* 64-bit helpers */ > > +uint64_t HELPER(fshl_i64)(uint64_t a, uint64_t b, uint64_t c) Please use clearer hi/lo/sh/val/ret instead of a/b/c/d/shift: HELPER(fshl_i64)(uint64_t hi, uint64_t lo, uint64_t sh) > +{ > + Int128 d = int128_make128(b, a); > + Int128 shift = int128_lshift(d, c); > + return int128_gethi(shift); > +}