1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GFX6 %s
3 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG %s
5 ; Tests whether a load chain of 8 constants gets vectorized into a wider load.
6 define amdgpu_kernel void @constant_load_v8f32(ptr addrspace(4) noalias nocapture readonly %weights, ptr addrspace(1) noalias nocapture %out_ptr) {
7 ; GFX6-LABEL: constant_load_v8f32:
8 ; GFX6: ; %bb.0: ; %entry
9 ; GFX6-NEXT: s_load_dwordx4 s[8:11], s[0:1], 0x9
10 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11 ; GFX6-NEXT: s_load_dword s16, s[10:11], 0x0
12 ; GFX6-NEXT: s_load_dwordx8 s[0:7], s[8:9], 0x0
13 ; GFX6-NEXT: s_mov_b32 s15, 0xf000
14 ; GFX6-NEXT: s_mov_b32 s14, -1
15 ; GFX6-NEXT: s_mov_b32 s12, s10
16 ; GFX6-NEXT: s_mov_b32 s13, s11
17 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
18 ; GFX6-NEXT: v_mov_b32_e32 v0, s16
19 ; GFX6-NEXT: v_add_f32_e32 v0, s0, v0
20 ; GFX6-NEXT: v_add_f32_e32 v0, s1, v0
21 ; GFX6-NEXT: v_add_f32_e32 v0, s2, v0
22 ; GFX6-NEXT: v_add_f32_e32 v0, s3, v0
23 ; GFX6-NEXT: v_add_f32_e32 v0, s4, v0
24 ; GFX6-NEXT: v_add_f32_e32 v0, s5, v0
25 ; GFX6-NEXT: v_add_f32_e32 v0, s6, v0
26 ; GFX6-NEXT: v_add_f32_e32 v0, s7, v0
27 ; GFX6-NEXT: buffer_store_dword v0, off, s[12:15], 0
30 ; EG-LABEL: constant_load_v8f32:
31 ; EG: ; %bb.0: ; %entry
32 ; EG-NEXT: ALU 1, @12, KC0[CB0:0-32], KC1[]
34 ; EG-NEXT: ALU 9, @14, KC0[CB0:0-32], KC1[]
35 ; EG-NEXT: MEM_RAT_CACHELESS STORE_RAW T0.X, T1.X, 1
38 ; EG-NEXT: Fetch clause starting at 6:
39 ; EG-NEXT: VTX_READ_128 T2.XYZW, T1.X, 0, #1
40 ; EG-NEXT: VTX_READ_32 T0.X, T0.X, 0, #1
41 ; EG-NEXT: VTX_READ_128 T1.XYZW, T1.X, 16, #1
42 ; EG-NEXT: ALU clause starting at 12:
43 ; EG-NEXT: MOV T0.X, KC0[2].Z,
44 ; EG-NEXT: MOV * T1.X, KC0[2].Y,
45 ; EG-NEXT: ALU clause starting at 14:
46 ; EG-NEXT: ADD * T0.W, T2.X, T0.X,
47 ; EG-NEXT: ADD * T0.W, T2.Y, PV.W,
48 ; EG-NEXT: ADD * T0.W, T2.Z, PV.W,
49 ; EG-NEXT: ADD * T0.W, T2.W, PV.W,
50 ; EG-NEXT: ADD * T0.W, T1.X, PV.W,
51 ; EG-NEXT: ADD * T0.W, T1.Y, PV.W,
52 ; EG-NEXT: ADD * T0.W, T1.Z, PV.W,
53 ; EG-NEXT: ADD T0.X, T1.W, PV.W,
54 ; EG-NEXT: LSHR * T1.X, KC0[2].Z, literal.x,
55 ; EG-NEXT: 2(2.802597e-45), 0(0.000000e+00)
57 %out_ptr.promoted = load float, ptr addrspace(1) %out_ptr, align 4
58 %tmp = load float, ptr addrspace(4) %weights, align 4
59 %add = fadd float %tmp, %out_ptr.promoted
60 %arrayidx.1 = getelementptr inbounds float, ptr addrspace(4) %weights, i64 1
61 %tmp1 = load float, ptr addrspace(4) %arrayidx.1, align 4
62 %add.1 = fadd float %tmp1, %add
63 %arrayidx.2 = getelementptr inbounds float, ptr addrspace(4) %weights, i64 2
64 %tmp2 = load float, ptr addrspace(4) %arrayidx.2, align 4
65 %add.2 = fadd float %tmp2, %add.1
66 %arrayidx.3 = getelementptr inbounds float, ptr addrspace(4) %weights, i64 3
67 %tmp3 = load float, ptr addrspace(4) %arrayidx.3, align 4
68 %add.3 = fadd float %tmp3, %add.2
69 %arrayidx.4 = getelementptr inbounds float, ptr addrspace(4) %weights, i64 4
70 %tmp4 = load float, ptr addrspace(4) %arrayidx.4, align 4
71 %add.4 = fadd float %tmp4, %add.3
72 %arrayidx.5 = getelementptr inbounds float, ptr addrspace(4) %weights, i64 5
73 %tmp5 = load float, ptr addrspace(4) %arrayidx.5, align 4
74 %add.5 = fadd float %tmp5, %add.4
75 %arrayidx.6 = getelementptr inbounds float, ptr addrspace(4) %weights, i64 6
76 %tmp6 = load float, ptr addrspace(4) %arrayidx.6, align 4
77 %add.6 = fadd float %tmp6, %add.5
78 %arrayidx.7 = getelementptr inbounds float, ptr addrspace(4) %weights, i64 7
79 %tmp7 = load float, ptr addrspace(4) %arrayidx.7, align 4
80 %add.7 = fadd float %tmp7, %add.6
81 store float %add.7, ptr addrspace(1) %out_ptr, align 4