swar-sizeof.c
1.18 KB
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
////A: --has-swar
//C: -daiteq-swar-enable
typedef unsigned int s32x1b __attribute__((subword(1)));
typedef unsigned int s16x2b __attribute__((subword(2)));
typedef unsigned int s10x3b __attribute__((subword(3)));
typedef unsigned int s8x4b __attribute__((subword(4)));
typedef unsigned int s4x8b __attribute__((subword(8)));
typedef unsigned int s2x16b __attribute__((subword(16)));
void getsz_1b(int *so, int *sos)
{
if (so) *so = sizeof(s32x1b);
if (sos) *sos = sizeofswar(s32x1b);
}
void getsz_2b(int *so, int *sos)
{
if (so) *so = sizeof(s16x2b);
if (sos) *sos = sizeofswar(s16x2b);
}
void getsz_3b(int *so, int *sos)
{
if (so) *so = sizeof(s10x3b);
if (sos) *sos = sizeofswar(s10x3b);
}
void getsz_4b(int *so, int *sos)
{
if (so) *so = sizeof(s8x4b);
if (sos) *sos = sizeofswar(s8x4b);
}
void getsz_8b(int *so, int *sos)
{
if (so) *so = sizeof(s4x8b);
if (sos) *sos = sizeofswar(s4x8b);
}
void getsz_16b(int *so, int *sos)
{
if (so) *so = sizeof(s2x16b);
if (sos) *sos = sizeofswar(s2x16b);
}
int main(void)
{
int s, ss;
getsz_1b(&s, &ss);
getsz_2b(&s, &ss);
getsz_3b(&s, &ss);
getsz_4b(&s, &ss);
getsz_8b(&s, &ss);
getsz_16b(&s, &ss);
return 0;
}