[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / clang / test / CodeGenCXX / auto-var-init-attr.cpp
blob5481c6e8613c568201a931a01016cb474af24c8c
1 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks -fdeclspec -ftrivial-auto-var-init=zero %s -emit-llvm -o - | FileCheck %s
3 struct S { char c; };
4 class C { char c; };
5 enum class E { ZERO };
6 union U { char c; int i; };
8 struct __declspec(no_init_all) NoInitS { char c; };
9 class __declspec(no_init_all) NoInitC { char c; };
10 enum class __declspec(no_init_all) NoInitE { ZERO };
11 union __declspec(no_init_all) NoInitU { char c; int i; };
13 extern "C" {
14 void test_no_attr() {
15 // CHECK-LABEL: @test_no_attr()
16 // CHECK-NEXT: entry:
17 // CHECK-NEXT: %s = alloca %struct.S, align 1
18 // CHECK-NEXT: %c = alloca %class.C, align 1
19 // CHECK-NEXT: %e = alloca i32, align 4
20 // CHECK-NEXT: %u = alloca %union.U, align 4
21 // CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 %s, i8 0, i64 1, i1 false)
22 // CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 %c, i8 0, i64 1, i1 false)
23 // CHECK-NEXT: store i32 0, ptr %e, align 4
24 // CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 %u, i8 0, i64 4, i1 false)
25 // CHECK-NEXT ret void
26 S s;
27 C c;
28 E e;
29 U u;
32 void __declspec(no_init_all) test_attr_on_function() {
33 // CHECK-LABEL: @test_attr_on_function()
34 // CHECK-NEXT: entry:
35 // CHECK-NEXT: %s = alloca %struct.S, align 1
36 // CHECK-NEXT: %c = alloca %class.C, align 1
37 // CHECK-NEXT: %e = alloca i32, align 4
38 // CHECK-NEXT: %u = alloca %union.U, align 4
39 // CHECK-NEXT: ret void
40 S s;
41 C c;
42 E e;
43 U u;
46 void test_attr_on_decl() {
47 // CHECK-LABEL: @test_attr_on_decl()
48 // CHECK-NEXT: entry:
49 // CHECK-NEXT: %s = alloca %struct.NoInitS, align 1
50 // CHECK-NEXT: %c = alloca %class.NoInitC, align 1
51 // CHECK-NEXT: %e = alloca i32, align 4
52 // CHECK-NEXT: %u = alloca %union.NoInitU, align 4
53 // CHECK-NEXT: ret void
54 NoInitS s;
55 NoInitC c;
56 NoInitE e;
57 NoInitU u;