]> git.wh0rd.org - ICEs.git/blame - bfin-strcmp/test.i.3
more
[ICEs.git] / bfin-strcmp / test.i.3
CommitLineData
45516216 1typedef long unsigned int size_t;
2extern int printf(__const char *__restrict __format, ...);
3size_t errors = 0;
4static void check(int thing, int number)
5{
6 if (!thing) {
7 ++errors;
8 }
9}
10int _strcmp(const char *cs, const char *ct)
11{
12 int __res1, __res2;
13 __asm__("1:\t%2 = B[%0++] (Z);\n\t" "%3 = B[%1++] (Z);\n\t" "CC = %2 == %3;\n\t" "if ! cc jump 2f;\n\t" "CC = %2;\n\t" "if cc jump 1b (bp);\n\t" "jump.s 3f;\n" "2:\t%2 = %2 - %3;\n" "3:\n": "+&a"(cs), "+&a"(ct), "=&d"(__res1), "=&d"(__res2): :"CC");
14 return __res1;
15}
16void test_strcmp(void)
17{
18 {
19 char buf1[0x40], buf2[0x40];
20 int i, j;
21 {
22 {
23 check(_strcmp(buf1 + i, buf2 + j) > 0, 2);
24 }
25 }
26 }
27}
28int main(int argc, char *argv[])
29{
30 test_strcmp();
31 if (errors == 0) {
32 } else {
33 printf("TEST FAIL.\n");
34 }
35}