1; Verify that small structures and float arguments are passed in the
2; least significant part of a stack slot doubleword.
3
4; RUN: llc < %s | FileCheck %s
5
6target datalayout = "e-m:e-i64:64-n32:64"
7target triple = "powerpc64le-unknown-linux-gnu"
8
9%struct.large_arg = type { [8 x i64] }
10%struct.small_arg = type { i16, i8 }
11
12@gl = common global %struct.large_arg zeroinitializer, align 8
13@gs = common global %struct.small_arg zeroinitializer, align 2
14@gf = common global float 0.000000e+00, align 4
15
16define void @callee1(%struct.small_arg* noalias nocapture sret %agg.result, %struct.large_arg* byval nocapture readnone %pad, %struct.small_arg* byval nocapture readonly %x) {
17entry:
18  %0 = bitcast %struct.small_arg* %x to i32*
19  %1 = bitcast %struct.small_arg* %agg.result to i32*
20  %2 = load i32* %0, align 2
21  store i32 %2, i32* %1, align 2
22  ret void
23}
24; CHECK: @callee1
25; CHECK: lwz {{[0-9]+}}, 104(1)
26; CHECK: blr
27
28define void @caller1() {
29entry:
30  %tmp = alloca %struct.small_arg, align 2
31  call void @test1(%struct.small_arg* sret %tmp, %struct.large_arg* byval @gl, %struct.small_arg* byval @gs)
32  ret void
33}
34; CHECK: @caller1
35; CHECK: stw {{[0-9]+}}, 104(1)
36; CHECK: bl test1
37
38declare void @test1(%struct.small_arg* sret, %struct.large_arg* byval, %struct.small_arg* byval)
39
40define float @callee2(float %pad1, float %pad2, float %pad3, float %pad4, float %pad5, float %pad6, float %pad7, float %pad8, float %pad9, float %pad10, float %pad11, float %pad12, float %pad13, float %x) {
41entry:
42  ret float %x
43}
44; CHECK: @callee2
45; CHECK: lfs {{[0-9]+}}, 136(1)
46; CHECK: blr
47
48define void @caller2() {
49entry:
50  %0 = load float* @gf, align 4
51  %call = tail call float @test2(float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float %0)
52  ret void
53}
54; CHECK: @caller2
55; CHECK: stfs {{[0-9]+}}, 136(1)
56; CHECK: bl test2
57
58declare float @test2(float, float, float, float, float, float, float, float, float, float, float, float, float, float)
59
60