annotate llvm/test/CodeGen/AMDGPU/fneg-fabs.ll @ 223:5f17cb93ff66 llvm-original

LLVM13 (2021/7/18)
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:43:00 +0900
parents 79ff65ed7e25
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
1 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -verify-machineinstrs < %s | FileCheck --check-prefixes=SI,FUNC %s
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
2 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck --check-prefixes=VI,FUNC %s
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
3 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=r600 -mcpu=redwood < %s | FileCheck --check-prefixes=R600,FUNC %s
150
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 ; FUNC-LABEL: {{^}}fneg_fabs_fadd_f32:
anatofuz
parents:
diff changeset
6 ; SI-NOT: and
anatofuz
parents:
diff changeset
7 ; SI: v_sub_f32_e64 {{v[0-9]+}}, {{s[0-9]+}}, |{{v[0-9]+}}|
anatofuz
parents:
diff changeset
8 define amdgpu_kernel void @fneg_fabs_fadd_f32(float addrspace(1)* %out, float %x, float %y) {
anatofuz
parents:
diff changeset
9 %fabs = call float @llvm.fabs.f32(float %x)
anatofuz
parents:
diff changeset
10 %fsub = fsub float -0.000000e+00, %fabs
anatofuz
parents:
diff changeset
11 %fadd = fadd float %y, %fsub
anatofuz
parents:
diff changeset
12 store float %fadd, float addrspace(1)* %out, align 4
anatofuz
parents:
diff changeset
13 ret void
anatofuz
parents:
diff changeset
14 }
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 ; FUNC-LABEL: {{^}}fneg_fabs_fmul_f32:
anatofuz
parents:
diff changeset
17 ; SI-NOT: and
anatofuz
parents:
diff changeset
18 ; SI: v_mul_f32_e64 {{v[0-9]+}}, {{s[0-9]+}}, -|{{v[0-9]+}}|
anatofuz
parents:
diff changeset
19 ; SI-NOT: and
anatofuz
parents:
diff changeset
20 define amdgpu_kernel void @fneg_fabs_fmul_f32(float addrspace(1)* %out, float %x, float %y) {
anatofuz
parents:
diff changeset
21 %fabs = call float @llvm.fabs.f32(float %x)
anatofuz
parents:
diff changeset
22 %fsub = fsub float -0.000000e+00, %fabs
anatofuz
parents:
diff changeset
23 %fmul = fmul float %y, %fsub
anatofuz
parents:
diff changeset
24 store float %fmul, float addrspace(1)* %out, align 4
anatofuz
parents:
diff changeset
25 ret void
anatofuz
parents:
diff changeset
26 }
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 ; DAGCombiner will transform:
anatofuz
parents:
diff changeset
29 ; (fabs (f32 bitcast (i32 a))) => (f32 bitcast (and (i32 a), 0x7FFFFFFF))
anatofuz
parents:
diff changeset
30 ; unless isFabsFree returns true
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 ; FUNC-LABEL: {{^}}fneg_fabs_free_f32:
anatofuz
parents:
diff changeset
33 ; R600-NOT: AND
anatofuz
parents:
diff changeset
34 ; R600: |PV.{{[XYZW]}}|
anatofuz
parents:
diff changeset
35 ; R600: -PV
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, 0x80000000
anatofuz
parents:
diff changeset
38 ; VI: s_bitset1_b32 s{{[0-9]+}}, 31
anatofuz
parents:
diff changeset
39 define amdgpu_kernel void @fneg_fabs_free_f32(float addrspace(1)* %out, i32 %in) {
anatofuz
parents:
diff changeset
40 %bc = bitcast i32 %in to float
anatofuz
parents:
diff changeset
41 %fabs = call float @llvm.fabs.f32(float %bc)
anatofuz
parents:
diff changeset
42 %fsub = fsub float -0.000000e+00, %fabs
anatofuz
parents:
diff changeset
43 store float %fsub, 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 ; FUNC-LABEL: {{^}}fneg_fabs_fn_free_f32:
anatofuz
parents:
diff changeset
48 ; R600-NOT: AND
anatofuz
parents:
diff changeset
49 ; R600: |PV.{{[XYZW]}}|
anatofuz
parents:
diff changeset
50 ; R600: -PV
anatofuz
parents:
diff changeset
51
anatofuz
parents:
diff changeset
52 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, 0x80000000
anatofuz
parents:
diff changeset
53 define amdgpu_kernel void @fneg_fabs_fn_free_f32(float addrspace(1)* %out, i32 %in) {
anatofuz
parents:
diff changeset
54 %bc = bitcast i32 %in to float
anatofuz
parents:
diff changeset
55 %fabs = call float @fabs(float %bc)
anatofuz
parents:
diff changeset
56 %fsub = fsub float -0.000000e+00, %fabs
anatofuz
parents:
diff changeset
57 store float %fsub, float addrspace(1)* %out
anatofuz
parents:
diff changeset
58 ret void
anatofuz
parents:
diff changeset
59 }
anatofuz
parents:
diff changeset
60
anatofuz
parents:
diff changeset
61 ; FUNC-LABEL: {{^}}fneg_fabs_f32:
anatofuz
parents:
diff changeset
62 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, 0x80000000
anatofuz
parents:
diff changeset
63 define amdgpu_kernel void @fneg_fabs_f32(float addrspace(1)* %out, float %in) {
anatofuz
parents:
diff changeset
64 %fabs = call float @llvm.fabs.f32(float %in)
anatofuz
parents:
diff changeset
65 %fsub = fsub float -0.000000e+00, %fabs
anatofuz
parents:
diff changeset
66 store float %fsub, float addrspace(1)* %out, align 4
anatofuz
parents:
diff changeset
67 ret void
anatofuz
parents:
diff changeset
68 }
anatofuz
parents:
diff changeset
69
anatofuz
parents:
diff changeset
70 ; FUNC-LABEL: {{^}}v_fneg_fabs_f32:
anatofuz
parents:
diff changeset
71 ; SI: v_or_b32_e32 v{{[0-9]+}}, 0x80000000, v{{[0-9]+}}
anatofuz
parents:
diff changeset
72 define amdgpu_kernel void @v_fneg_fabs_f32(float addrspace(1)* %out, float addrspace(1)* %in) {
anatofuz
parents:
diff changeset
73 %val = load float, float addrspace(1)* %in, align 4
anatofuz
parents:
diff changeset
74 %fabs = call float @llvm.fabs.f32(float %val)
anatofuz
parents:
diff changeset
75 %fsub = fsub float -0.000000e+00, %fabs
anatofuz
parents:
diff changeset
76 store float %fsub, float addrspace(1)* %out, align 4
anatofuz
parents:
diff changeset
77 ret void
anatofuz
parents:
diff changeset
78 }
anatofuz
parents:
diff changeset
79
anatofuz
parents:
diff changeset
80 ; FUNC-LABEL: {{^}}fneg_fabs_v2f32:
anatofuz
parents:
diff changeset
81 ; R600: |{{(PV|T[0-9])\.[XYZW]}}|
anatofuz
parents:
diff changeset
82 ; R600: -PV
anatofuz
parents:
diff changeset
83 ; R600: |{{(PV|T[0-9])\.[XYZW]}}|
anatofuz
parents:
diff changeset
84 ; R600: -PV
anatofuz
parents:
diff changeset
85
anatofuz
parents:
diff changeset
86 ; FIXME: In this case two uses of the constant should be folded
anatofuz
parents:
diff changeset
87 ; SI: s_brev_b32 [[SIGNBITK:s[0-9]+]], 1{{$}}
anatofuz
parents:
diff changeset
88 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, [[SIGNBITK]]
anatofuz
parents:
diff changeset
89 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, [[SIGNBITK]]
anatofuz
parents:
diff changeset
90 define amdgpu_kernel void @fneg_fabs_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %in) {
anatofuz
parents:
diff changeset
91 %fabs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %in)
anatofuz
parents:
diff changeset
92 %fsub = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, %fabs
anatofuz
parents:
diff changeset
93 store <2 x float> %fsub, <2 x float> addrspace(1)* %out
anatofuz
parents:
diff changeset
94 ret void
anatofuz
parents:
diff changeset
95 }
anatofuz
parents:
diff changeset
96
anatofuz
parents:
diff changeset
97 ; FUNC-LABEL: {{^}}fneg_fabs_v4f32:
anatofuz
parents:
diff changeset
98 ; SI: s_brev_b32 [[SIGNBITK:s[0-9]+]], 1{{$}}
anatofuz
parents:
diff changeset
99 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, [[SIGNBITK]]
anatofuz
parents:
diff changeset
100 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, [[SIGNBITK]]
anatofuz
parents:
diff changeset
101 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, [[SIGNBITK]]
anatofuz
parents:
diff changeset
102 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, [[SIGNBITK]]
anatofuz
parents:
diff changeset
103 define amdgpu_kernel void @fneg_fabs_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %in) {
anatofuz
parents:
diff changeset
104 %fabs = call <4 x float> @llvm.fabs.v4f32(<4 x float> %in)
anatofuz
parents:
diff changeset
105 %fsub = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %fabs
anatofuz
parents:
diff changeset
106 store <4 x float> %fsub, <4 x float> addrspace(1)* %out
anatofuz
parents:
diff changeset
107 ret void
anatofuz
parents:
diff changeset
108 }
anatofuz
parents:
diff changeset
109
anatofuz
parents:
diff changeset
110 declare float @fabs(float) readnone
anatofuz
parents:
diff changeset
111 declare float @llvm.fabs.f32(float) readnone
anatofuz
parents:
diff changeset
112 declare <2 x float> @llvm.fabs.v2f32(<2 x float>) readnone
anatofuz
parents:
diff changeset
113 declare <4 x float> @llvm.fabs.v4f32(<4 x float>) readnone