12
12
// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
13
13
// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
14
14
// RUN: -triple x86_64--linux -emit-llvm %s -o - \
15
- // RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT -LONG
15
+ // RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT -LONG
16
16
// RUN: %clang_cc1 -ffreestanding -fms-extensions \
17
17
// RUN: -triple x86_64--darwin -emit-llvm %s -o - \
18
- // RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT-LONG
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
19
26
20
27
// rotate left
21
28
@@ -40,15 +47,12 @@ unsigned int test_rotl(unsigned int value, int shift) {
40
47
// CHECK: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
41
48
// CHECK: ret i32 [[R]]
42
49
43
- unsigned long test_lrotl (unsigned long value , int shift ) {
50
+ unsigned LONG test_lrotl (unsigned LONG value , int shift ) {
44
51
return _lrotl (value , shift );
45
52
}
46
53
// CHECK-32BIT-LONG: i32 @test_lrotl
47
54
// CHECK-32BIT-LONG: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
48
55
// 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]]
52
56
53
57
unsigned __int64 test_rotl64 (unsigned __int64 value , int shift ) {
54
58
return _rotl64 (value , shift );
@@ -80,15 +84,12 @@ unsigned int test_rotr(unsigned int value, int shift) {
80
84
// CHECK: [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
81
85
// CHECK: ret i32 [[R]]
82
86
83
- unsigned long test_lrotr (unsigned long value , int shift ) {
87
+ unsigned LONG test_lrotr (unsigned LONG value , int shift ) {
84
88
return _lrotr (value , shift );
85
89
}
86
90
// CHECK-32BIT-LONG: i32 @test_lrotr
87
91
// CHECK-32BIT-LONG: [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
88
92
// 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]]
92
93
93
94
unsigned __int64 test_rotr64 (unsigned __int64 value , int shift ) {
94
95
return _rotr64 (value , shift );
0 commit comments