HomePhabricator

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

Description

[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

Details

Committed
karkaMay 16 2019, 12:18 AM
Reviewer
efriedma
Differential Revision
D61845: [builtin] Fixed definitions of builtins that rely on the int/long long type is 32/64 bits
Parents
rL360862: [PPC] Fix 32-bit build of libunwind
Branches
Unknown
Tags
Unknown