[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / arm-crc32.c
blobffa1555cc3dd3586b26cdc65f08331134c435074
1 // RUN: %clang_cc1 -triple armv8-none-linux-gnueabi -target-feature +crc \
2 // RUN: -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s
3 // RUN: %clang_cc1 -verify -emit-llvm-only -triple armv7-none-linux-gnueabi %s
5 int crc32b(int a, char b)
7 // expected-error@+1 {{'__builtin_arm_crc32b' needs target feature crc}}
8 return __builtin_arm_crc32b(a,b);
9 // CHECK: [[T0:%[0-9]+]] = zext i8 %b to i32
10 // CHECK: call i32 @llvm.arm.crc32b(i32 %a, i32 [[T0]])
13 int crc32cb(int a, char b)
15 return __builtin_arm_crc32cb(a,b);
16 // CHECK: [[T0:%[0-9]+]] = zext i8 %b to i32
17 // CHECK: call i32 @llvm.arm.crc32cb(i32 %a, i32 [[T0]])
20 int crc32h(int a, short b)
22 return __builtin_arm_crc32h(a,b);
23 // CHECK: [[T0:%[0-9]+]] = zext i16 %b to i32
24 // CHECK: call i32 @llvm.arm.crc32h(i32 %a, i32 [[T0]])
27 int crc32ch(int a, short b)
29 return __builtin_arm_crc32ch(a,b);
30 // CHECK: [[T0:%[0-9]+]] = zext i16 %b to i32
31 // CHECK: call i32 @llvm.arm.crc32ch(i32 %a, i32 [[T0]])
34 int crc32w(int a, int b)
36 return __builtin_arm_crc32w(a,b);
37 // CHECK: call i32 @llvm.arm.crc32w(i32 %a, i32 %b)
40 int crc32cw(int a, int b)
42 return __builtin_arm_crc32cw(a,b);
43 // CHECK: call i32 @llvm.arm.crc32cw(i32 %a, i32 %b)
46 int crc32d(int a, long long b)
48 return __builtin_arm_crc32d(a,b);
49 // CHECK: [[T0:%[0-9]+]] = trunc i64 %b to i32
50 // CHECK: [[T1:%[0-9]+]] = lshr i64 %b, 32
51 // CHECK: [[T2:%[0-9]+]] = trunc i64 [[T1]] to i32
52 // CHECK: [[T3:%[0-9]+]] = call i32 @llvm.arm.crc32w(i32 %a, i32 [[T0]])
53 // CHECK: call i32 @llvm.arm.crc32w(i32 [[T3]], i32 [[T2]])
56 int crc32cd(int a, long long b)
58 return __builtin_arm_crc32cd(a,b);
59 // CHECK: [[T0:%[0-9]+]] = trunc i64 %b to i32
60 // CHECK: [[T1:%[0-9]+]] = lshr i64 %b, 32
61 // CHECK: [[T2:%[0-9]+]] = trunc i64 [[T1]] to i32
62 // CHECK: [[T3:%[0-9]+]] = call i32 @llvm.arm.crc32cw(i32 %a, i32 [[T0]])
63 // CHECK: call i32 @llvm.arm.crc32cw(i32 [[T3]], i32 [[T2]])