aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/AMDGPU/kcache-fold.ll
blob: 37dd977ae216e4346cb92ee06767fc1c920de4f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck %s

; CHECK: {{^}}main1:
; CHECK: MOV * T{{[0-9]+\.[XYZW], KC0}}
define amdgpu_kernel void @main1() #0 {
main_body:
  %tmp = load <4 x float>, <4 x float> addrspace(8)* null
  %tmp7 = extractelement <4 x float> %tmp, i32 0
  %tmp8 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
  %tmp9 = extractelement <4 x float> %tmp8, i32 0
  %tmp10 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
  %tmp11 = extractelement <4 x float> %tmp10, i32 0
  %tmp12 = fcmp ogt float %tmp7, 0.000000e+00
  %tmp13 = select i1 %tmp12, float %tmp9, float %tmp11
  %tmp14 = load <4 x float>, <4 x float> addrspace(8)* null
  %tmp15 = extractelement <4 x float> %tmp14, i32 1
  %tmp16 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
  %tmp17 = extractelement <4 x float> %tmp16, i32 1
  %tmp18 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
  %tmp19 = extractelement <4 x float> %tmp18, i32 1
  %tmp20 = fcmp ogt float %tmp15, 0.000000e+00
  %tmp21 = select i1 %tmp20, float %tmp17, float %tmp19
  %tmp22 = load <4 x float>, <4 x float> addrspace(8)* null
  %tmp23 = extractelement <4 x float> %tmp22, i32 2
  %tmp24 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
  %tmp25 = extractelement <4 x float> %tmp24, i32 2
  %tmp26 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
  %tmp27 = extractelement <4 x float> %tmp26, i32 2
  %tmp28 = fcmp ogt float %tmp23, 0.000000e+00
  %tmp29 = select i1 %tmp28, float %tmp25, float %tmp27
  %tmp30 = load <4 x float>, <4 x float> addrspace(8)* null
  %tmp31 = extractelement <4 x float> %tmp30, i32 3
  %tmp32 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
  %tmp33 = extractelement <4 x float> %tmp32, i32 3
  %tmp34 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
  %tmp35 = extractelement <4 x float> %tmp34, i32 3
  %tmp36 = fcmp ogt float %tmp31, 0.000000e+00
  %tmp37 = select i1 %tmp36, float %tmp33, float %tmp35
  %max.0.i = call float @llvm.maxnum.f32(float %tmp13, float 0.000000e+00)
  %clamp.i = call float @llvm.minnum.f32(float %max.0.i, float 1.000000e+00)
  %max.0.i5 = call float @llvm.maxnum.f32(float %tmp21, float 0.000000e+00)
  %clamp.i6 = call float @llvm.minnum.f32(float %max.0.i5, float 1.000000e+00)
  %max.0.i3 = call float @llvm.maxnum.f32(float %tmp29, float 0.000000e+00)
  %clamp.i4 = call float @llvm.minnum.f32(float %max.0.i3, float 1.000000e+00)
  %max.0.i1 = call float @llvm.maxnum.f32(float %tmp37, float 0.000000e+00)
  %clamp.i2 = call float @llvm.minnum.f32(float %max.0.i1, float 1.000000e+00)
  %tmp38 = insertelement <4 x float> undef, float %clamp.i, i32 0
  %tmp39 = insertelement <4 x float> %tmp38, float %clamp.i6, i32 1
  %tmp40 = insertelement <4 x float> %tmp39, float %clamp.i4, i32 2
  %tmp41 = insertelement <4 x float> %tmp40, float %clamp.i2, i32 3
  call void @llvm.r600.store.swizzle(<4 x float> %tmp41, i32 0, i32 0)
  ret void
}

; CHECK: {{^}}main2:
; CHECK-NOT: MOV
define amdgpu_kernel void @main2() #0 {
main_body:
  %tmp = load <4 x float>, <4 x float> addrspace(8)* null
  %tmp7 = extractelement <4 x float> %tmp, i32 0
  %tmp8 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
  %tmp9 = extractelement <4 x float> %tmp8, i32 0
  %tmp10 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
  %tmp11 = extractelement <4 x float> %tmp10, i32 1
  %tmp12 = fcmp ogt float %tmp7, 0.000000e+00
  %tmp13 = select i1 %tmp12, float %tmp9, float %tmp11
  %tmp14 = load <4 x float>, <4 x float> addrspace(8)* null
  %tmp15 = extractelement <4 x float> %tmp14, i32 1
  %tmp16 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
  %tmp17 = extractelement <4 x float> %tmp16, i32 0
  %tmp18 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
  %tmp19 = extractelement <4 x float> %tmp18, i32 1
  %tmp20 = fcmp ogt float %tmp15, 0.000000e+00
  %tmp21 = select i1 %tmp20, float %tmp17, float %tmp19
  %tmp22 = load <4 x float>, <4 x float> addrspace(8)* null
  %tmp23 = extractelement <4 x float> %tmp22, i32 2
  %tmp24 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
  %tmp25 = extractelement <4 x float> %tmp24, i32 3
  %tmp26 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
  %tmp27 = extractelement <4 x float> %tmp26, i32 2
  %tmp28 = fcmp ogt float %tmp23, 0.000000e+00
  %tmp29 = select i1 %tmp28, float %tmp25, float %tmp27
  %tmp30 = load <4 x float>, <4 x float> addrspace(8)* null
  %tmp31 = extractelement <4 x float> %tmp30, i32 3
  %tmp32 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
  %tmp33 = extractelement <4 x float> %tmp32, i32 3
  %tmp34 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
  %tmp35 = extractelement <4 x float> %tmp34, i32 2
  %tmp36 = fcmp ogt float %tmp31, 0.000000e+00
  %tmp37 = select i1 %tmp36, float %tmp33, float %tmp35
  %max.0.i = call float @llvm.maxnum.f32(float %tmp13, float 0.000000e+00)
  %clamp.i = call float @llvm.minnum.f32(float %max.0.i, float 1.000000e+00)
  %max.0.i5 = call float @llvm.maxnum.f32(float %tmp21, float 0.000000e+00)
  %clamp.i6 = call float @llvm.minnum.f32(float %max.0.i5, float 1.000000e+00)
  %max.0.i3 = call float @llvm.maxnum.f32(float %tmp29, float 0.000000e+00)
  %clamp.i4 = call float @llvm.minnum.f32(float %max.0.i3, float 1.000000e+00)
  %max.0.i1 = call float @llvm.maxnum.f32(float %tmp37, float 0.000000e+00)
  %clamp.i2 = call float @llvm.minnum.f32(float %max.0.i1, float 1.000000e+00)
  %tmp38 = insertelement <4 x float> undef, float %clamp.i, i32 0
  %tmp39 = insertelement <4 x float> %tmp38, float %clamp.i6, i32 1
  %tmp40 = insertelement <4 x float> %tmp39, float %clamp.i4, i32 2
  %tmp41 = insertelement <4 x float> %tmp40, float %clamp.i2, i32 3
  call void @llvm.r600.store.swizzle(<4 x float> %tmp41, i32 0, i32 0)
  ret void
}

declare void @llvm.r600.store.swizzle(<4 x float>, i32, i32) #0
declare float @llvm.minnum.f32(float, float) #1
declare float @llvm.maxnum.f32(float, float) #1

attributes #0 = { nounwind }
attributes #1 = { nounwind readnone }