1; RUN: llc -march=amdgcn -mcpu=tahiti -start-after=sink -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=GCN-SAFE -check-prefix=SI -check-prefix=FUNC %s
2; RUN: llc -enable-no-signed-zeros-fp-math -march=amdgcn -mcpu=tahiti -start-after=sink -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=GCN-NSZ -check-prefix=SI -check-prefix=FUNC %s
3
4; --------------------------------------------------------------------------------
5; rcp_legacy tests
6; --------------------------------------------------------------------------------
7
8; GCN-LABEL: {{^}}v_fneg_rcp_legacy_f32:
9; GCN: {{buffer|flat}}_load_dword [[A:v[0-9]+]]
10; GCN: v_rcp_legacy_f32_e64 [[RESULT:v[0-9]+]], -[[A]]
11; GCN: {{buffer|flat}}_store_dword [[RESULT]]
12define amdgpu_kernel void @v_fneg_rcp_legacy_f32(float addrspace(1)* %out, float addrspace(1)* %a.ptr) #0 {
13  %tid = call i32 @llvm.amdgcn.workitem.id.x()
14  %tid.ext = sext i32 %tid to i64
15  %a.gep = getelementptr inbounds float, float addrspace(1)* %a.ptr, i64 %tid.ext
16  %out.gep = getelementptr inbounds float, float addrspace(1)* %out, i64 %tid.ext
17  %a = load volatile float, float addrspace(1)* %a.gep
18  %rcp = call float @llvm.amdgcn.rcp.legacy(float %a)
19  %fneg = fsub float -0.000000e+00, %rcp
20  store float %fneg, float addrspace(1)* %out.gep
21  ret void
22}
23
24declare i32 @llvm.amdgcn.workitem.id.x() #1
25declare float @llvm.amdgcn.rcp.legacy(float) #1
26
27attributes #0 = { nounwind }
28attributes #1 = { nounwind readnone }
29