| 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 -verify-machineinstrs < %s | FileCheck %s |
| 5 |
|
| 6 |
target datalayout = "e-m:e-i64:64-n32:64" |
| 7 |
target 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 |
|
| 16 |
define void @callee1(ptr noalias nocapture sret(%struct.small_arg) %agg.result, ptr byval(%struct.large_arg) nocapture readnone %pad, ptr byval(%struct.small_arg) nocapture readonly %x) { |
| 17 |
entry: |
| 18 |
%0 = load i32, ptr %x, align 2 |
| 19 |
store i32 %0, ptr %agg.result, align 2 |
| 20 |
ret void |
| 21 |
} |
| 22 |
; CHECK: @callee1 |
| 23 |
; CHECK: lwz {{[0-9]+}}, 104(1) |
| 24 |
; CHECK: blr |
| 25 |
|
| 26 |
define void @caller1() { |
| 27 |
entry: |
| 28 |
%tmp = alloca %struct.small_arg, align 2 |
| 29 |
call void @test1(ptr sret(%struct.small_arg) %tmp, ptr byval(%struct.large_arg) @gl, ptr byval(%struct.small_arg) @gs) |
| 30 |
ret void |
| 31 |
} |
| 32 |
; CHECK: @caller1 |
| 33 |
; CHECK: stw {{[0-9]+}}, 104(1) |
| 34 |
; CHECK: bl test1 |
| 35 |
|
| 36 |
declare void @test1(ptr sret(%struct.small_arg), ptr byval(%struct.large_arg), ptr byval(%struct.small_arg)) |
| 37 |
|
| 38 |
define 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) { |
| 39 |
entry: |
| 40 |
ret float %x |
| 41 |
} |
| 42 |
; CHECK: @callee2 |
| 43 |
; CHECK: lfs {{[0-9]+}}, 136(1) |
| 44 |
; CHECK: blr |
| 45 |
|
| 46 |
define void @caller2() { |
| 47 |
entry: |
| 48 |
%0 = load float, ptr @gf, align 4 |
| 49 |
%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) |
| 50 |
ret void |
| 51 |
} |
| 52 |
; CHECK: @caller2 |
| 53 |
; CHECK: stw {{[0-9]+}}, 136({{[0-9]+}}) |
| 54 |
; CHECK: bl test2 |
| 55 |
|
| 56 |
declare float @test2(float, float, float, float, float, float, float, float, float, float, float, float, float, float) |
| 57 |
|