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