annotate llvm/test/CodeGen/AMDGPU/fract.f64.ll @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI -check-prefix=FUNC %s
anatofuz
parents:
diff changeset
2 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=FUNC %s
anatofuz
parents:
diff changeset
3 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=FUNC %s
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -enable-unsafe-fp-math -verify-machineinstrs < %s | FileCheck -check-prefix=GCN-UNSAFE -check-prefix=SI-UNSAFE -check-prefix=FUNC %s
anatofuz
parents:
diff changeset
6 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -enable-unsafe-fp-math -verify-machineinstrs < %s | FileCheck -check-prefix=GCN-UNSAFE -check-prefix=VI-UNSAFE -check-prefix=FUNC %s
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 declare double @llvm.fabs.f64(double) #0
anatofuz
parents:
diff changeset
9 declare double @llvm.floor.f64(double) #0
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 ; FUNC-LABEL: {{^}}fract_f64:
anatofuz
parents:
diff changeset
12 ; SI-DAG: v_fract_f64_e32 [[FRC:v\[[0-9]+:[0-9]+\]]], v{{\[}}[[LO:[0-9]+]]:[[HI:[0-9]+]]]
anatofuz
parents:
diff changeset
13 ; SI-DAG: v_mov_b32_e32 v[[UPLO:[0-9]+]], -1
anatofuz
parents:
diff changeset
14 ; SI-DAG: v_mov_b32_e32 v[[UPHI:[0-9]+]], 0x3fefffff
anatofuz
parents:
diff changeset
15 ; SI-DAG: v_min_f64 v{{\[}}[[MINLO:[0-9]+]]:[[MINHI:[0-9]+]]], [[FRC]], v{{\[}}[[UPLO]]:[[UPHI]]]
anatofuz
parents:
diff changeset
16 ; SI-DAG: v_cmp_class_f64_e64 vcc, v{{\[}}[[LO]]:[[HI]]], 3
anatofuz
parents:
diff changeset
17 ; SI: v_cndmask_b32_e32 v[[RESLO:[0-9]+]], v[[MINLO]], v[[LO]], vcc
anatofuz
parents:
diff changeset
18 ; SI: v_cndmask_b32_e32 v[[RESHI:[0-9]+]], v[[MINHI]], v[[HI]], vcc
anatofuz
parents:
diff changeset
19 ; SI: v_add_f64 [[SUB0:v\[[0-9]+:[0-9]+\]]], v{{\[}}[[LO]]:[[HI]]{{\]}}, -v{{\[}}[[RESLO]]:[[RESHI]]{{\]}}
anatofuz
parents:
diff changeset
20 ; SI: v_add_f64 [[FRACT:v\[[0-9]+:[0-9]+\]]], v{{\[}}[[LO]]:[[HI]]{{\]}}, -[[SUB0]]
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 ; CI: buffer_load_dwordx2 [[X:v\[[0-9]+:[0-9]+\]]]
anatofuz
parents:
diff changeset
23 ; CI: v_floor_f64_e32 [[FLOORX:v\[[0-9]+:[0-9]+\]]], [[X]]
anatofuz
parents:
diff changeset
24 ; CI: v_add_f64 [[FRACT:v\[[0-9]+:[0-9]+\]]], [[X]], -[[FLOORX]]
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 ; GCN-UNSAFE: buffer_load_dwordx2 [[X:v\[[0-9]+:[0-9]+\]]]
anatofuz
parents:
diff changeset
27 ; GCN-UNSAFE: v_fract_f64_e32 [[FRACT:v\[[0-9]+:[0-9]+\]]], [[X]]
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 ; GCN: buffer_store_dwordx2 [[FRACT]]
anatofuz
parents:
diff changeset
30 define amdgpu_kernel void @fract_f64(double addrspace(1)* %out, double addrspace(1)* %src) #1 {
anatofuz
parents:
diff changeset
31 %x = load double, double addrspace(1)* %src
anatofuz
parents:
diff changeset
32 %floor.x = call double @llvm.floor.f64(double %x)
anatofuz
parents:
diff changeset
33 %fract = fsub double %x, %floor.x
anatofuz
parents:
diff changeset
34 store double %fract, double addrspace(1)* %out
anatofuz
parents:
diff changeset
35 ret void
anatofuz
parents:
diff changeset
36 }
anatofuz
parents:
diff changeset
37
anatofuz
parents:
diff changeset
38 ; FUNC-LABEL: {{^}}fract_f64_neg:
anatofuz
parents:
diff changeset
39 ; SI-DAG: v_fract_f64_e64 [[FRC:v\[[0-9]+:[0-9]+\]]], -v{{\[}}[[LO:[0-9]+]]:[[HI:[0-9]+]]]
anatofuz
parents:
diff changeset
40 ; SI-DAG: v_mov_b32_e32 v[[UPLO:[0-9]+]], -1
anatofuz
parents:
diff changeset
41 ; SI-DAG: v_mov_b32_e32 v[[UPHI:[0-9]+]], 0x3fefffff
anatofuz
parents:
diff changeset
42 ; SI-DAG: v_min_f64 v{{\[}}[[MINLO:[0-9]+]]:[[MINHI:[0-9]+]]], [[FRC]], v{{\[}}[[UPLO]]:[[UPHI]]]
anatofuz
parents:
diff changeset
43 ; SI-DAG: v_cmp_class_f64_e64 vcc, v{{\[}}[[LO]]:[[HI]]], 3
anatofuz
parents:
diff changeset
44 ; SI: v_cndmask_b32_e32 v[[RESLO:[0-9]+]], v[[MINLO]], v[[LO]], vcc
anatofuz
parents:
diff changeset
45 ; SI: v_cndmask_b32_e32 v[[RESHI:[0-9]+]], v[[MINHI]], v[[HI]], vcc
anatofuz
parents:
diff changeset
46 ; SI: v_add_f64 [[SUB0:v\[[0-9]+:[0-9]+\]]], -v{{\[}}[[LO]]:[[HI]]{{\]}}, -v{{\[}}[[RESLO]]:[[RESHI]]{{\]}}
anatofuz
parents:
diff changeset
47 ; SI: v_add_f64 [[FRACT:v\[[0-9]+:[0-9]+\]]], -v{{\[}}[[LO]]:[[HI]]{{\]}}, -[[SUB0]]
anatofuz
parents:
diff changeset
48
anatofuz
parents:
diff changeset
49 ; CI: buffer_load_dwordx2 [[X:v\[[0-9]+:[0-9]+\]]]
anatofuz
parents:
diff changeset
50 ; CI: v_floor_f64_e64 [[FLOORX:v\[[0-9]+:[0-9]+\]]], -[[X]]
anatofuz
parents:
diff changeset
51 ; CI: v_add_f64 [[FRACT:v\[[0-9]+:[0-9]+\]]], -[[X]], -[[FLOORX]]
anatofuz
parents:
diff changeset
52
anatofuz
parents:
diff changeset
53 ; GCN-UNSAFE: buffer_load_dwordx2 [[X:v\[[0-9]+:[0-9]+\]]]
anatofuz
parents:
diff changeset
54 ; GCN-UNSAFE: v_fract_f64_e64 [[FRACT:v\[[0-9]+:[0-9]+\]]], -[[X]]
anatofuz
parents:
diff changeset
55
anatofuz
parents:
diff changeset
56 ; GCN: buffer_store_dwordx2 [[FRACT]]
anatofuz
parents:
diff changeset
57 define amdgpu_kernel void @fract_f64_neg(double addrspace(1)* %out, double addrspace(1)* %src) #1 {
anatofuz
parents:
diff changeset
58 %x = load double, double addrspace(1)* %src
anatofuz
parents:
diff changeset
59 %neg.x = fsub double -0.0, %x
anatofuz
parents:
diff changeset
60 %floor.neg.x = call double @llvm.floor.f64(double %neg.x)
anatofuz
parents:
diff changeset
61 %fract = fsub double %neg.x, %floor.neg.x
anatofuz
parents:
diff changeset
62 store double %fract, double addrspace(1)* %out
anatofuz
parents:
diff changeset
63 ret void
anatofuz
parents:
diff changeset
64 }
anatofuz
parents:
diff changeset
65
anatofuz
parents:
diff changeset
66 ; FUNC-LABEL: {{^}}fract_f64_neg_abs:
anatofuz
parents:
diff changeset
67 ; SI-DAG: v_fract_f64_e64 [[FRC:v\[[0-9]+:[0-9]+\]]], -|v{{\[}}[[LO:[0-9]+]]:[[HI:[0-9]+]]]|
anatofuz
parents:
diff changeset
68 ; SI-DAG: v_mov_b32_e32 v[[UPLO:[0-9]+]], -1
anatofuz
parents:
diff changeset
69 ; SI-DAG: v_mov_b32_e32 v[[UPHI:[0-9]+]], 0x3fefffff
anatofuz
parents:
diff changeset
70 ; SI-DAG: v_min_f64 v{{\[}}[[MINLO:[0-9]+]]:[[MINHI:[0-9]+]]], [[FRC]], v{{\[}}[[UPLO]]:[[UPHI]]]
anatofuz
parents:
diff changeset
71 ; SI-DAG: v_cmp_class_f64_e64 vcc, v{{\[}}[[LO]]:[[HI]]], 3
anatofuz
parents:
diff changeset
72 ; SI: v_cndmask_b32_e32 v[[RESLO:[0-9]+]], v[[MINLO]], v[[LO]], vcc
anatofuz
parents:
diff changeset
73 ; SI: v_cndmask_b32_e32 v[[RESHI:[0-9]+]], v[[MINHI]], v[[HI]], vcc
anatofuz
parents:
diff changeset
74 ; SI: v_add_f64 [[SUB0:v\[[0-9]+:[0-9]+\]]], -|v{{\[}}[[LO]]:[[HI]]{{\]}}|, -v{{\[}}[[RESLO]]:[[RESHI]]{{\]}}
anatofuz
parents:
diff changeset
75 ; SI: v_add_f64 [[FRACT:v\[[0-9]+:[0-9]+\]]], -|v{{\[}}[[LO]]:[[HI]]{{\]}}|, -[[SUB0]]
anatofuz
parents:
diff changeset
76
anatofuz
parents:
diff changeset
77 ; CI: buffer_load_dwordx2 [[X:v\[[0-9]+:[0-9]+\]]]
anatofuz
parents:
diff changeset
78 ; CI: v_floor_f64_e64 [[FLOORX:v\[[0-9]+:[0-9]+\]]], -|[[X]]|
anatofuz
parents:
diff changeset
79 ; CI: v_add_f64 [[FRACT:v\[[0-9]+:[0-9]+\]]], -|[[X]]|, -[[FLOORX]]
anatofuz
parents:
diff changeset
80
anatofuz
parents:
diff changeset
81 ; GCN-UNSAFE: buffer_load_dwordx2 [[X:v\[[0-9]+:[0-9]+\]]]
anatofuz
parents:
diff changeset
82 ; GCN-UNSAFE: v_fract_f64_e64 [[FRACT:v\[[0-9]+:[0-9]+\]]], -|[[X]]|
anatofuz
parents:
diff changeset
83
anatofuz
parents:
diff changeset
84 ; GCN: buffer_store_dwordx2 [[FRACT]]
anatofuz
parents:
diff changeset
85 define amdgpu_kernel void @fract_f64_neg_abs(double addrspace(1)* %out, double addrspace(1)* %src) #1 {
anatofuz
parents:
diff changeset
86 %x = load double, double addrspace(1)* %src
anatofuz
parents:
diff changeset
87 %abs.x = call double @llvm.fabs.f64(double %x)
anatofuz
parents:
diff changeset
88 %neg.abs.x = fsub double -0.0, %abs.x
anatofuz
parents:
diff changeset
89 %floor.neg.abs.x = call double @llvm.floor.f64(double %neg.abs.x)
anatofuz
parents:
diff changeset
90 %fract = fsub double %neg.abs.x, %floor.neg.abs.x
anatofuz
parents:
diff changeset
91 store double %fract, double addrspace(1)* %out
anatofuz
parents:
diff changeset
92 ret void
anatofuz
parents:
diff changeset
93 }
anatofuz
parents:
diff changeset
94
anatofuz
parents:
diff changeset
95 ; FUNC-LABEL: {{^}}multi_use_floor_fract_f64:
anatofuz
parents:
diff changeset
96 ; VI-UNSAFE: buffer_load_dwordx2 [[X:v\[[0-9]+:[0-9]+\]]]
anatofuz
parents:
diff changeset
97 ; VI-UNSAFE-DAG: v_floor_f64_e32 [[FLOOR:v\[[0-9]+:[0-9]+\]]], [[X]]
anatofuz
parents:
diff changeset
98 ; VI-UNSAFE-DAG: v_fract_f64_e32 [[FRACT:v\[[0-9]+:[0-9]+\]]], [[X]]
anatofuz
parents:
diff changeset
99 ; VI-UNSAFE: buffer_store_dwordx2 [[FLOOR]]
anatofuz
parents:
diff changeset
100 ; VI-UNSAFE: buffer_store_dwordx2 [[FRACT]]
anatofuz
parents:
diff changeset
101 define amdgpu_kernel void @multi_use_floor_fract_f64(double addrspace(1)* %out, double addrspace(1)* %src) #1 {
anatofuz
parents:
diff changeset
102 %x = load double, double addrspace(1)* %src
anatofuz
parents:
diff changeset
103 %floor.x = call double @llvm.floor.f64(double %x)
anatofuz
parents:
diff changeset
104 %fract = fsub double %x, %floor.x
anatofuz
parents:
diff changeset
105 store volatile double %floor.x, double addrspace(1)* %out
anatofuz
parents:
diff changeset
106 store volatile double %fract, double 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 attributes #0 = { nounwind readnone }
anatofuz
parents:
diff changeset
111 attributes #1 = { nounwind }