public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/58872] New: RFC: more builtins for bit manipulation
@ 2013-10-25  9:29 yann at droneaud dot fr
  2013-10-25 10:15 ` [Bug c/58872] " glisse at gcc dot gnu.org
  2013-10-25 12:46 ` yann at droneaud dot fr
  0 siblings, 2 replies; 3+ messages in thread
From: yann at droneaud dot fr @ 2013-10-25  9:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58872

            Bug ID: 58872
           Summary: RFC: more builtins for bit manipulation
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yann at droneaud dot fr

Current bit manipulation builtins can be found in documentation:
http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#Other-Builtins

GCC could benefit of more bit manipulation builtins, for example:

- rotate bit right:

  __builtin_ror8(uint8_t v, int count)
  __builtin_ror16(uint16_t v, int count)
  __builtin_ror32(uint32_t v, int count)
  __builtin_ror64(uint64_t v, int count)

- rotate bit left:

  __builtin_rol8(uint8_t v, int count)
  __builtin_rol16(uint16_t v, int count)
  __builtin_rol32(uint32_t v, int count)
  __builtin_rol64(uint64_t v, int count)

- reverse bit string (bit swap):

  __builtin_brev8(uint8_t v, int index, int count)
  __builtin_brev16(uint16_t v, int index, int count)
  __builtin_brev32(uint32_t v, int index, int count)
  __builtin_brev64(uint64_t v, int index, int count)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/58872] RFC: more builtins for bit manipulation
  2013-10-25  9:29 [Bug c/58872] New: RFC: more builtins for bit manipulation yann at droneaud dot fr
@ 2013-10-25 10:15 ` glisse at gcc dot gnu.org
  2013-10-25 12:46 ` yann at droneaud dot fr
  1 sibling, 0 replies; 3+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-10-25 10:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58872

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
What do the arguments of brev mean?
Related to PR 50481.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/58872] RFC: more builtins for bit manipulation
  2013-10-25  9:29 [Bug c/58872] New: RFC: more builtins for bit manipulation yann at droneaud dot fr
  2013-10-25 10:15 ` [Bug c/58872] " glisse at gcc dot gnu.org
@ 2013-10-25 12:46 ` yann at droneaud dot fr
  1 sibling, 0 replies; 3+ messages in thread
From: yann at droneaud dot fr @ 2013-10-25 12:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58872

Yann Droneaud <yann at droneaud dot fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yann at droneaud dot fr

--- Comment #2 from Yann Droneaud <yann at droneaud dot fr> ---
(In reply to Marc Glisse from comment #1)
> What do the arguments of brev mean?
> Related to PR 50481.

The prototype for the reverse bit string builtin was designed to be useful to
reverse bits in a subset of a integer value, starting at "index" with "count"
bits.

The general use case is likely to reverse all bits in a variable, (uint64_t for
example):

    uint64_t v;
    __builtin_brev64(v, 0, sizeof(v) * 8);

But I thought it might be interesting to have a "more" general purpose builtin.

Actually, the builtin arguments for reverse should probably match what's
currently available on modern hardware.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-25 12:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-25  9:29 [Bug c/58872] New: RFC: more builtins for bit manipulation yann at droneaud dot fr
2013-10-25 10:15 ` [Bug c/58872] " glisse at gcc dot gnu.org
2013-10-25 12:46 ` yann at droneaud dot fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).