1 ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -stop-after=prologepilog -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3 ; It is a small loop test that iterates over the array member of the structure argument passed byval to the function.
4 ; The loop code will keep the prologue and epilogue blocks apart.
5 ; The test is primarily to check the temp register used to preserve the earlier FP value
6 ; is live-in at every BB in the function.
8 %struct.Data = type { [20 x i32] }
10 define i32 @fp_save_restore_in_temp_sgpr(ptr addrspace(5) nocapture readonly byval(%struct.Data) align 4 %arg) #0 {
11 ; GCN-LABEL: name: fp_save_restore_in_temp_sgpr
13 ; GCN: liveins: $sgpr11
14 ; GCN: $sgpr11 = frame-setup COPY $sgpr33
15 ; GCN: $sgpr33 = frame-setup COPY $sgpr32
17 ; GCN: liveins: $sgpr10, $sgpr11, $vgpr1, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9
19 ; GCN: liveins: $sgpr10, $sgpr11, $vgpr1, $sgpr4_sgpr5, $sgpr6_sgpr7
21 ; GCN: liveins: $sgpr10, $sgpr11, $vgpr0, $vgpr1, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9
23 ; GCN: liveins: $sgpr11, $vgpr0, $sgpr4_sgpr5
24 ; GCN: $sgpr33 = frame-destroy COPY $sgpr11
28 lp_end: ; preds = %lp_begin
29 %cur_idx = add nuw nsw i32 %idx, 1
30 %lp_term_cond = icmp eq i32 %cur_idx, 20
31 br i1 %lp_term_cond, label %end, label %lp_begin
33 lp_begin: ; preds = %lp_end, %begin
34 %idx = phi i32 [ 0, %begin ], [ %cur_idx, %lp_end ]
35 %ptr = getelementptr inbounds %struct.Data, ptr addrspace(5) %arg, i32 0, i32 0, i32 %idx
36 %data = load i32, ptr addrspace(5) %ptr, align 4
37 %data_cmp = icmp eq i32 %data, %idx
38 br i1 %data_cmp, label %lp_end, label %end
40 end: ; preds = %lp_end, %lp_begin
41 %ret_val = phi i32 [ 0, %lp_begin ], [ 1, %lp_end ]
45 attributes #0 = { norecurse nounwind "frame-pointer"="all" }