xref: /llvm-project/llvm/test/CodeGen/Hexagon/packetize-return-arg.ll (revision 2208c97c1bec2512d4e47b6223db6d95a7037956)
1; RUN: llc -mtriple=hexagon < %s | FileCheck %s
2; Check that "r0 = rN" is packetized together with dealloc_return.
3; CHECK: r0 = r
4; CHECK-NOT: {
5; CHECK: dealloc_return
6
7target triple = "hexagon-unknown--elf"
8
9; Function Attrs: nounwind
10define ptr @fred(ptr %user_context, i32 %x) #0 {
11entry:
12  %and14 = add i32 %x, 255
13  %add1 = and i32 %and14, -128
14  %call = tail call ptr @malloc(i32 %add1) #1
15  %cmp = icmp eq ptr %call, null
16  br i1 %cmp, label %cleanup, label %if.end
17
18if.end:                                           ; preds = %entry
19  %0 = ptrtoint ptr %call to i32
20  %sub4 = add i32 %0, 131
21  %and5 = and i32 %sub4, -128
22  %1 = inttoptr i32 %and5 to ptr
23  %2 = inttoptr i32 %and5 to ptr
24  %arrayidx = getelementptr inbounds ptr, ptr %2, i32 -1
25  store ptr %call, ptr %arrayidx, align 4
26  br label %cleanup
27
28cleanup:                                          ; preds = %if.end, %entry
29  %retval.0 = phi ptr [ %1, %if.end ], [ null, %entry ]
30  ret ptr %retval.0
31}
32
33; Function Attrs: nounwind
34declare noalias ptr @malloc(i32) local_unnamed_addr #1
35
36attributes #0 = { nounwind }
37attributes #1 = { nobuiltin nounwind }
38