summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/ms-setjmp.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-05-27 18:47:56 +0000
committerdim <dim@FreeBSD.org>2015-05-27 18:47:56 +0000
commit3191b2b32a96e1a6ee833fcca73e5c8e0c67ba65 (patch)
treedbbd4047878da71c1a706e26ce05b4e7791b14cc /test/CodeGen/ms-setjmp.c
parent38d6f2e7f2ce51a5b3836d26596c6c34a3288752 (diff)
downloadFreeBSD-src-3191b2b32a96e1a6ee833fcca73e5c8e0c67ba65.zip
FreeBSD-src-3191b2b32a96e1a6ee833fcca73e5c8e0c67ba65.tar.gz
Vendor import of clang trunk r238337:
https://llvm.org/svn/llvm-project/cfe/trunk@238337
Diffstat (limited to 'test/CodeGen/ms-setjmp.c')
-rw-r--r--test/CodeGen/ms-setjmp.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/CodeGen/ms-setjmp.c b/test/CodeGen/ms-setjmp.c
new file mode 100644
index 0000000..675c8dd
--- /dev/null
+++ b/test/CodeGen/ms-setjmp.c
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fms-extensions -DDECLARE_SETJMP -triple i686-windows-msvc -emit-llvm %s -o - | FileCheck --check-prefix=I386 %s
+// RUN: %clang_cc1 -fms-extensions -DDECLARE_SETJMP -triple x86_64-windows-msvc -emit-llvm %s -o - | FileCheck --check-prefix=X64 %s
+// RUN: %clang_cc1 -fms-extensions -triple i686-windows-msvc -emit-llvm %s -o - | FileCheck --check-prefix=I386 %s
+// RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc -emit-llvm %s -o - | FileCheck --check-prefix=X64 %s
+typedef char jmp_buf[1];
+
+#ifdef DECLARE_SETJMP
+int _setjmp(jmp_buf env);
+int _setjmpex(jmp_buf env);
+#endif
+
+jmp_buf jb;
+
+int test_setjmp() {
+ return _setjmp(jb);
+ // I386-LABEL: define i32 @test_setjmp
+ // I386: %[[call:.*]] = call i32 (i8*, i32, ...) @_setjmp3(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i32 0, i32 0), i32 0)
+ // I386-NEXT: ret i32 %[[call]]
+
+ // X64-LABEL: define i32 @test_setjmp
+ // X64: %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0)
+ // X64: %[[call:.*]] = call i32 @_setjmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i32 0, i32 0), i8* %[[addr]])
+ // X64-NEXT: ret i32 %[[call]]
+}
+
+int test_setjmpex() {
+ return _setjmpex(jb);
+ // X64-LABEL: define i32 @test_setjmpex
+ // X64: %[[addr:.*]] = call i8* @llvm.frameaddress(i32 0)
+ // X64: %[[call:.*]] = call i32 @_setjmpex(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @jb, i32 0, i32 0), i8* %[[addr]])
+ // X64-NEXT: ret i32 %[[call]]
+}
OpenPOWER on IntegriCloud