Skip to content

Commit 92146ce

Browse files
author
Erich Keane
committed
Re-fix _lrotl/_lrotr to always take Long, no matter the platform.
r355322 fixed this, however is being reverted due to concerns with enabling it in other modes. Change-Id: I6a939b7469b8fa196d5871a627eb2330dbd30f29 llvm-svn: 355698
1 parent 00a5b4a commit 92146ce

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

clang/include/clang/Basic/Builtins.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,12 +831,12 @@ LANGBUILTIN(_ReturnAddress, "v*", "n", ALL_MS_LANGUAGES)
831831
LANGBUILTIN(_rotl8, "UcUcUc", "n", ALL_MS_LANGUAGES)
832832
LANGBUILTIN(_rotl16, "UsUsUc", "n", ALL_MS_LANGUAGES)
833833
LANGBUILTIN(_rotl, "UiUii", "n", ALL_MS_LANGUAGES)
834-
LANGBUILTIN(_lrotl, "UNiUNii", "n", ALL_MS_LANGUAGES)
834+
LANGBUILTIN(_lrotl, "ULiULii", "n", ALL_MS_LANGUAGES)
835835
LANGBUILTIN(_rotl64, "UWiUWii", "n", ALL_MS_LANGUAGES)
836836
LANGBUILTIN(_rotr8, "UcUcUc", "n", ALL_MS_LANGUAGES)
837837
LANGBUILTIN(_rotr16, "UsUsUc", "n", ALL_MS_LANGUAGES)
838838
LANGBUILTIN(_rotr, "UiUii", "n", ALL_MS_LANGUAGES)
839-
LANGBUILTIN(_lrotr, "UNiUNii", "n", ALL_MS_LANGUAGES)
839+
LANGBUILTIN(_lrotr, "ULiULii", "n", ALL_MS_LANGUAGES)
840840
LANGBUILTIN(_rotr64, "UWiUWii", "n", ALL_MS_LANGUAGES)
841841
LANGBUILTIN(__va_start, "vc**.", "nt", ALL_MS_LANGUAGES)
842842
LANGBUILTIN(__fastfail, "vUi", "nr", ALL_MS_LANGUAGES)

clang/test/CodeGen/ms-intrinsics-rotations.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,10 @@
1212
// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
1313
// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
1414
// RUN: -triple x86_64--linux -emit-llvm %s -o - \
15-
// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
15+
// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT-LONG
1616
// RUN: %clang_cc1 -ffreestanding -fms-extensions \
1717
// RUN: -triple x86_64--darwin -emit-llvm %s -o - \
18-
// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
19-
20-
// LP64 targets use 'long' as 'int' for MS intrinsics (-fms-extensions)
21-
#ifdef __LP64__
22-
#define LONG int
23-
#else
24-
#define LONG long
25-
#endif
18+
// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT-LONG
2619

2720
// rotate left
2821

@@ -47,12 +40,15 @@ unsigned int test_rotl(unsigned int value, int shift) {
4740
// CHECK: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
4841
// CHECK: ret i32 [[R]]
4942

50-
unsigned LONG test_lrotl(unsigned LONG value, int shift) {
43+
unsigned long test_lrotl(unsigned long value, int shift) {
5144
return _lrotl(value, shift);
5245
}
5346
// CHECK-32BIT-LONG: i32 @test_lrotl
5447
// CHECK-32BIT-LONG: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
5548
// CHECK-32BIT-LONG: ret i32 [[R]]
49+
// CHECK-64BIT-LONG: i64 @test_lrotl
50+
// CHECK-64BIT-LONG: [[R:%.*]] = call i64 @llvm.fshl.i64(i64 [[X:%.*]], i64 [[X]], i64 [[Y:%.*]])
51+
// CHECK-64BIT-LONG: ret i64 [[R]]
5652

5753
unsigned __int64 test_rotl64(unsigned __int64 value, int shift) {
5854
return _rotl64(value, shift);
@@ -84,12 +80,15 @@ unsigned int test_rotr(unsigned int value, int shift) {
8480
// CHECK: [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
8581
// CHECK: ret i32 [[R]]
8682

87-
unsigned LONG test_lrotr(unsigned LONG value, int shift) {
83+
unsigned long test_lrotr(unsigned long value, int shift) {
8884
return _lrotr(value, shift);
8985
}
9086
// CHECK-32BIT-LONG: i32 @test_lrotr
9187
// CHECK-32BIT-LONG: [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
9288
// CHECK-32BIT-LONG: ret i32 [[R]]
89+
// CHECK-64BIT-LONG: i64 @test_lrotr
90+
// CHECK-64BIT-LONG: [[R:%.*]] = call i64 @llvm.fshr.i64(i64 [[X:%.*]], i64 [[X]], i64 [[Y:%.*]])
91+
// CHECK-64BIT-LONG: ret i64 [[R]]
9392

9493
unsigned __int64 test_rotr64(unsigned __int64 value, int shift) {
9594
return _rotr64(value, shift);

0 commit comments

Comments
 (0)