[libgcc PATCH] Add bit reversal functions __bitrev[qhsd]i2.

Roger Sayle roger@nextmovesoftware.com
Sat May 6 17:26:11 GMT 2023


This patch proposes adding run-time library support for bit reversal,
by adding a __bitrevsi2 function to libgcc.  Thoughts/opinions?

I'm also tempted to add __popcount[qh]i2 and __parity[qh]i2 to libgcc,
to allow the RTL optimizers to perform narrowing operations, but I'm
curious to hear whether QImode and HImode support, though more efficient,
is frowned by the libgcc maintainers/philosophy.

This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
and make -k check, both with and without --target_board=unix{-m32} and
on nvptx-none, with no new regressions.  Ok for mainline?


2023-05-06  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
        * doc/libgcc.texi (__bitrevqi2): Document bit reversal run-time
        functions; __bitrevqi2, __bitrevhi2, __bitrevsi2 and __bitrevdi2.

libgcc/ChangeLog
        * Makfile.in (lib2funcs): Add __bitrev[qhsd]i2.
        * libgcc-std.ver.in (GCC_14.0.0): Add __bitrev[qhsd]i2.
        * libgcc2.c (__bitrevqi2): New function.
        (__bitrevhi2): Likewise.
        (__bitrevsi2): Likewise.
        (__bitrevdi2): Likewise.
        * libgcc2.h (__bitrevqi2): Prototype here.
        (__bitrevhi2): Likewise.
        (__bitrevsi2): Likewise.
        (__bitrevdi2): Likewise.

Thanks in advance,
Roger
--

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patchlg.txt
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20230506/b213771e/attachment.txt>


More information about the Gcc-patches mailing list