swar-c99-6.8.5.2-do_stmt.c
1.61 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
67
68
69
70
71
72
/* -----------------------------------------------------------------------------
* Copyright (C) 2018-2020 daiteq s.r.o. http://www.daiteq.com
*
* This program is distributed WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE.
*
* -----------------------------------------------------------------------------
* Filename : swar-c99-6.8.5.2-do_stmt.c
* Authors : Roman Bartosinski
* Description : simple test of clang/LLVM compiler with SWAR extension
* Release :
* Version :
* Date :
* -----------------------------------------------------------------------------
*/
//A: --has-swar
//C: -daiteq-swar-enable
#define SWAR_USE_UNSIGNED_TYPES
#define SWAR_USE_SIGNED_TYPES
#include "swar-c99.h"
// iteration statements: while, do-while, for
#define ARRAYSIZE 20
su10x3b v3u[ARRAYSIZE] = {
{0,1,2,3,4,5,6,7,0,1},
{0,1,2,3,4,0,1,2,3,4},
{1,1,1,4,4,4,4,7,7,7},
{7,6,5,4,3,2,1,0,7,6},
{0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1,1,1},
{2,2,2,2,2,2,2,2,2,2},
{3,3,3,3,3,3,3,3,3,3},
{4,4,4,4,4,4,4,4,4,4},
{5,5,5,5,5,5,5,5,5,5},
{6,6,6,6,6,6,6,6,6,6},
{7,7,7,7,7,7,7,7,7,7},
{0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1,1,1},
{2,2,2,2,2,2,2,2,2,2},
{3,3,3,3,3,3,3,3,3,3},
{4,4,4,4,4,4,4,4,4,4},
{5,5,5,5,5,5,5,5,5,5},
{6,6,6,6,6,6,6,6,6,6},
{7,7,7,7,7,7,7,7,7,7},
};
su10x3b accum10x3u = {0};
ss32x1b var32x1s;
int foo(void)
{
int i = 0;
while(i<ARRAYSIZE) {
accum10x3u += v3u[i];
i++;
}
int rc = *((int *)&accum10x3u);
return rc;
}
int main(void)
{
foo();
return 0;
}