Adrian Prantl | 1fd1403 | 2013-04-10 23:08:57 +0000 | [diff] [blame^] | 1 | // REQUIRES: mips-registered-target |
Jack Carter | 6700b00 | 2013-04-10 22:10:45 +0000 | [diff] [blame] | 2 | // RUN: %clang -target mipsel-unknown-linux -S -o - -emit-llvm %s \ |
| 3 | // RUN: | FileCheck %s |
| 4 | |
| 5 | // This checks that the frontend will accept inline asm operand modifiers |
| 6 | |
| 7 | #include "stdio.h" |
| 8 | |
| 9 | // CHECK: %{{[0-9]+}} = call i32 asm ".set noreorder;\0Alw $0,$1;\0A.set reorder;\0A", "=r,*m"(i32* getelementptr inbounds ([8 x i32]* @b, i32 {{[0-9]+}}, i32 {{[0-9]+}})) #2, !srcloc !0 |
| 10 | // CHECK: %{{[0-9]+}} = call i32 asm "lw $0,${1:D};\0A", "=r,*m"(i32* getelementptr inbounds ([8 x i32]* @b, i32 {{[0-9]+}}, i32 {{[0-9]+}})) #2, !srcloc !1 |
| 11 | int b[8] = {0,1,2,3,4,5,6,7}; |
| 12 | int main() |
| 13 | { |
| 14 | int i; |
| 15 | |
| 16 | // The first word. Notice, no 'D' |
| 17 | {asm ( |
| 18 | ".set noreorder;\n" |
| 19 | "lw %0,%1;\n" |
| 20 | ".set reorder;\n" |
| 21 | : "=r" (i) |
| 22 | : "m" (*(b+4)));} |
| 23 | |
| 24 | printf("%d\n",i); |
| 25 | |
| 26 | // The second word |
| 27 | {asm ( |
| 28 | "lw %0,%D1;\n" |
| 29 | : "=r" (i) |
| 30 | : "m" (*(b+4)) |
| 31 | );} |
| 32 | |
| 33 | printf("%d\n",i); |
| 34 | |
| 35 | return 1; |
| 36 | } |