]> git.wh0rd.org - ICEs.git/blob - bfin-strcmp/test.i
initial import
[ICEs.git] / bfin-strcmp / test.i
1 typedef long unsigned int size_t;
2 extern int printf(__const char *__restrict __format, ...);
3 size_t errors = 0;
4 static void check(int thing, int number)
5 {
6 if (!thing)
7 ++errors;
8 }
9 int _strcmp(const char *cs, const char *ct)
10 {
11 int __res1, __res2;
12 __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");
13 return __res1;
14 }
15 void test_strcmp(void)
16 {
17 char buf1[0x40], buf2[0x40];
18 int i, j;
19 check(_strcmp(buf1 + i, buf2 + j) > 0, 2);
20 }
21 int main(int argc, char *argv[])
22 {
23 test_strcmp();
24 if (errors == 0) {
25 } else {
26 printf("TEST FAIL.\n");
27 }
28 }