2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc -emit-llvm %s -o %t -arch=i386 &&
|
2009-03-10 14:33:24 +08:00
|
|
|
void t1(int len) {
|
2009-01-12 05:23:27 +08:00
|
|
|
__asm__ volatile("" : "=&r"(len), "+&r"(len));
|
2009-01-12 03:46:50 +08:00
|
|
|
}
|
2009-01-12 05:23:27 +08:00
|
|
|
|
2009-03-10 14:33:24 +08:00
|
|
|
void t2(unsigned long long t) {
|
2009-01-12 05:23:27 +08:00
|
|
|
__asm__ volatile("" : "+m"(t));
|
|
|
|
}
|
|
|
|
|
2009-03-10 14:33:24 +08:00
|
|
|
void t3(unsigned char *src, unsigned long long temp) {
|
2009-01-12 05:23:27 +08:00
|
|
|
__asm__ volatile("" : "+m"(temp), "+r"(src));
|
|
|
|
}
|
|
|
|
|
2009-03-10 14:33:24 +08:00
|
|
|
void t4() {
|
2009-01-12 10:22:13 +08:00
|
|
|
unsigned long long a;
|
|
|
|
struct reg { unsigned long long a, b; } b;
|
|
|
|
|
|
|
|
__asm__ volatile ("":: "m"(a), "m"(b));
|
|
|
|
}
|
2009-01-12 05:23:27 +08:00
|
|
|
|
2009-01-28 04:38:24 +08:00
|
|
|
// PR3417
|
2009-03-10 14:33:24 +08:00
|
|
|
void t5(int i) {
|
2009-01-28 04:38:24 +08:00
|
|
|
asm("nop" : "=r"(i) : "0"(t5));
|
|
|
|
}
|
2009-02-22 10:11:23 +08:00
|
|
|
|
|
|
|
// PR3641
|
2009-03-10 14:33:24 +08:00
|
|
|
void t6(void) {
|
2009-02-22 10:11:23 +08:00
|
|
|
__asm__ volatile("" : : "i" (t6));
|
|
|
|
}
|
2009-03-10 14:33:24 +08:00
|
|
|
|
2009-04-03 13:57:08 +08:00
|
|
|
// RUN: grep "T7 NAMED: \$1" %t &&
|
2009-03-10 14:33:24 +08:00
|
|
|
void t7(int a) {
|
|
|
|
__asm__ volatile("T7 NAMED: %[input]" : "+r"(a): [input] "i" (4));
|
2009-03-10 14:38:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// RUN: grep "T8 NAMED MODIFIER: \${0:c}" %t
|
|
|
|
void t8() {
|
|
|
|
__asm__ volatile("T8 NAMED MODIFIER: %c[input]" :: [input] "i" (4));
|
|
|
|
}
|
2009-03-10 14:42:37 +08:00
|
|
|
|
|
|
|
// PR3682
|
|
|
|
unsigned t9(unsigned int a) {
|
|
|
|
asm("bswap %0 %1" : "+r" (a));
|
|
|
|
return a;
|
|
|
|
}
|
2009-04-03 13:57:08 +08:00
|
|
|
|
|
|
|
// PR3908
|
|
|
|
// RUN: grep "PR3908 \$1 \$3 \$2 \$0" %t
|
|
|
|
void t10(int r) {
|
|
|
|
__asm__("PR3908 %[lf] %[xx] %[li] %[r]" : [r] "+r" (r) : [lf] "mx" (0), [li] "mr" (0), [xx] "x" ((double)(0)));
|
|
|
|
}
|