summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/asm-reg-var-local.c
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-07-26 22:17:02 +0000
committerEric Christopher <echristo@apple.com>2011-07-26 22:17:02 +0000
commit85e5156598b1bbad0ae41cf4d0d5b845dd655ffd (patch)
tree8e736c3910a6382135cfa8b92e760e6e64a72ac3 /clang/test/CodeGen/asm-reg-var-local.c
parent2dfed48caea09e0654b33a76cd9ff501c00ff7ec (diff)
downloadbcm5719-llvm-85e5156598b1bbad0ae41cf4d0d5b845dd655ffd.tar.gz
bcm5719-llvm-85e5156598b1bbad0ae41cf4d0d5b845dd655ffd.zip
Migrate most of the rest of test/FrontendC from llvm and migrate
most of them to FileCheck. llvm-svn: 136159
Diffstat (limited to 'clang/test/CodeGen/asm-reg-var-local.c')
-rw-r--r--clang/test/CodeGen/asm-reg-var-local.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/CodeGen/asm-reg-var-local.c b/clang/test/CodeGen/asm-reg-var-local.c
new file mode 100644
index 00000000000..435df2f7036
--- /dev/null
+++ b/clang/test/CodeGen/asm-reg-var-local.c
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
+// Exercise various use cases for local asm "register variables".
+
+int foo() {
+// CHECK: %a = alloca i32
+
+ register int a asm("rsi")=5;
+// CHECK: store i32 5, i32* %a
+
+ asm volatile("; %0 This asm defines rsi" : "=r"(a));
+// CHECK: %0 = call i32 asm sideeffect "; $0 This asm defines rsi", "={rsi},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: store i32 %0, i32* %a
+
+ a = 42;
+// CHECK: store i32 42, i32* %a
+
+ asm volatile("; %0 This asm uses rsi" : : "r"(a));
+// CHECK: %tmp = load i32* %a
+// CHECK: call void asm sideeffect "; $0 This asm uses rsi", "{rsi},~{dirflag},~{fpsr},~{flags}"(i32 %tmp)
+
+ return a;
+// CHECK: %tmp1 = load i32* %a
+// CHECK: ret i32 %tmp1
+}
OpenPOWER on IntegriCloud