annotate llvm/test/CodeGen/AMDGPU/fneg-fabs.ll @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1f2b6ac9f198
children
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
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
5 ; FUNC-LABEL: {{^}}fneg_fabsf_fadd_f32:
150
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]+}}|
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
8 define amdgpu_kernel void @fneg_fabsf_fadd_f32(ptr addrspace(1) %out, float %x, float %y) {
150
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
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
12 store float %fadd, ptr addrspace(1) %out, align 4
150
anatofuz
parents:
diff changeset
13 ret void
anatofuz
parents:
diff changeset
14 }
anatofuz
parents:
diff changeset
15
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
16 ; FUNC-LABEL: {{^}}fneg_fabsf_fmul_f32:
150
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
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
20 define amdgpu_kernel void @fneg_fabsf_fmul_f32(ptr addrspace(1) %out, float %x, float %y) {
150
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
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
24 store float %fmul, ptr addrspace(1) %out, align 4
150
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:
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
29 ; (fabsf (f32 bitcast (i32 a))) => (f32 bitcast (and (i32 a), 0x7FFFFFFF))
150
anatofuz
parents:
diff changeset
30 ; unless isFabsFree returns true
anatofuz
parents:
diff changeset
31
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
32 ; FUNC-LABEL: {{^}}fneg_fabsf_free_f32:
150
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
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
39 define amdgpu_kernel void @fneg_fabsf_free_f32(ptr addrspace(1) %out, i32 %in) {
150
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
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
43 store float %fsub, ptr addrspace(1) %out
150
anatofuz
parents:
diff changeset
44 ret void
anatofuz
parents:
diff changeset
45 }
anatofuz
parents:
diff changeset
46
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
47 ; FUNC-LABEL: {{^}}fneg_fabsf_fn_free_f32:
150
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
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
53 define amdgpu_kernel void @fneg_fabsf_fn_free_f32(ptr addrspace(1) %out, i32 %in) {
150
anatofuz
parents:
diff changeset
54 %bc = bitcast i32 %in to float
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
55 %fabs = call float @fabsf(float %bc)
150
anatofuz
parents:
diff changeset
56 %fsub = fsub float -0.000000e+00, %fabs
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
57 store float %fsub, ptr addrspace(1) %out
150
anatofuz
parents:
diff changeset
58 ret void
anatofuz
parents:
diff changeset
59 }
anatofuz
parents:
diff changeset
60
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
61 ; FUNC-LABEL: {{^}}fneg_fabsf_f32:
150
anatofuz
parents:
diff changeset
62 ; SI: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, 0x80000000
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
63 define amdgpu_kernel void @fneg_fabsf_f32(ptr addrspace(1) %out, float %in) {
150
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
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
66 store float %fsub, ptr addrspace(1) %out, align 4
150
anatofuz
parents:
diff changeset
67 ret void
anatofuz
parents:
diff changeset
68 }
anatofuz
parents:
diff changeset
69
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
70 ; FUNC-LABEL: {{^}}v_fneg_fabsf_f32:
150
anatofuz
parents:
diff changeset
71 ; SI: v_or_b32_e32 v{{[0-9]+}}, 0x80000000, v{{[0-9]+}}
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
72 define amdgpu_kernel void @v_fneg_fabsf_f32(ptr addrspace(1) %out, ptr addrspace(1) %in) {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
73 %val = load float, ptr addrspace(1) %in, align 4
150
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
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
76 store float %fsub, ptr addrspace(1) %out, align 4
150
anatofuz
parents:
diff changeset
77 ret void
anatofuz
parents:
diff changeset
78 }
anatofuz
parents:
diff changeset
79
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
80 ; FUNC-LABEL: {{^}}fneg_fabsf_v2f32:
150
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
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
87 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
88 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
89 define amdgpu_kernel void @fneg_fabsf_v2f32(ptr addrspace(1) %out, <2 x float> %in) {
150
anatofuz
parents:
diff changeset
90 %fabs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %in)
anatofuz
parents:
diff changeset
91 %fsub = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, %fabs
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
92 store <2 x float> %fsub, ptr addrspace(1) %out
150
anatofuz
parents:
diff changeset
93 ret void
anatofuz
parents:
diff changeset
94 }
anatofuz
parents:
diff changeset
95
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
96 ; FUNC-LABEL: {{^}}fneg_fabsf_v4f32:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
97 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
98 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
99 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
100 ; SI: s_bitset1_b32 s{{[0-9]+}}, 31
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
101 define amdgpu_kernel void @fneg_fabsf_v4f32(ptr addrspace(1) %out, <4 x float> %in) {
150
anatofuz
parents:
diff changeset
102 %fabs = call <4 x float> @llvm.fabs.v4f32(<4 x float> %in)
anatofuz
parents:
diff changeset
103 %fsub = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %fabs
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
104 store <4 x float> %fsub, ptr addrspace(1) %out
150
anatofuz
parents:
diff changeset
105 ret void
anatofuz
parents:
diff changeset
106 }
anatofuz
parents:
diff changeset
107
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
108 declare float @fabsf(float) readnone
150
anatofuz
parents:
diff changeset
109 declare float @llvm.fabs.f32(float) readnone
anatofuz
parents:
diff changeset
110 declare <2 x float> @llvm.fabs.v2f32(<2 x float>) readnone
anatofuz
parents:
diff changeset
111 declare <4 x float> @llvm.fabs.v4f32(<4 x float>) readnone