• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2; RUN: llc -O0 -stop-after=irtranslator -global-isel -verify-machineinstrs %s -o - | FileCheck %s
3
4target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
5target triple = "aarch64-apple-ios9.0"
6
7declare void @varargs(i32, double, i64, ...)
8define void @test_varargs() {
9  ; CHECK-LABEL: name: test_varargs
10  ; CHECK: bb.1 (%ir-block.0):
11  ; CHECK:   [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 42
12  ; CHECK:   [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.000000e+00
13  ; CHECK:   [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 12
14  ; CHECK:   [[C3:%[0-9]+]]:_(s8) = G_CONSTANT i8 3
15  ; CHECK:   [[C4:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
16  ; CHECK:   [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
17  ; CHECK:   [[C6:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
18  ; CHECK:   [[C7:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+00
19  ; CHECK:   ADJCALLSTACKDOWN 40, 0, implicit-def $sp, implicit $sp
20  ; CHECK:   $w0 = COPY [[C]](s32)
21  ; CHECK:   $d0 = COPY [[C1]](s64)
22  ; CHECK:   $x1 = COPY [[C2]](s64)
23  ; CHECK:   [[COPY:%[0-9]+]]:_(p0) = COPY $sp
24  ; CHECK:   [[C8:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
25  ; CHECK:   [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C8]](s64)
26  ; CHECK:   [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C3]](s8)
27  ; CHECK:   G_STORE [[ANYEXT]](s64), [[PTR_ADD]](p0) :: (store 8 into stack, align 1)
28  ; CHECK:   [[C9:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
29  ; CHECK:   [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C9]](s64)
30  ; CHECK:   [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT [[C4]](s16)
31  ; CHECK:   G_STORE [[ANYEXT1]](s64), [[PTR_ADD1]](p0) :: (store 8 into stack + 8, align 1)
32  ; CHECK:   [[C10:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
33  ; CHECK:   [[PTR_ADD2:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C10]](s64)
34  ; CHECK:   [[ANYEXT2:%[0-9]+]]:_(s64) = G_ANYEXT [[C5]](s32)
35  ; CHECK:   G_STORE [[ANYEXT2]](s64), [[PTR_ADD2]](p0) :: (store 8 into stack + 16, align 1)
36  ; CHECK:   [[C11:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
37  ; CHECK:   [[PTR_ADD3:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C11]](s64)
38  ; CHECK:   G_STORE [[C6]](s32), [[PTR_ADD3]](p0) :: (store 4 into stack + 24, align 1)
39  ; CHECK:   [[C12:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
40  ; CHECK:   [[PTR_ADD4:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C12]](s64)
41  ; CHECK:   G_STORE [[C7]](s64), [[PTR_ADD4]](p0) :: (store 8 into stack + 32, align 1)
42  ; CHECK:   BL @varargs, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $w0, implicit $d0, implicit $x1
43  ; CHECK:   ADJCALLSTACKUP 40, 0, implicit-def $sp, implicit $sp
44  ; CHECK:   RET_ReallyLR
45  call void(i32, double, i64, ...) @varargs(i32 42, double 1.0, i64 12, i8 3, i16 1, i32 4, float 1.0, double 2.0)
46  ret void
47}
48
49declare i64 @i8i16callee(i64 %a1, i64 %a2, i64 %a3, i8 signext %a4, i16 signext %a5, i64 %a6, i64 %a7, i64 %a8, i8 signext %b1, i16 signext %b2, i8 signext %b3, i8 signext %b4) nounwind readnone noinline
50
51define i32 @i8i16caller() nounwind readnone {
52  ; CHECK-LABEL: name: i8i16caller
53  ; CHECK: bb.1.entry:
54  ; CHECK:   [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
55  ; CHECK:   [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
56  ; CHECK:   [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
57  ; CHECK:   [[C3:%[0-9]+]]:_(s8) = G_CONSTANT i8 3
58  ; CHECK:   [[C4:%[0-9]+]]:_(s16) = G_CONSTANT i16 4
59  ; CHECK:   [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 5
60  ; CHECK:   [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 6
61  ; CHECK:   [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 7
62  ; CHECK:   [[C8:%[0-9]+]]:_(s8) = G_CONSTANT i8 97
63  ; CHECK:   [[C9:%[0-9]+]]:_(s16) = G_CONSTANT i16 98
64  ; CHECK:   [[C10:%[0-9]+]]:_(s8) = G_CONSTANT i8 99
65  ; CHECK:   [[C11:%[0-9]+]]:_(s8) = G_CONSTANT i8 100
66  ; CHECK:   ADJCALLSTACKDOWN 6, 0, implicit-def $sp, implicit $sp
67  ; CHECK:   $x0 = COPY [[C]](s64)
68  ; CHECK:   $x1 = COPY [[C1]](s64)
69  ; CHECK:   $x2 = COPY [[C2]](s64)
70  ; CHECK:   [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[C3]](s8)
71  ; CHECK:   $w3 = COPY [[SEXT]](s32)
72  ; CHECK:   [[SEXT1:%[0-9]+]]:_(s32) = G_SEXT [[C4]](s16)
73  ; CHECK:   $w4 = COPY [[SEXT1]](s32)
74  ; CHECK:   $x5 = COPY [[C5]](s64)
75  ; CHECK:   $x6 = COPY [[C6]](s64)
76  ; CHECK:   $x7 = COPY [[C7]](s64)
77  ; CHECK:   [[COPY:%[0-9]+]]:_(p0) = COPY $sp
78  ; CHECK:   [[C12:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
79  ; CHECK:   [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C12]](s64)
80  ; CHECK:   G_STORE [[C8]](s8), [[PTR_ADD]](p0) :: (store 1 into stack)
81  ; CHECK:   [[C13:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
82  ; CHECK:   [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C13]](s64)
83  ; CHECK:   G_STORE [[C9]](s16), [[PTR_ADD1]](p0) :: (store 2 into stack + 2, align 1)
84  ; CHECK:   [[C14:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
85  ; CHECK:   [[PTR_ADD2:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C14]](s64)
86  ; CHECK:   G_STORE [[C10]](s8), [[PTR_ADD2]](p0) :: (store 1 into stack + 4)
87  ; CHECK:   [[C15:%[0-9]+]]:_(s64) = G_CONSTANT i64 5
88  ; CHECK:   [[PTR_ADD3:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C15]](s64)
89  ; CHECK:   G_STORE [[C11]](s8), [[PTR_ADD3]](p0) :: (store 1 into stack + 5)
90  ; CHECK:   BL @i8i16callee, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2, implicit $w3, implicit $w4, implicit $x5, implicit $x6, implicit $x7, implicit-def $x0
91  ; CHECK:   [[COPY1:%[0-9]+]]:_(s64) = COPY $x0
92  ; CHECK:   ADJCALLSTACKUP 6, 0, implicit-def $sp, implicit $sp
93  ; CHECK:   [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
94  ; CHECK:   $w0 = COPY [[TRUNC]](s32)
95  ; CHECK:   RET_ReallyLR implicit $w0
96entry:
97  %call = tail call i64 @i8i16callee(i64 0, i64 1, i64 2, i8 signext 3, i16 signext 4, i64 5, i64 6, i64 7, i8 97, i16  98, i8  99, i8  100)
98  %conv = trunc i64 %call to i32
99  ret i32 %conv
100}
101
102