annotate llvm/test/CodeGen/AMDGPU/vop-shrink.ll @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children 1f2b6ac9f198
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
anatofuz
parents:
diff changeset
2 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 ; Test that we correctly commute a sub instruction
anatofuz
parents:
diff changeset
5 ; FUNC-LABEL: {{^}}sub_rev:
anatofuz
parents:
diff changeset
6 ; SI-NOT: v_sub_i32_e32 v{{[0-9]+}}, vcc, s
anatofuz
parents:
diff changeset
7 ; SI: v_subrev_{{[iu]}}32_e32 v{{[0-9]+}}, vcc, s
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 ; ModuleID = 'vop-shrink.ll'
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 define amdgpu_kernel void @sub_rev(i32 addrspace(1)* %out, <4 x i32> %sgpr, i32 %cond) {
anatofuz
parents:
diff changeset
12 entry:
anatofuz
parents:
diff changeset
13 %vgpr = call i32 @llvm.amdgcn.workitem.id.x() #1
anatofuz
parents:
diff changeset
14 %tmp = icmp eq i32 %cond, 0
anatofuz
parents:
diff changeset
15 br i1 %tmp, label %if, label %else
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 if: ; preds = %entry
anatofuz
parents:
diff changeset
18 %tmp1 = getelementptr i32, i32 addrspace(1)* %out, i32 1
anatofuz
parents:
diff changeset
19 %tmp2 = extractelement <4 x i32> %sgpr, i32 1
anatofuz
parents:
diff changeset
20 store i32 %tmp2, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
21 br label %endif
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 else: ; preds = %entry
anatofuz
parents:
diff changeset
24 %tmp3 = extractelement <4 x i32> %sgpr, i32 2
anatofuz
parents:
diff changeset
25 %tmp4 = sub i32 %vgpr, %tmp3
anatofuz
parents:
diff changeset
26 store i32 %tmp4, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
27 br label %endif
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 endif: ; preds = %else, %if
anatofuz
parents:
diff changeset
30 ret void
anatofuz
parents:
diff changeset
31 }
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 ; Test that we fold an immediate that was illegal for a 64-bit op into the
anatofuz
parents:
diff changeset
34 ; 32-bit op when we shrink it.
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 ; FUNC-LABEL: {{^}}add_fold:
anatofuz
parents:
diff changeset
37 ; SI: v_add_f32_e32 v{{[0-9]+}}, 0x44800000
anatofuz
parents:
diff changeset
38 define amdgpu_kernel void @add_fold(float addrspace(1)* %out) {
anatofuz
parents:
diff changeset
39 entry:
anatofuz
parents:
diff changeset
40 %tmp = call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
41 %tmp1 = uitofp i32 %tmp to float
anatofuz
parents:
diff changeset
42 %tmp2 = fadd float %tmp1, 1.024000e+03
anatofuz
parents:
diff changeset
43 store float %tmp2, float addrspace(1)* %out
anatofuz
parents:
diff changeset
44 ret void
anatofuz
parents:
diff changeset
45 }
anatofuz
parents:
diff changeset
46
anatofuz
parents:
diff changeset
47 ; Function Attrs: nounwind readnone
anatofuz
parents:
diff changeset
48 declare i32 @llvm.amdgcn.workitem.id.x() #0
anatofuz
parents:
diff changeset
49
anatofuz
parents:
diff changeset
50 attributes #0 = { nounwind readnone }
anatofuz
parents:
diff changeset
51 attributes #1 = { readnone }