blob: 2c3c01ac11e2f8e624451b2e00e66ed169ed4f33 [file] [log] [blame]
Jack Carter97102302013-03-05 19:10:54 +00001// RUN: %clang -target mipsel-unknown-linux -S -o - -emit-llvm %s \
2// RUN: | FileCheck %s
3
4// This checks that the frontend will accept inline asm memory constraints.
5
6int foo()
7{
8
9 // 'R': An address that can be used in a non-macro load or stor'
10 // This test will result in the higher and lower nibbles being
11 // switched due to the lwl/lwr instruction pairs.
Richard Smitheb54d422013-07-14 06:18:38 +000012 // CHECK: %{{[0-9]+}} = call i32 asm sideeffect "lwl $0, 1 + $1\0A\09lwr $0, 2 + $1\0A\09", "=r,*R"(i32* %{{[0-9,a-f]+}}) #1,
Jack Carter97102302013-03-05 19:10:54 +000013
14 int c = 0xffbbccdd;
15
16 int *p = &c;
17 int out = 0;
18
19 __asm volatile (
20 "lwl %0, 1 + %1\n\t"
21 "lwr %0, 2 + %1\n\t"
22 : "=r"(out)
23 : "R"(*p)
24 );
25 return 0;
26}