blob: 8c2b6f4ba7808d18679429624ae4c1f405a96274 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* This test target increments a value 100 times. The patcher converts the
* inc instruction to a nop, so it only increments the value once.
*
*/
#include <minilib.h>
int main(void)
{
ml_printf("Running test...\n");
unsigned int x = 0;
for (int i = 0; i < 100; i++) {
asm volatile (
"inc %[x]"
: [x] "+a" (x)
);
}
ml_printf("Value: %d\n", x);
return 0;
}
|