1 // REQUIRES: hexagon-registered-target
2 // RUN: %clang_cc1 -emit-llvm -triple hexagon-unknown-linux-musl %s -o - | FileCheck %s
12 // CHECK: call void @llvm.va_start(ptr %arraydecay)
13 // CHECK: %arraydecay1 = getelementptr inbounds [1 x %struct.__va_list_tag],
14 // ptr %ap, i32 0, i32 0
15 // CHECK: br label %vaarg.maybe_reg
17 // CHECK: vaarg.maybe_reg: ; preds = %entry
18 // CHECK: %__current_saved_reg_area_pointer_p = getelementptr inbounds
19 // %struct.__va_list_tag, ptr %arraydecay2, i32 0, i32 0
20 // CHECK: %__current_saved_reg_area_pointer = load ptr, ptr
21 // %__current_saved_reg_area_pointer_p
22 // CHECK: %__saved_reg_area_end_pointer_p = getelementptr inbounds
23 // %struct.__va_list_tag, ptr %arraydecay2, i32 0, i32 1
24 // CHECK: %__saved_reg_area_end_pointer = load ptr, ptr
25 // %__saved_reg_area_end_pointer_p
26 // CHECK: %__new_saved_reg_area_pointer = getelementptr i8, ptr
27 // %__current_saved_reg_area_pointer, i32 4
28 // CHECK: %0 = icmp sgt ptr %__new_saved_reg_area_pointer,
29 // %__saved_reg_area_end_pointer
30 // CHECK: br i1 %0, label %vaarg.on_stack, label %vaarg.in_reg
32 // CHECK: vaarg.in_reg: ; preds =
34 // CHECK: store ptr %__new_saved_reg_area_pointer, ptr
35 // %__current_saved_reg_area_pointer_p
36 // CHECK: br label %vaarg.end
38 // CHECK: vaarg.on_stack: ; preds =
40 // CHECK: %__overflow_area_pointer_p = getelementptr inbounds
41 // %struct.__va_list_tag, ptr %arraydecay2, i32 0, i32 2
42 // CHECK: %__overflow_area_pointer = load ptr, ptr %__overflow_area_pointer_p
43 // CHECK: %__overflow_area_pointer.next = getelementptr i8, ptr
44 // %__overflow_area_pointer, i32 4
45 // CHECK: store ptr %__overflow_area_pointer.next, ptr
46 // %__overflow_area_pointer_p
47 // CHECK: store ptr %__overflow_area_pointer.next, ptr
48 // %__current_saved_reg_area_pointer_p
49 // CHECK: br label %vaarg.end
51 // CHECK: vaarg.end: ; preds =
52 // %vaarg.on_stack, %vaarg.in_reg
53 // CHECK: %vaarg.addr = phi ptr [ %__current_saved_reg_area_pointer, %vaarg.in_reg ], [ %__overflow_area_pointer, %vaarg.on_stack
55 // CHECK: %1 = load i32, ptr %vaarg.addr
57 struct AAA aaa
= {100, 200, 300, 400};
59 int foo(int xx
, ...) {
67 bbb
= va_arg(ap
, struct AAA
);
77 x
= foo(1, 2, aaa
, 4);