[AArch64] Add fpext and fpround costs (#119292)
[llvm-project.git] / clang / test / CodeGen / partial-reinitialization1.c
blobd6f2f777705861878fb857c8699e1a6aae32aa36
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -emit-llvm -o - | FileCheck %s
3 struct P1 {
4 struct Q1 {
5 char a[6];
6 char b[6];
7 } q;
8 };
10 // CHECK: { [6 x i8] c"foo\00\00\00", [6 x i8] c"\00x\00\00\00\00" }
11 struct P1 l1 = {
12 (struct Q1){ "foo", "bar" },
13 .q.b = { "boo" },
14 .q.b = { [1] = 'x' }
17 // CHECK: { [6 x i8] c"foo\00\00\00", [6 x i8] c"bxo\00\00\00" }
18 struct P1 l1a = {
19 (struct Q1){ "foo", "bar" },
20 .q.b = { "boo" },
21 .q.b[1] = 'x'
25 struct P2 { char x[6]; };
27 // CHECK: { [6 x i8] c"n\00\00\00\00\00" }
28 struct P2 l2 = {
29 .x = { [1] = 'o' },
30 .x = { [0] = 'n' }
31 };
33 struct P3 {
34 struct Q3 {
35 struct R1 {
36 int a, b, c;
37 } r1;
39 struct R2 {
40 int d, e, f;
41 } r2;
42 } q;
45 // CHECK: @l3 ={{.*}} global %struct.P3 { %struct.Q3 { %struct.R1 { i32 1, i32 2, i32 3 }, %struct.R2 { i32 0, i32 10, i32 0 } } }
46 struct P3 l3 = {
47 (struct Q3){ { 1, 2, 3 }, { 4, 5, 6 } },
48 .q.r2 = { 7, 8, 9 },
49 .q.r2 = { .e = 10 }
52 // This bit is taken from Sema/wchar.c so we can avoid the wchar.h include.
53 typedef __WCHAR_TYPE__ wchar_t;
55 struct P4 {
56 wchar_t x[6];
59 // CHECK: { [6 x i32] [i32 102, i32 111, i32 120, i32 0, i32 0, i32 0] }
60 struct P4 l4 = { { L"foo" }, .x[2] = L'x' };
62 struct P5 {
63 int x;
64 struct Q5 {
65 int a, b, c;
66 } q;
67 int y;
70 // A three-pass test
71 // CHECK: @l5 ={{.*}} global %struct.P5 { i32 1, %struct.Q5 { i32 6, i32 9, i32 8 }, i32 5 }
72 struct P5 l5 = { 1, { 2, 3, 4 }, 5,
73 .q = { 6, 7, 8 },
74 .q.b = 9 };