xref: /aosp_15_r20/external/llvm/test/CodeGen/PowerPC/ppc64-byval-align.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O1 < %s -march=ppc64 -mcpu=pwr7 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "E-m:e-i64:64-n32:64"
4*9880d681SAndroid Build Coastguard Workertarget triple = "powerpc64-unknown-linux-gnu"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker%struct.test = type { i64, [8 x i8] }
7*9880d681SAndroid Build Coastguard Worker%struct.pad = type { [8 x i64] }
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker@gt = common global %struct.test zeroinitializer, align 16
10*9880d681SAndroid Build Coastguard Worker@gp = common global %struct.pad zeroinitializer, align 8
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerdefine signext i32 @callee1(i32 signext %x, %struct.test* byval align 16 nocapture readnone %y, i32 signext %z) {
13*9880d681SAndroid Build Coastguard Workerentry:
14*9880d681SAndroid Build Coastguard Worker  ret i32 %z
15*9880d681SAndroid Build Coastguard Worker}
16*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @callee1
17*9880d681SAndroid Build Coastguard Worker; CHECK: mr 3, 7
18*9880d681SAndroid Build Coastguard Worker; CHECK: blr
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerdeclare signext i32 @test1(i32 signext, %struct.test* byval align 16, i32 signext)
21*9880d681SAndroid Build Coastguard Workerdefine void @caller1(i32 signext %z) {
22*9880d681SAndroid Build Coastguard Workerentry:
23*9880d681SAndroid Build Coastguard Worker  %call = tail call signext i32 @test1(i32 signext 0, %struct.test* byval align 16 @gt, i32 signext %z)
24*9880d681SAndroid Build Coastguard Worker  ret void
25*9880d681SAndroid Build Coastguard Worker}
26*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @caller1
27*9880d681SAndroid Build Coastguard Worker; CHECK: mr [[REG:[0-9]+]], 3
28*9880d681SAndroid Build Coastguard Worker; CHECK: mr 7, [[REG]]
29*9880d681SAndroid Build Coastguard Worker; CHECK: bl test1
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workerdefine i64 @callee2(%struct.pad* byval nocapture readnone %x, i32 signext %y, %struct.test* byval align 16 nocapture readonly %z) {
32*9880d681SAndroid Build Coastguard Workerentry:
33*9880d681SAndroid Build Coastguard Worker  %x1 = getelementptr inbounds %struct.test, %struct.test* %z, i64 0, i32 0
34*9880d681SAndroid Build Coastguard Worker  %0 = load i64, i64* %x1, align 16
35*9880d681SAndroid Build Coastguard Worker  ret i64 %0
36*9880d681SAndroid Build Coastguard Worker}
37*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @callee2
38*9880d681SAndroid Build Coastguard Worker; CHECK: ld 3, 128(1)
39*9880d681SAndroid Build Coastguard Worker; CHECK: blr
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Workerdeclare i64 @test2(%struct.pad* byval, i32 signext, %struct.test* byval align 16)
42*9880d681SAndroid Build Coastguard Workerdefine void @caller2(i64 %z) {
43*9880d681SAndroid Build Coastguard Workerentry:
44*9880d681SAndroid Build Coastguard Worker  %tmp = alloca %struct.test, align 16
45*9880d681SAndroid Build Coastguard Worker  %.compoundliteral.sroa.0.0..sroa_idx = getelementptr inbounds %struct.test, %struct.test* %tmp, i64 0, i32 0
46*9880d681SAndroid Build Coastguard Worker  store i64 %z, i64* %.compoundliteral.sroa.0.0..sroa_idx, align 16
47*9880d681SAndroid Build Coastguard Worker  %call = call i64 @test2(%struct.pad* byval @gp, i32 signext 0, %struct.test* byval align 16 %tmp)
48*9880d681SAndroid Build Coastguard Worker  ret void
49*9880d681SAndroid Build Coastguard Worker}
50*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @caller2
51*9880d681SAndroid Build Coastguard Worker; CHECK: std 3, [[OFF:[0-9]+]](1)
52*9880d681SAndroid Build Coastguard Worker; CHECK: addi [[REG1:[0-9]+]], 1, [[OFF]]
53*9880d681SAndroid Build Coastguard Worker; CHECK: lxvw4x [[REG2:[0-9]+]], 0, [[REG1]]
54*9880d681SAndroid Build Coastguard Worker; CHECK: li [[REG3:[0-9]+]], 128
55*9880d681SAndroid Build Coastguard Worker; CHECK: stxvw4x 0, 1, [[REG3]]
56*9880d681SAndroid Build Coastguard Worker; CHECK: bl test2
57*9880d681SAndroid Build Coastguard Worker
58