1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=fiji < %s | FileCheck -check-prefix=GCN %s 3; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=fiji < %s | FileCheck -check-prefix=GCN %s 4 5define half @v_sqrt_f16(half %src) { 6; GCN-LABEL: v_sqrt_f16: 7; GCN: ; %bb.0: 8; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) 9; GCN-NEXT: v_sqrt_f16_e32 v0, v0 10; GCN-NEXT: s_setpc_b64 s[30:31] 11 %sqrt = call half @llvm.amdgcn.sqrt.f16(half %src) 12 ret half %sqrt 13} 14 15define half @v_fabs_sqrt_f16(half %src) { 16; GCN-LABEL: v_fabs_sqrt_f16: 17; GCN: ; %bb.0: 18; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) 19; GCN-NEXT: v_sqrt_f16_e64 v0, |v0| 20; GCN-NEXT: s_setpc_b64 s[30:31] 21 %fabs.src = call half @llvm.fabs.f16(half %src) 22 %sqrt = call half @llvm.amdgcn.sqrt.f16(half %fabs.src) 23 ret half %sqrt 24} 25 26define half @v_fneg_fabs_sqrt_f16(half %src) { 27; GCN-LABEL: v_fneg_fabs_sqrt_f16: 28; GCN: ; %bb.0: 29; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) 30; GCN-NEXT: v_sqrt_f16_e64 v0, -|v0| 31; GCN-NEXT: s_setpc_b64 s[30:31] 32 %fabs.src = call half @llvm.fabs.f16(half %src) 33 %neg.fabs.src = fneg half %fabs.src 34 %sqrt = call half @llvm.amdgcn.sqrt.f16(half %neg.fabs.src) 35 ret half %sqrt 36} 37 38declare half @llvm.amdgcn.sqrt.f16(half) #0 39declare half @llvm.fabs.f16(half) #0 40 41attributes #0 = { nounwind readnone speculatable willreturn } 42