]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/Hexagon/adjust-latency-stackST.ll
Vendor import of llvm trunk r351319 (just before the release_80 branch
[FreeBSD/FreeBSD.git] / test / CodeGen / Hexagon / adjust-latency-stackST.ll
1 ; RUN: llc -march=hexagon < %s | FileCheck %s
2
3 ; Make sure that if there's only one store to the stack, it gets packetized
4 ; with allocframe as there's a latency of 2 cycles between allocframe and
5 ; the following store if not in the same packet.
6
7 ; CHECK: {
8 ; CHECK: memd(r29
9 ; CHECK-NOT: {
10 ; CHECK: allocframe
11 ; CHECK: }
12 ; CHECK: = memw(gp+#G)
13
14 %struct.0 = type { %struct.0*, i32, %struct.2 }
15 %struct.1 = type { i32, i32, [31 x i8] }
16 %struct.2 = type { %struct.1 }
17
18 @G = common global %struct.0* null, align 4
19
20 define i32 @test(%struct.0* nocapture %a0) #0 {
21 b1:
22   %v2 = alloca %struct.0*, align 4
23   %v3 = bitcast %struct.0** %v2 to i8*
24   %v4 = getelementptr inbounds %struct.0, %struct.0* %a0, i32 0, i32 0
25   %v5 = load %struct.0*, %struct.0** %v4, align 4
26   store %struct.0* %v5, %struct.0** %v2, align 4
27   %v6 = bitcast %struct.0* %v5 to i8*
28   %v7 = load i8*, i8** bitcast (%struct.0** @G to i8**), align 4
29   tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %v6, i8* align 4 %v7, i32 48, i1 false)
30   %v8 = getelementptr inbounds %struct.0, %struct.0* %a0, i32 0, i32 2, i32 0, i32 1
31   store i32 5, i32* %v8, align 4
32   %v9 = getelementptr inbounds %struct.0, %struct.0* %v5, i32 0, i32 2, i32 0, i32 1
33   store i32 5, i32* %v9, align 4
34   %v10 = bitcast %struct.0* %a0 to i32*
35   %v11 = load i32, i32* %v10, align 4
36   %v12 = bitcast %struct.0* %v5 to i32*
37   store i32 %v11, i32* %v12, align 4
38   %v13 = call i32 bitcast (i32 (...)* @f0 to i32 (%struct.0**)*)(%struct.0** nonnull %v2)
39   %v14 = load %struct.0*, %struct.0** %v2, align 4
40   %v15 = getelementptr inbounds %struct.0, %struct.0* %v14, i32 0, i32 1
41   %v16 = load i32, i32* %v15, align 4
42   %v17 = icmp eq i32 %v16, 0
43   br i1 %v17, label %b18, label %b32
44
45 b18:                                              ; preds = %b1
46   %v19 = bitcast %struct.0** %v2 to i32**
47   %v20 = getelementptr inbounds %struct.0, %struct.0* %v14, i32 0, i32 2, i32 0, i32 1
48   store i32 6, i32* %v20, align 4
49   %v21 = getelementptr inbounds %struct.0, %struct.0* %a0, i32 0, i32 2, i32 0, i32 0
50   %v22 = load i32, i32* %v21, align 4
51   %v23 = getelementptr inbounds %struct.0, %struct.0* %v14, i32 0, i32 2, i32 0, i32 0
52   %v24 = call i32 bitcast (i32 (...)* @f1 to i32 (i32, i32*)*)(i32 %v22, i32* %v23)
53   %v25 = load i32*, i32** bitcast (%struct.0** @G to i32**), align 4
54   %v26 = load i32, i32* %v25, align 4
55   %v27 = load i32*, i32** %v19, align 4
56   store i32 %v26, i32* %v27, align 4
57   %v28 = load %struct.0*, %struct.0** %v2, align 4
58   %v29 = getelementptr inbounds %struct.0, %struct.0* %v28, i32 0, i32 2, i32 0, i32 1
59   %v30 = load i32, i32* %v29, align 4
60   %v31 = call i32 bitcast (i32 (...)* @f2 to i32 (i32, i32, i32*)*)(i32 %v30, i32 10, i32* %v29)
61   br label %b36
62
63 b32:                                              ; preds = %b1
64   %v33 = bitcast %struct.0* %a0 to i8**
65   %v34 = load i8*, i8** %v33, align 4
66   %v35 = bitcast %struct.0* %a0 to i8*
67   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %v35, i8* align 4 %v34, i32 48, i1 false)
68   br label %b36
69
70 b36:                                              ; preds = %b32, %b18
71   ret i32 undef
72 }
73
74 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1) #1
75
76 declare i32 @f0(...) #0
77 declare i32 @f1(...) #0
78 declare i32 @f2(...) #0
79
80 attributes #0 = { nounwind }
81 attributes #1 = { argmemonly nounwind }