Skip to content

Enable rotate left/right tests on all platforms #6605

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions regression/cbmc/clang_builtins/rotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@
#define ror(type, x, d) \
((type)(((x) >> (d)) | ((x) << ((8 * sizeof(type)) - (d)))))

#ifdef __clang__
#ifndef __clang__
unsigned char __builtin_rotateleft8(unsigned char, unsigned char);
unsigned short __builtin_rotateleft16(unsigned short, unsigned short);
unsigned int __builtin_rotateleft32(unsigned int, unsigned int);
unsigned long long
__builtin_rotateleft64(unsigned long long, unsigned long long);

unsigned char __builtin_rotateright8(unsigned char, unsigned char);
unsigned short __builtin_rotateright16(unsigned short, unsigned short);
unsigned int __builtin_rotateright32(unsigned int, unsigned int);
unsigned long long
__builtin_rotateright64(unsigned long long, unsigned long long);
#endif

void check_left8(void)
{
uint8_t op;
Expand Down Expand Up @@ -80,11 +93,9 @@ void check_right64(void)
assert(__builtin_rotateright64(op, 3) == ror(uint64_t, op, 3));
assert(__builtin_rotateright64(op, 4) == ror(uint64_t, op, 4));
}
#endif

int main(void)
{
#ifdef __clang__
check_left8();
check_left16();
check_left32();
Expand All @@ -93,5 +104,4 @@ int main(void)
check_right16();
check_right32();
check_right64();
#endif
}
4 changes: 3 additions & 1 deletion regression/cbmc/clang_builtins/rotate.desc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CORE gcc-only
CORE
rotate.c

^VERIFICATION SUCCESSFUL$
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring