r176506 - Mips specific inline assembler constraint 'R'
Jack Carter
jack.carter at imgtec.com
Tue Mar 5 11:10:55 PST 2013
Author: jacksprat
Date: Tue Mar 5 13:10:54 2013
New Revision: 176506
URL: http://llvm.org/viewvc/llvm-project?rev=176506&view=rev
Log:
Mips specific inline assembler constraint 'R'
'R' An address that can be sued in a non-macro load or store.
Including missing positive test case and fixed typo for r176453.
Thanks to Richard Smith for catching this!
Jack
Added:
cfe/trunk/test/CodeGen/mips-constraints-mem.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=176506&r1=176505&r2=176506&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Mar 5 13:10:54 2013
@@ -4487,7 +4487,7 @@ public:
case 'x': // hilo register pair
Info.setAllowsRegister();
return true;
- case 'R': // An address tha can be used in a non-macro load or store
+ case 'R': // An address that can be used in a non-macro load or store
Info.setAllowsMemory();
return true;
}
Added: cfe/trunk/test/CodeGen/mips-constraints-mem.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mips-constraints-mem.c?rev=176506&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/mips-constraints-mem.c (added)
+++ cfe/trunk/test/CodeGen/mips-constraints-mem.c Tue Mar 5 13:10:54 2013
@@ -0,0 +1,26 @@
+// RUN: %clang -target mipsel-unknown-linux -S -o - -emit-llvm %s \
+// RUN: | FileCheck %s
+
+// This checks that the frontend will accept inline asm memory constraints.
+
+int foo()
+{
+
+ // 'R': An address that can be used in a non-macro load or stor'
+ // This test will result in the higher and lower nibbles being
+ // switched due to the lwl/lwr instruction pairs.
+ // 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, !srcloc !0
+
+ int c = 0xffbbccdd;
+
+ int *p = &c;
+ int out = 0;
+
+ __asm volatile (
+ "lwl %0, 1 + %1\n\t"
+ "lwr %0, 2 + %1\n\t"
+ : "=r"(out)
+ : "R"(*p)
+ );
+ return 0;
+}
More information about the cfe-commits
mailing list