1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1030 < %s | FileCheck -check-prefix=GCN %s
3 ; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1030 < %s | FileCheck -check-prefix=GCN %s
5 define float @v_fma(float %a, float %b, float %c) {
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)
17 define float @v_fabs_fma(float %a, float %b, float %c) {
18 ; GCN-LABEL: v_fabs_fma:
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)
29 define float @v_fneg_fabs_fma(float %a, float %b, float %c) {
30 ; GCN-LABEL: v_fneg_fabs_fma:
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)
42 define float @v_fneg_fma(float %a, float %b, float %c) {
43 ; GCN-LABEL: v_fneg_fma:
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)
54 define float @v_fma_const_const(float %a) {
55 ; GCN-LABEL: v_fma_const_const:
57 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
58 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
59 ; GCN-NEXT: v_fma_legacy_f32 v0, v0, 2.0, -1.0
60 ; GCN-NEXT: s_setpc_b64 s[30:31]
61 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float 2.0, float -1.0)
65 declare float @llvm.amdgcn.fma.legacy(float, float, float)
66 declare float @llvm.fabs.f32(float)