Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / ms-intrinsics-rotations.c
blobb1bb2e6eb0011de0d96e0e89545a7255f65ab8ba
1 // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
2 // RUN: -triple i686--windows -emit-llvm %s -o - \
3 // RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
4 // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
5 // RUN: -triple thumbv7--windows -emit-llvm %s -o - \
6 // RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
7 // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
8 // RUN: -triple x86_64--windows -emit-llvm %s -o - \
9 // RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
10 // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
11 // RUN: -triple i686--linux -emit-llvm %s -o - \
12 // RUN: | FileCheck %s --check-prefixes CHECK,CHECK-32BIT-LONG
13 // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
14 // RUN: -triple x86_64--linux -emit-llvm %s -o - \
15 // RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT-LONG
16 // RUN: %clang_cc1 -ffreestanding -fms-extensions \
17 // RUN: -triple x86_64--darwin -emit-llvm %s -o - \
18 // RUN: | FileCheck %s --check-prefixes CHECK,CHECK-64BIT-LONG
20 // rotate left
22 unsigned char test_rotl8(unsigned char value, unsigned char shift) {
23 return _rotl8(value, shift);
25 // CHECK: i8 @test_rotl8
26 // CHECK: [[R:%.*]] = call i8 @llvm.fshl.i8(i8 [[X:%.*]], i8 [[X]], i8 [[Y:%.*]])
27 // CHECK: ret i8 [[R]]
29 unsigned short test_rotl16(unsigned short value, unsigned char shift) {
30 return _rotl16(value, shift);
32 // CHECK: i16 @test_rotl16
33 // CHECK: [[R:%.*]] = call i16 @llvm.fshl.i16(i16 [[X:%.*]], i16 [[X]], i16 [[Y:%.*]])
34 // CHECK: ret i16 [[R]]
36 unsigned int test_rotl(unsigned int value, int shift) {
37 return _rotl(value, shift);
39 // CHECK: i32 @test_rotl
40 // CHECK: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
41 // CHECK: ret i32 [[R]]
43 unsigned long test_lrotl(unsigned long value, int shift) {
44 return _lrotl(value, shift);
46 // CHECK-32BIT-LONG: i32 @test_lrotl
47 // CHECK-32BIT-LONG: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
48 // 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]]
53 unsigned __int64 test_rotl64(unsigned __int64 value, int shift) {
54 return _rotl64(value, shift);
56 // CHECK: i64 @test_rotl64
57 // CHECK: [[R:%.*]] = call i64 @llvm.fshl.i64(i64 [[X:%.*]], i64 [[X]], i64 [[Y:%.*]])
58 // CHECK: ret i64 [[R]]
60 // rotate right
62 unsigned char test_rotr8(unsigned char value, unsigned char shift) {
63 return _rotr8(value, shift);
65 // CHECK: i8 @test_rotr8
66 // CHECK: [[R:%.*]] = call i8 @llvm.fshr.i8(i8 [[X:%.*]], i8 [[X]], i8 [[Y:%.*]])
67 // CHECK: ret i8 [[R]]
69 unsigned short test_rotr16(unsigned short value, unsigned char shift) {
70 return _rotr16(value, shift);
72 // CHECK: i16 @test_rotr16
73 // CHECK: [[R:%.*]] = call i16 @llvm.fshr.i16(i16 [[X:%.*]], i16 [[X]], i16 [[Y:%.*]])
74 // CHECK: ret i16 [[R]]
76 unsigned int test_rotr(unsigned int value, int shift) {
77 return _rotr(value, shift);
79 // CHECK: i32 @test_rotr
80 // CHECK: [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
81 // CHECK: ret i32 [[R]]
83 unsigned long test_lrotr(unsigned long value, int shift) {
84 return _lrotr(value, shift);
86 // CHECK-32BIT-LONG: i32 @test_lrotr
87 // CHECK-32BIT-LONG: [[R:%.*]] = call i32 @llvm.fshr.i32(i32 [[X:%.*]], i32 [[X]], i32 [[Y:%.*]])
88 // 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]]
93 unsigned __int64 test_rotr64(unsigned __int64 value, int shift) {
94 return _rotr64(value, shift);
96 // CHECK: i64 @test_rotr64
97 // CHECK: [[R:%.*]] = call i64 @llvm.fshr.i64(i64 [[X:%.*]], i64 [[X]], i64 [[Y:%.*]])
98 // CHECK: ret i64 [[R]]