On 11/20/24 19:49, Anton Johansson 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 <a...@rev.ng>
---
accel/tcg/tcg-runtime.c | 29 +++++++++++++++++++++++++++++
accel/tcg/tcg-runtime.h | 5 +++++
2 files changed, 34 insertions(+)
For things in tcg-runtime.c, we generally have wrapper functions in
include/tcg/tcg-op-common.h which hide the fact that the operation is being expanded by a
helper.
We would also have tcg_gen_bitreverse{8,16,32}_i64, and *_tl macros in
include/tcg/tcg-op.h.
I've been meaning to add something like these for a while, because they are common to
quite a few targets.
+uint32_t HELPER(bitreverse8_i32)(uint32_t x)
+{
+ return revbit8((uint8_t) x);
+}
Also common is bit-reversing every byte in the word, not just the lowest.
Worth implementing both? Or simply zero-extending the input/output when the target only
requires the lowest byte?
We might want to audit the other targets to determine which forms are used...
r~