1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1030 < %s | FileCheck -check-prefix=GCN %s 3; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1030 < %s | FileCheck -check-prefix=GCN %s 4 5define float @v_fma(float %a, float %b, float %c) { 6; GCN-LABEL: v_fma: 7; GCN: ; %bb.0: 8; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) 9; GCN-NEXT: s_waitcnt_vscnt null, 0x0 10; GCN-NEXT: v_fmac_legacy_f32_e64 v2, v0, v1 11; GCN-NEXT: v_mov_b32_e32 v0, v2 12; GCN-NEXT: s_setpc_b64 s[30:31] 13 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %b, float %c) 14 ret float %fma 15} 16 17define float @v_fabs_fma(float %a, float %b, float %c) { 18; GCN-LABEL: v_fabs_fma: 19; GCN: ; %bb.0: 20; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) 21; GCN-NEXT: s_waitcnt_vscnt null, 0x0 22; GCN-NEXT: v_fma_legacy_f32 v0, |v0|, v1, v2 23; GCN-NEXT: s_setpc_b64 s[30:31] 24 %fabs.a = call float @llvm.fabs.f32(float %a) 25 %fma = call float @llvm.amdgcn.fma.legacy(float %fabs.a, float %b, float %c) 26 ret float %fma 27} 28 29define float @v_fneg_fabs_fma(float %a, float %b, float %c) { 30; GCN-LABEL: v_fneg_fabs_fma: 31; GCN: ; %bb.0: 32; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) 33; GCN-NEXT: s_waitcnt_vscnt null, 0x0 34; GCN-NEXT: v_fma_legacy_f32 v0, v0, -|v1|, v2 35; GCN-NEXT: s_setpc_b64 s[30:31] 36 %fabs.b = call float @llvm.fabs.f32(float %b) 37 %neg.fabs.b = fneg float %fabs.b 38 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %neg.fabs.b, float %c) 39 ret float %fma 40} 41 42define float @v_fneg_fma(float %a, float %b, float %c) { 43; GCN-LABEL: v_fneg_fma: 44; GCN: ; %bb.0: 45; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) 46; GCN-NEXT: s_waitcnt_vscnt null, 0x0 47; GCN-NEXT: v_fma_legacy_f32 v0, v0, v1, -v2 48; GCN-NEXT: s_setpc_b64 s[30:31] 49 %neg.c = fneg float %c 50 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %b, float %neg.c) 51 ret float %fma 52} 53 54declare float @llvm.amdgcn.fma.legacy(float, float, float) 55declare float @llvm.fabs.f32(float) 56