[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / init-memset.c
blobe5fd86a74a546a54f3b20247d1bd60b684b2b84f
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -O0 -emit-llvm -o - %s | FileCheck %s
3 void use(void *);
5 void test_small(void) {
6 // CHECK-LABEL: define{{.*}} void @test_small()
7 int a[] = {1, 2, 3, 4};
8 // CHECK: call void @llvm.memcpy.{{.*}}
9 use(a);
12 void test_small_same(void) {
13 // CHECK-LABEL: define{{.*}} void @test_small_same()
14 char a[] = {'a', 'a', 'a', 'a'};
15 // CHECK: call void @llvm.memcpy.{{.*}}
16 use(a);
19 void test_different(void) {
20 // CHECK-LABEL: define{{.*}} void @test_different()
21 int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
22 // CHECK: call void @llvm.memcpy.{{.*}}
23 use(a);
26 void test_all_zeros(void) {
27 // CHECK-LABEL: define{{.*}} void @test_all_zeros()
28 int a[16] = {};
29 // CHECK: call void @llvm.memset.{{.*}}
30 use(a);
33 void test_all_a(void) {
34 // CHECK-LABEL: define{{.*}} void @test_all_a()
35 char a[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
36 // CHECK: call void @llvm.memcpy.{{.*}}
37 use(a);
40 void test_most_zeros(void) {
41 // CHECK-LABEL: define{{.*}} void @test_most_zeros()
42 int a[16] = {0, 0, 1};
43 // CHECK: call void @llvm.memset.{{.*}}
44 // CHECK: store i32 1
45 use(a);
48 void test_most_a(void) {
49 // CHECK-LABEL: define{{.*}} void @test_most_a()
50 char a[] = "aaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
51 // CHECK: call void @llvm.memcpy.{{.*}}
52 use(a);
55 void test_pointers(void) {
56 // CHECK-LABEL: define{{.*}} void @test_pointers()
57 void *a[] = {&use, &use, &use, &use, &use, &use};
58 // CHECK: call void @llvm.memcpy.{{.*}}
59 use(a);