xref: /aosp_15_r20/external/llvm/test/CodeGen/SPARC/zerostructcall.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=sparc | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: struct_ptr_test
4*9880d681SAndroid Build Coastguard Worker; CHECK:       call struct_ptr_fn
5*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  st %i0, [%fp+-4]
6*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker%struct.S = type {}
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Workerdefine void @struct_ptr_test(i32 %i) {
11*9880d681SAndroid Build Coastguard Workerentry:
12*9880d681SAndroid Build Coastguard Worker  %i.addr = alloca i32, align 4
13*9880d681SAndroid Build Coastguard Worker  store i32 %i, i32* %i.addr, align 4
14*9880d681SAndroid Build Coastguard Worker  %0 = bitcast i32* %i.addr to %struct.S*
15*9880d681SAndroid Build Coastguard Worker  call void @struct_ptr_fn(%struct.S* byval align 1 %0)
16*9880d681SAndroid Build Coastguard Worker  ret void
17*9880d681SAndroid Build Coastguard Worker}
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerdeclare void @struct_ptr_fn(%struct.S* byval align 1)
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: struct_test
22*9880d681SAndroid Build Coastguard Worker; CHECK:       call struct_fn
23*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  nop
24*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker%struct.U = type {}
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker@a = internal global [1 x %struct.U] zeroinitializer, align 1
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerdefine void @struct_test() {
31*9880d681SAndroid Build Coastguard Workerentry:
32*9880d681SAndroid Build Coastguard Worker  tail call void @struct_fn(%struct.U* byval align 1 getelementptr inbounds ([1 x %struct.U], [1 x %struct.U]* @a, i32 0, i32 0))
33*9880d681SAndroid Build Coastguard Worker  ret void
34*9880d681SAndroid Build Coastguard Worker}
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: struct_arg_test
37*9880d681SAndroid Build Coastguard Worker; CHECK:       call struct_arg_fn
38*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  nop
39*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  ret
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Workerdeclare void @struct_fn(%struct.U* byval align 1)
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker@b = internal global [1 x %struct.U] zeroinitializer, align 1
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Workerdefine void @struct_arg_test() {
46*9880d681SAndroid Build Coastguard Workerentry:
47*9880d681SAndroid Build Coastguard Worker  tail call void @struct_arg_fn(%struct.U* byval align 1 getelementptr inbounds ([1 x %struct.U], [1 x %struct.U]* @b, i32 0, i32 0))
48*9880d681SAndroid Build Coastguard Worker  ret void
49*9880d681SAndroid Build Coastguard Worker}
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Workerdeclare void @struct_arg_fn(%struct.U* byval align 1)
52