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, i8* }
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, i32* %a.addr, align 4
24 store i32 %b, i32* %b.addr, align 4
25 %0 = load i32, i32* %a.addr, align 4
26 %1 = load i32, i32* %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, i32* %a.addr, align 4
32 %3 = load i32, i32* %b.addr, align 4
33 %add = add nsw i32 %2, %3
36 if.else: ; preds = %entry
37 %call = call i32 @setup(%struct.Data* %d)
38 %_d1 = getelementptr inbounds %struct.Data, %struct.Data* %d, i32 0, i32 0
39 %4 = load i32, i32* %_d1, align 4
40 %_d2 = getelementptr inbounds %struct.Data, %struct.Data* %d, i32 0, i32 1
41 %5 = load i8*, i8** %_d2, align 4
42 call void @llvm.eh.return.i32(i32 %4, i8* %5)
46 declare i32 @setup(%struct.Data*)
48 declare void @llvm.eh.return.i32(i32, i8*) nounwind