[llvm-bugs] [Bug 43309] New: __builtin_rotateright64 signature dropped 'unsigned' on last parameter in Clang 9

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 13 09:19:32 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43309

            Bug ID: 43309
           Summary: __builtin_rotateright64 signature dropped 'unsigned'
                    on last parameter in Clang 9
           Product: clang
           Version: 9.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mprice at synopsys.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

The signature for __builtin_rotateright64 changed in a way that looks
suspicious.

BUILTIN(__builtin_rotateleft8, "UcUcUc", "nc")
BUILTIN(__builtin_rotateleft16, "UsUsUs", "nc")
BUILTIN(__builtin_rotateleft32, "UZiUZiUZi", "nc")
BUILTIN(__builtin_rotateleft64, "UWiUWiUWi", "nc")
BUILTIN(__builtin_rotateright8, "UcUcUc", "nc")
BUILTIN(__builtin_rotateright16, "UsUsUs", "nc")
BUILTIN(__builtin_rotateright32, "UZiUZiUZi", "nc")
BUILTIN(__builtin_rotateright64, "UWiUWiWi", "nc")   // All the other rotate
builtins have a last parameter that is unsigned, and it did before this most
recent change to this line.


It appears to have happened in this commit:

commit c0478341937c33b16056e9ce28d6134afbd91693
Author: Karl-Johan Karlsson <karl-johan.karlsson at ericsson.com>
Date:   2019-05-16 07:18:02 +0000

    [builtin] Fixed definitions of builtins that rely on the int/long long type
is 32/64 bits

    Summary:
    The definition of the builtins __builtin_bswap32, __builtin_bitreverse32,
__builtin_rotateleft32 and __builtin_rotateright32 rely on that the int type is
32 bits wide on the target.
    The defintions of the builtins __builtin_bswap64, __builtin_bitreverse64,
__builtin_rotateleft64, and __builtin_rotateright64 rely on that the long long
type is 64 bits wide.

    On targets where this is not the case (e.g. AVR) clang will generate faulty
code (wrong llvm assembler intrinsics).

    This patch add support for using 'Z' (the int32_t type) in Bultins.def. The
builtins above are changed to be based on the int32_t type instead of the int
type, and the int64_t type instead of the long long type.

    The AVR backend (experimental) have a native int type that is only 16 bits
wide. The supplied testcase will therefore fail if running the testcase on
trunk as clang will convert e.g. __builtin_bitreverse32 into
llvm.bitreverse.i16 on AVR.

    Reviewers: dylanmckay, spatel, rsmith, efriedma

    Reviewed By: efriedma

    Differential Revision: https://reviews.llvm.org/D61845

    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360863
91177308-0d34-0410-b5e6-96231b3b80d8

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190913/f5bd5ca7/attachment.html>


More information about the llvm-bugs mailing list