aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/linear/bitfield-init-zero.c
blob: 7a410a7c4eb095d9bd04c4ee4ff22fba4b209e83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
struct bfu {
	unsigned int a:11;
	unsigned int f:9;
	unsigned int  :2;
	unsigned int z:3;
};

struct bfu bfuu_init(unsigned int a)
{
	struct bfu bf = { .f = a, };
	return bf;
}

struct bfu bfus_init(int a)
{
	struct bfu bf = { .f = a, };
	return bf;
}

unsigned int bfu_get0(void)
{
	struct bfu bf = { };
	return bf.f;
}


struct bfs {
	signed int a:11;
	signed int f:9;
	signed int  :2;
	signed int z:3;
};

struct bfs bfsu_init(unsigned int a)
{
	struct bfs bf = { .f = a, };
	return bf;
}

struct bfs bfss_init(int a)
{
	struct bfs bf = { .f = a, };
	return bf;
}

int bfs_get0(void)
{
	struct bfs bf = { };
	return bf.f;
}

/*
 * check-name: bitfield implicit init zero
 * check-command: test-linearize -Wno-decl $file
 *
 * check-output-start
bfuu_init:
.L0:
	<entry-point>
	trunc.9     %r2 <- (32) %arg1
	shl.32      %r4 <- %r2, $11
	ret.32      %r4


bfus_init:
.L2:
	<entry-point>
	trunc.9     %r10 <- (32) %arg1
	shl.32      %r12 <- %r10, $11
	ret.32      %r12


bfu_get0:
.L4:
	<entry-point>
	ret.32      $0


bfsu_init:
.L6:
	<entry-point>
	trunc.9     %r23 <- (32) %arg1
	shl.32      %r25 <- %r23, $11
	ret.32      %r25


bfss_init:
.L8:
	<entry-point>
	trunc.9     %r31 <- (32) %arg1
	shl.32      %r33 <- %r31, $11
	ret.32      %r33


bfs_get0:
.L10:
	<entry-point>
	ret.32      $0


 * check-output-end
 */