blob: 710077d6edf286d827ac9eda00d80320968a7359 [file] [log] [blame]
Ulrich Weigand59c6ab22014-06-20 16:34:05 +00001; Verify that small structures and float arguments are passed in the
2; least significant part of a stack slot doubleword.
3
Ehsan Amiria538b0f2016-08-03 18:17:35 +00004; RUN: llc -verify-machineinstrs < %s | FileCheck %s
Ulrich Weigand59c6ab22014-06-20 16:34:05 +00005
6target datalayout = "E-m:e-i64:64-n32:64"
7target triple = "powerpc64-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*
David Blaikiea79ac142015-02-27 21:17:42 +000020 %2 = load i32, i32* %0, align 2
Ulrich Weigand59c6ab22014-06-20 16:34:05 +000021 store i32 %2, i32* %1, align 2
22 ret void
23}
24; CHECK: @callee1
25; CHECK: lwz {{[0-9]+}}, 124(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]+}}, 124(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]+}}, 156(1)
46; CHECK: blr
47
48define void @caller2() {
49entry:
David Blaikiea79ac142015-02-27 21:17:42 +000050 %0 = load float, float* @gf, align 4
Ulrich Weigand59c6ab22014-06-20 16:34:05 +000051 %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]+}}, 156(1)
56; CHECK: bl test2
57
58declare float @test2(float, float, float, float, float, float, float, float, float, float, float, float, float, float)
59