1 ; RUN: llc -O0 -march=hexagon < %s | FileCheck %s
2 ; Make sure we generate an exception handling return.
7 ; CHECK-NEXT: r29 = add(r29,r28)
10 ; CHECK-NEXT: jumpr r31
13 target datalayout = "e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:32:32-f64:64:64-f32:32:32-a0:0-n32"
14 target triple = "hexagon-unknown-linux-gnu"
16 %struct.Data = type { i32, ptr }
18 define i32 @test_eh_return(i32 %a, i32 %b) nounwind {
20 %a.addr = alloca i32, align 4
21 %b.addr = alloca i32, align 4
22 %d = alloca %struct.Data, align 4
23 store i32 %a, ptr %a.addr, align 4
24 store i32 %b, ptr %b.addr, align 4
25 %0 = load i32, ptr %a.addr, align 4
26 %1 = load i32, ptr %b.addr, align 4
27 %cmp = icmp sgt i32 %0, %1
28 br i1 %cmp, label %if.then, label %if.else
30 if.then: ; preds = %entry
31 %2 = load i32, ptr %a.addr, align 4
32 %3 = load i32, ptr %b.addr, align 4
33 %add = add nsw i32 %2, %3
36 if.else: ; preds = %entry
37 %call = call i32 @setup(ptr %d)
38 %4 = load i32, ptr %d, align 4
39 %_d2 = getelementptr inbounds %struct.Data, ptr %d, i32 0, i32 1
40 %5 = load ptr, ptr %_d2, align 4
41 call void @llvm.eh.return.i32(i32 %4, ptr %5)
45 declare i32 @setup(ptr)
47 declare void @llvm.eh.return.i32(i32, ptr) nounwind