PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr39804.c
blob3ff2479084f84802a54f58c694cd83540f5e46e3
1 /* { dg-do compile } */
2 /* { dg-require-effective-target ilp32 } */
3 /* { dg-options "-O" } */
5 typedef unsigned char u8;
6 struct __large_struct { unsigned long buf[100]; };
7 static inline __attribute__((always_inline)) unsigned long
8 __copy_from_user_inatomic(void *to, const void *from, unsigned long n)
10 unsigned long ret = 0;
11 asm volatile("1: mov""b"" %2,%""b""1\n" "2:\n"
12 ".section .fixup,\"ax\"\n"
13 "3: mov %3,%0\n"
14 " xor""b"" %""b""1,%""b""1\n"
15 " jmp 2b\n"
16 ".previous\n"
17 " .section __ex_table,\"a\"\n"
18 " " ".balign 4" " " "\n"
19 " " ".long" " " "1b" "," "3b" "\n"
20 " .previous\n"
21 : "=r" (ret), "=q"(*(u8 *)to)
22 : "m" ((*(struct __large_struct *)(from))), "i" (1), "0" (ret));
23 return ret;
25 void romchecksum(const unsigned char *rom, unsigned char c)
27 unsigned char sum;
28 for (sum = 0;
29 !__copy_from_user_inatomic(&(c), ( typeof(c) *)(rom++), sizeof(c));)
30 sum += c;