annotate test/CodeGen/AMDGPU/fold-fmul-to-neg-abs.ll @ 128:c347d3398279 default tip

fix
author mir3636
date Wed, 06 Dec 2017 14:37:17 +0900
parents 803732b1fca8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
121
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
2
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
3 ; GCN-LABEL: {{^}}fold_mul_neg:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
4 ; GCN: load_dword [[V:v[0-9]+]]
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
5 ; GCN: v_or_b32_e32 [[NEG:v[0-9]]], 0x80000000, [[V]]
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
6 ; GCN: store_dword [[NEG]]
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
7
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
8 define amdgpu_kernel void @fold_mul_neg(float addrspace(1)* %arg) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
9 %tid = tail call i32 @llvm.amdgcn.workitem.id.x()
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
10 %gep = getelementptr inbounds float, float addrspace(1)* %arg, i32 %tid
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
11 %v = load float, float addrspace(1)* %gep, align 4
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
12 %cmp = fcmp fast ogt float %v, 0.000000e+00
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
13 %sel = select i1 %cmp, float -1.000000e+00, float 1.000000e+00
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
14 %mul = fmul fast float %v, %sel
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
15 store float %mul, float addrspace(1)* %gep, align 4
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
16 ret void
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
17 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
18
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
19 ; GCN-LABEL: {{^}}fold_mul_abs:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
20 ; GCN: load_dword [[V:v[0-9]+]]
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
21 ; GCN: v_and_b32_e32 [[ABS:v[0-9]]], 0x7fffffff, [[V]]
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
22 ; GCN: store_dword [[ABS]]
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
23
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
24 define amdgpu_kernel void @fold_mul_abs(float addrspace(1)* %arg) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
25 %tid = tail call i32 @llvm.amdgcn.workitem.id.x()
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
26 %gep = getelementptr inbounds float, float addrspace(1)* %arg, i32 %tid
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
27 %v = load float, float addrspace(1)* %gep, align 4
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
28 %cmp = fcmp fast olt float %v, 0.000000e+00
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
29 %sel = select i1 %cmp, float -1.000000e+00, float 1.000000e+00
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
30 %mul = fmul fast float %v, %sel
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
31 store float %mul, float addrspace(1)* %gep, align 4
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
32 ret void
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
33 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
34
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
35 declare i32 @llvm.amdgcn.workitem.id.x() #0
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
36
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
37 attributes #0 = { nounwind readnone speculatable }