1 ; RUN: llc -march=arc < %s | FileCheck %s
4 declare i32 @goo1(i32) nounwind
8 define i32 @call1(i32 %a) nounwind {
10 %x = call i32 @goo1(i32 %a)
14 declare i32 @goo2(i32, i32, i32, i32, i32, i32, i32, i32) nounwind
17 ; CHECK-DAG: mov %r0, 0
18 ; CHECK-DAG: mov %r1, 1
19 ; CHECK-DAG: mov %r2, 2
20 ; CHECK-DAG: mov %r3, 3
21 ; CHECK-DAG: mov %r4, 4
22 ; CHECK-DAG: mov %r5, 5
23 ; CHECK-DAG: mov %r6, 6
24 ; CHECK-DAG: mov %r7, 7
26 define i32 @call2() nounwind {
28 %x = call i32 @goo2(i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7)
32 declare i32 @goo3(i64, i32, i64) nounwind
33 ; call goo3(0xEEEEEEEE77777777, 0x55555555, 0xAAAAAAAA33333333)
34 ; 0xEEEEEEEE == -286331154
35 ; 0x77777777 == 2004318071
36 ; 0x55555555 == 1431655765
37 ; 0xAAAAAAAA == -1431655766
38 ; 0x33333333 == 858993459
40 ; CHECK-DAG: mov %r0, 2004318071
41 ; CHECK-DAG: mov %r1, -286331154
42 ; CHECK-DAG: mov %r2, 1431655765
43 ; CHECK-DAG: mov %r3, 858993459
44 ; CHECK-DAG: mov %r4, -1431655766
46 define i32 @call3() nounwind {
48 %x = call i32 @goo3(i64 17216961133457930103,
50 i64 12297829380468716339)
56 ; 64-bit values are returned in r0r1
59 ; CHECK: lsr %r0, %r1, 16
60 define i32 @call4() nounwind {
63 %v = trunc i64 %v1 to i32
67 ; 0x0000ffff00ff00ff=281470698455295
68 ; returned as r0=0x00ff00ff=16711935, r1=0x0000ffff=65535
70 ; CHECK-DAG: mov %r1, 65535
71 ; CHECK-DAG: mov %r0, 16711935
72 define i64 @ret1() nounwind {
73 ret i64 281470698455295
76 @funcptr = external global ptr, align 4
77 ; Indirect calls use JL
78 ; CHECK-LABEL: call_indirect
79 ; CHECK-DAG: ld %r[[REG:[0-9]+]], [@funcptr]
80 ; CHECK-DAG: mov %r0, 12
81 ; CHECK: jl [%r[[REG]]]
82 define i32 @call_indirect(i32 %x) nounwind {
83 %f = load ptr, ptr @funcptr, align 4
84 %call = call i32 %f(i32 12)
85 %add = add nsw i32 %call, %x