1 // RUN: %clang_cc1 -fms-extensions -DDECLARE_SETJMP -triple i686-windows-msvc -emit-llvm %s -o - | FileCheck --check-prefix=I386 %s
2 // RUN: %clang_cc1 -fms-extensions -DDECLARE_SETJMP -triple x86_64-windows-msvc -emit-llvm %s -o - | FileCheck --check-prefix=X64 %s
3 // RUN: %clang_cc1 -fms-extensions -DDECLARE_SETJMP -triple aarch64-windows-msvc -emit-llvm %s -o - | FileCheck --check-prefix=AARCH64 %s
4 // RUN: %clang_cc1 -fms-extensions -triple i686-windows-msvc -Wno-implicit-function-declaration -emit-llvm %s -o - | FileCheck --check-prefix=I386 %s
5 // RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc -Wno-implicit-function-declaration -emit-llvm %s -o - | FileCheck --check-prefix=X64 %s
6 // RUN: %clang_cc1 -fms-extensions -triple aarch64-windows-msvc -Wno-implicit-function-declaration -emit-llvm %s -o - | FileCheck --check-prefix=AARCH64 %s
7 typedef char jmp_buf[1];
10 int _setjmp(jmp_buf env
);
11 int _setjmpex(jmp_buf env
);
16 int test_setjmp(void) {
18 // I386-LABEL: define dso_local i32 @test_setjmp
19 // I386: %[[call:.*]] = call i32 (ptr, i32, ...) @_setjmp3(ptr @jb, i32 0)
20 // I386-NEXT: ret i32 %[[call]]
22 // X64-LABEL: define dso_local i32 @test_setjmp
23 // X64: %[[addr:.*]] = call ptr @llvm.frameaddress.p0(i32 0)
24 // X64: %[[call:.*]] = call i32 @_setjmp(ptr @jb, ptr %[[addr]])
25 // X64-NEXT: ret i32 %[[call]]
27 // AARCH64-LABEL: define dso_local i32 @test_setjmp
28 // AARCH64: %[[addr:.*]] = call ptr @llvm.sponentry.p0()
29 // AARCH64: %[[call:.*]] = call i32 @_setjmpex(ptr @jb, ptr %[[addr]])
30 // AARCH64-NEXT: ret i32 %[[call]]
33 int test_setjmpex(void) {
35 // X64-LABEL: define dso_local i32 @test_setjmpex
36 // X64: %[[addr:.*]] = call ptr @llvm.frameaddress.p0(i32 0)
37 // X64: %[[call:.*]] = call i32 @_setjmpex(ptr @jb, ptr %[[addr]])
38 // X64-NEXT: ret i32 %[[call]]
40 // AARCH64-LABEL: define dso_local i32 @test_setjmpex
41 // AARCH64: %[[addr:.*]] = call ptr @llvm.sponentry.p0()
42 // AARCH64: %[[call:.*]] = call i32 @_setjmpex(ptr @jb, ptr %[[addr]])
43 // AARCH64-NEXT: ret i32 %[[call]]