AMDGPU: Add pass to detect used kernel features
[oota-llvm.git] / test / CodeGen / AMDGPU / wrong-transalu-pos-fix.ll
1 ; RUN: llc -march=r600 -mcpu=redwood -mtriple=r600-- < %s | FileCheck %s
2
3 ; We want all MULLO_INT inst to be last in their instruction group
4 ;CHECK: {{^}}fill3d:
5 ;CHECK-NOT: MULLO_INT T[0-9]+
6
7 define void @fill3d(i32 addrspace(1)* nocapture %out) #0 {
8 entry:
9   %x.i = tail call i32 @llvm.r600.read.global.size.x() #1
10   %y.i18 = tail call i32 @llvm.r600.read.global.size.y() #1
11   %mul = mul i32 %y.i18, %x.i
12   %z.i17 = tail call i32 @llvm.r600.read.global.size.z() #1
13   %mul3 = mul i32 %mul, %z.i17
14   %x.i.i = tail call i32 @llvm.r600.read.tgid.x() #1
15   %x.i12.i = tail call i32 @llvm.r600.read.local.size.x() #1
16   %mul26.i = mul i32 %x.i12.i, %x.i.i
17   %x.i4.i = tail call i32 @llvm.r600.read.tidig.x() #1
18   %add.i16 = add i32 %x.i4.i, %mul26.i
19   %mul7 = mul i32 %add.i16, %y.i18
20   %y.i.i = tail call i32 @llvm.r600.read.tgid.y() #1
21   %y.i14.i = tail call i32 @llvm.r600.read.local.size.y() #1
22   %mul30.i = mul i32 %y.i14.i, %y.i.i
23   %y.i6.i = tail call i32 @llvm.r600.read.tidig.y() #1
24   %add.i14 = add i32 %mul30.i, %mul7
25   %mul819 = add i32 %add.i14, %y.i6.i
26   %add = mul i32 %mul819, %z.i17
27   %z.i.i = tail call i32 @llvm.r600.read.tgid.z() #1
28   %z.i16.i = tail call i32 @llvm.r600.read.local.size.z() #1
29   %mul33.i = mul i32 %z.i16.i, %z.i.i
30   %z.i8.i = tail call i32 @llvm.r600.read.tidig.z() #1
31   %add.i = add i32 %z.i8.i, %mul33.i
32   %add13 = add i32 %add.i, %add
33   %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 %add13
34   store i32 %mul3, i32 addrspace(1)* %arrayidx, align 4
35   ret void
36 }
37
38 ; Function Attrs: nounwind readnone
39 declare i32 @llvm.r600.read.tgid.x() #1
40
41 ; Function Attrs: nounwind readnone
42 declare i32 @llvm.r600.read.tgid.y() #1
43
44 ; Function Attrs: nounwind readnone
45 declare i32 @llvm.r600.read.tgid.z() #1
46
47 ; Function Attrs: nounwind readnone
48 declare i32 @llvm.r600.read.local.size.x() #1
49
50 ; Function Attrs: nounwind readnone
51 declare i32 @llvm.r600.read.local.size.y() #1
52
53 ; Function Attrs: nounwind readnone
54 declare i32 @llvm.r600.read.local.size.z() #1
55
56 ; Function Attrs: nounwind readnone
57 declare i32 @llvm.r600.read.tidig.x() #1
58
59 ; Function Attrs: nounwind readnone
60 declare i32 @llvm.r600.read.tidig.y() #1
61
62 ; Function Attrs: nounwind readnone
63 declare i32 @llvm.r600.read.tidig.z() #1
64
65 ; Function Attrs: nounwind readnone
66 declare i32 @llvm.r600.read.global.size.x() #1
67
68 ; Function Attrs: nounwind readnone
69 declare i32 @llvm.r600.read.global.size.y() #1
70
71 ; Function Attrs: nounwind readnone
72 declare i32 @llvm.r600.read.global.size.z() #1
73
74 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
75 attributes #1 = { nounwind readnone }
76
77 !opencl.kernels = !{!0, !1, !2}
78
79 !0 = !{null}
80 !1 = !{null}
81 !2 = !{void (i32 addrspace(1)*)* @fill3d}