1 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
2 ; RUN: llc -march=amdgcn -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SICIVI,FUNC %s
3 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SICIVI,FUNC %s
4 ; RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SICIVI,FUNC %s
5 ; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX9,FUNC %s
11 ; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}}
16 ; GFX9-NOT: v_fract_f32
19 define amdgpu_kernel void @sin_f32(ptr addrspace(1) %out, float %x) #1 {
20 %sin = call float @llvm.sin.f32(float %x)
21 store float %sin, ptr addrspace(1) %out
25 ; FUNC-LABEL: {{^}}safe_sin_3x_f32:
29 ; GFX9-NOT: v_fract_f32
32 define amdgpu_kernel void @safe_sin_3x_f32(ptr addrspace(1) %out, float %x) #1 {
33 %y = fmul float 3.0, %x
34 %sin = call float @llvm.sin.f32(float %y)
35 store float %sin, ptr addrspace(1) %out
39 ; FUNC-LABEL: {{^}}unsafe_sin_3x_f32:
44 ; GFX9-NOT: v_fract_f32
47 define amdgpu_kernel void @unsafe_sin_3x_f32(ptr addrspace(1) %out, float %x) #2 {
48 %y = fmul float 3.0, %x
49 %sin = call float @llvm.sin.f32(float %y)
50 store float %sin, ptr addrspace(1) %out
54 ; FUNC-LABEL: {{^}}fmf_sin_3x_f32:
59 ; GFX9-NOT: v_fract_f32
62 define amdgpu_kernel void @fmf_sin_3x_f32(ptr addrspace(1) %out, float %x) #1 {
63 %y = fmul reassoc float 3.0, %x
64 %sin = call reassoc float @llvm.sin.f32(float %y)
65 store float %sin, ptr addrspace(1) %out
69 ; FUNC-LABEL: {{^}}safe_sin_2x_f32:
73 ; GFX9-NOT: v_fract_f32
76 define amdgpu_kernel void @safe_sin_2x_f32(ptr addrspace(1) %out, float %x) #1 {
77 %y = fmul float 2.0, %x
78 %sin = call float @llvm.sin.f32(float %y)
79 store float %sin, ptr addrspace(1) %out
83 ; FUNC-LABEL: {{^}}unsafe_sin_2x_f32:
88 ; GFX9-NOT: v_fract_f32
91 define amdgpu_kernel void @unsafe_sin_2x_f32(ptr addrspace(1) %out, float %x) #2 {
92 %y = fmul float 2.0, %x
93 %sin = call float @llvm.sin.f32(float %y)
94 store float %sin, ptr addrspace(1) %out
98 ; FUNC-LABEL: {{^}}fmf_sin_2x_f32:
102 ; SICIVI: v_fract_f32
103 ; GFX9-NOT: v_fract_f32
106 define amdgpu_kernel void @fmf_sin_2x_f32(ptr addrspace(1) %out, float %x) #1 {
107 %y = fmul reassoc float 2.0, %x
108 %sin = call reassoc float @llvm.sin.f32(float %y)
109 store float %sin, ptr addrspace(1) %out
113 ; FUNC-LABEL: {{^}}safe_sin_cancel_f32:
116 ; SICIVI: v_fract_f32
117 ; GFX9-NOT: v_fract_f32
120 define amdgpu_kernel void @safe_sin_cancel_f32(ptr addrspace(1) %out, float %x) #1 {
121 %y = fmul float 0x401921FB60000000, %x
122 %sin = call float @llvm.sin.f32(float %y)
123 store float %sin, ptr addrspace(1) %out
127 ; FUNC-LABEL: {{^}}unsafe_sin_cancel_f32:
130 ; SICIVI: v_fract_f32
131 ; GFX9-NOT: v_fract_f32
134 define amdgpu_kernel void @unsafe_sin_cancel_f32(ptr addrspace(1) %out, float %x) #2 {
135 %y = fmul float 0x401921FB60000000, %x
136 %sin = call float @llvm.sin.f32(float %y)
137 store float %sin, ptr addrspace(1) %out
141 ; FUNC-LABEL: {{^}}fmf_sin_cancel_f32:
144 ; SICIVI: v_fract_f32
145 ; GFX9-NOT: v_fract_f32
148 define amdgpu_kernel void @fmf_sin_cancel_f32(ptr addrspace(1) %out, float %x) #1 {
149 %y = fmul reassoc float 0x401921FB60000000, %x
150 %sin = call reassoc float @llvm.sin.f32(float %y)
151 store float %sin, ptr addrspace(1) %out
155 ; FUNC-LABEL: {{^}}sin_v4f32:
156 ; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}}
157 ; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}}
158 ; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}}
159 ; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}}
167 define amdgpu_kernel void @sin_v4f32(ptr addrspace(1) %out, <4 x float> %vx) #1 {
168 %sin = call <4 x float> @llvm.sin.v4f32( <4 x float> %vx)
169 store <4 x float> %sin, ptr addrspace(1) %out
173 declare float @llvm.sin.f32(float) #0
174 declare <4 x float> @llvm.sin.v4f32(<4 x float>) #0
176 attributes #0 = { nounwind readnone }
177 attributes #1 = { nounwind "unsafe-fp-math"="false" }
178 attributes #2 = { nounwind "unsafe-fp-math"="true" }