Home | History | Annotate | Download | only in PowerPC
      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 
      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(%struct.small_arg* noalias nocapture sret %agg.result, %struct.large_arg* byval nocapture readnone %pad, %struct.small_arg* byval nocapture readonly %x) {
     17 entry:
     18   %0 = bitcast %struct.small_arg* %x to i32*
     19   %1 = bitcast %struct.small_arg* %agg.result to i32*
     20   %2 = load i32, 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 
     28 define void @caller1() {
     29 entry:
     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 
     38 declare void @test1(%struct.small_arg* sret, %struct.large_arg* byval, %struct.small_arg* byval)
     39 
     40 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) {
     41 entry:
     42   ret float %x
     43 }
     44 ; CHECK: @callee2
     45 ; CHECK: addi [[TOCREG:[0-9]+]], 1, 136
     46 ; CHECK: lxsspx {{[0-9]+}}, {{[0-9]+}}, [[TOCREG]]
     47 ; CHECK: blr
     48 
     49 define void @caller2() {
     50 entry:
     51   %0 = load float, float* @gf, align 4
     52   %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)
     53   ret void
     54 }
     55 ; CHECK: @caller2
     56 ; CHECK: li [[TOCOFF:[0-9]+]], 136
     57 ; CHECK: stxsspx {{[0-9]+}}, 1, [[TOCOFF]]
     58 ; CHECK: bl test2
     59 
     60 declare float @test2(float, float, float, float, float, float, float, float, float, float, float, float, float, float)
     61 
     62