1*f4a2713aSLionel Sambuc // REQUIRES: arm-registered-target
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple armv8-none-linux-gnueabi \
3*f4a2713aSLionel Sambuc // RUN: -O3 -S -emit-llvm -o - %s | FileCheck %s
4*f4a2713aSLionel Sambuc
crc32b(int a,char b)5*f4a2713aSLionel Sambuc int crc32b(int a, char b)
6*f4a2713aSLionel Sambuc {
7*f4a2713aSLionel Sambuc return __builtin_arm_crc32b(a,b);
8*f4a2713aSLionel Sambuc // CHECK: [[T0:%[0-9]+]] = zext i8 %b to i32
9*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.arm.crc32b(i32 %a, i32 [[T0]])
10*f4a2713aSLionel Sambuc }
11*f4a2713aSLionel Sambuc
crc32cb(int a,char b)12*f4a2713aSLionel Sambuc int crc32cb(int a, char b)
13*f4a2713aSLionel Sambuc {
14*f4a2713aSLionel Sambuc return __builtin_arm_crc32cb(a,b);
15*f4a2713aSLionel Sambuc // CHECK: [[T0:%[0-9]+]] = zext i8 %b to i32
16*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.arm.crc32cb(i32 %a, i32 [[T0]])
17*f4a2713aSLionel Sambuc }
18*f4a2713aSLionel Sambuc
crc32h(int a,short b)19*f4a2713aSLionel Sambuc int crc32h(int a, short b)
20*f4a2713aSLionel Sambuc {
21*f4a2713aSLionel Sambuc return __builtin_arm_crc32h(a,b);
22*f4a2713aSLionel Sambuc // CHECK: [[T0:%[0-9]+]] = zext i16 %b to i32
23*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.arm.crc32h(i32 %a, i32 [[T0]])
24*f4a2713aSLionel Sambuc }
25*f4a2713aSLionel Sambuc
crc32ch(int a,short b)26*f4a2713aSLionel Sambuc int crc32ch(int a, short b)
27*f4a2713aSLionel Sambuc {
28*f4a2713aSLionel Sambuc return __builtin_arm_crc32ch(a,b);
29*f4a2713aSLionel Sambuc // CHECK: [[T0:%[0-9]+]] = zext i16 %b to i32
30*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.arm.crc32ch(i32 %a, i32 [[T0]])
31*f4a2713aSLionel Sambuc }
32*f4a2713aSLionel Sambuc
crc32w(int a,int b)33*f4a2713aSLionel Sambuc int crc32w(int a, int b)
34*f4a2713aSLionel Sambuc {
35*f4a2713aSLionel Sambuc return __builtin_arm_crc32w(a,b);
36*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.arm.crc32w(i32 %a, i32 %b)
37*f4a2713aSLionel Sambuc }
38*f4a2713aSLionel Sambuc
crc32cw(int a,int b)39*f4a2713aSLionel Sambuc int crc32cw(int a, int b)
40*f4a2713aSLionel Sambuc {
41*f4a2713aSLionel Sambuc return __builtin_arm_crc32cw(a,b);
42*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.arm.crc32cw(i32 %a, i32 %b)
43*f4a2713aSLionel Sambuc }
44*f4a2713aSLionel Sambuc
crc32d(int a,long long b)45*f4a2713aSLionel Sambuc int crc32d(int a, long long b)
46*f4a2713aSLionel Sambuc {
47*f4a2713aSLionel Sambuc return __builtin_arm_crc32d(a,b);
48*f4a2713aSLionel Sambuc // CHECK: [[T0:%[0-9]+]] = trunc i64 %b to i32
49*f4a2713aSLionel Sambuc // CHECK: [[T1:%[0-9]+]] = lshr i64 %b, 32
50*f4a2713aSLionel Sambuc // CHECK: [[T2:%[0-9]+]] = trunc i64 [[T1]] to i32
51*f4a2713aSLionel Sambuc // CHECK: [[T3:%[0-9]+]] = tail call i32 @llvm.arm.crc32w(i32 %a, i32 [[T0]])
52*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.arm.crc32w(i32 [[T3]], i32 [[T2]])
53*f4a2713aSLionel Sambuc }
54*f4a2713aSLionel Sambuc
crc32cd(int a,long long b)55*f4a2713aSLionel Sambuc int crc32cd(int a, long long b)
56*f4a2713aSLionel Sambuc {
57*f4a2713aSLionel Sambuc return __builtin_arm_crc32cd(a,b);
58*f4a2713aSLionel Sambuc // CHECK: [[T0:%[0-9]+]] = trunc i64 %b to i32
59*f4a2713aSLionel Sambuc // CHECK: [[T1:%[0-9]+]] = lshr i64 %b, 32
60*f4a2713aSLionel Sambuc // CHECK: [[T2:%[0-9]+]] = trunc i64 [[T1]] to i32
61*f4a2713aSLionel Sambuc // CHECK: [[T3:%[0-9]+]] = tail call i32 @llvm.arm.crc32cw(i32 %a, i32 [[T0]])
62*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.arm.crc32cw(i32 [[T3]], i32 [[T2]])
63*f4a2713aSLionel Sambuc }
64