1 // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm < %s| FileCheck %s 2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm < %s| FileCheck %s 3 // RUN: %clang_cc1 -triple x86_64-windows -emit-llvm < %s| FileCheck %s 4 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -emit-llvm < %s| FileCheck %s 5 // RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm < %s| FileCheck %s 6 7 // RUN: %clang_cc1 -triple aarch64-unknown-unknown -emit-llvm-only -verify %s 8 // RUN: %clang_cc1 -triple mips-unknown-unknown -emit-llvm-only -verify %s 9 // RUN: %clang_cc1 -triple mips64-unknown-unknown -emit-llvm-only -verify %s 10 11 // Check that __builtin_longjmp and __builtin_setjmp are lowered into 12 // IR intrinsics on those architectures that can handle them. 13 // Check that an error is created otherwise. 14 15 typedef void *jmp_buf; 16 jmp_buf buf; 17 18 // CHECK: define{{.*}} void @do_jump() 19 // CHECK: call{{.*}} void @llvm.eh.sjlj.longjmp 20 21 // CHECK: define{{.*}} void @do_setjmp() 22 // CHECK: call{{.*}} i32 @llvm.eh.sjlj.setjmp 23 24 void do_jump(void) { 25 __builtin_longjmp(buf, 1); // expected-error {{__builtin_longjmp is not supported for the current target}} 26 } 27 28 void f(void); 29 30 void do_setjmp(void) { 31 if (!__builtin_setjmp(buf)) // expected-error {{__builtin_setjmp is not supported for the current target}} 32 f(); 33 } 34