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_fma_legacy_f32 v0, v0, v1, v2
11 ; GCN-NEXT: s_setpc_b64 s[30:31]
12 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %b, float %c)
16 define float @v_fma_imm(float %a, float %c) {
17 ; GCN-LABEL: v_fma_imm:
19 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
20 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
21 ; GCN-NEXT: v_fmac_legacy_f32_e32 v1, 0x41200000, v0
22 ; GCN-NEXT: v_mov_b32_e32 v0, v1
23 ; GCN-NEXT: s_setpc_b64 s[30:31]
24 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float 10.0, float %c)
28 define float @v_fabs_fma(float %a, float %b, float %c) {
29 ; GCN-LABEL: v_fabs_fma:
31 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
32 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
33 ; GCN-NEXT: v_fma_legacy_f32 v0, |v0|, v1, v2
34 ; GCN-NEXT: s_setpc_b64 s[30:31]
35 %fabs.a = call float @llvm.fabs.f32(float %a)
36 %fma = call float @llvm.amdgcn.fma.legacy(float %fabs.a, float %b, float %c)
40 define float @v_fneg_fabs_fma(float %a, float %b, float %c) {
41 ; GCN-LABEL: v_fneg_fabs_fma:
43 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
44 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
45 ; GCN-NEXT: v_fma_legacy_f32 v0, v0, -|v1|, v2
46 ; GCN-NEXT: s_setpc_b64 s[30:31]
47 %fabs.b = call float @llvm.fabs.f32(float %b)
48 %neg.fabs.b = fneg float %fabs.b
49 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %neg.fabs.b, float %c)
53 define float @v_fneg_fma(float %a, float %b, float %c) {
54 ; GCN-LABEL: v_fneg_fma:
56 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
57 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
58 ; GCN-NEXT: v_fma_legacy_f32 v0, v0, v1, -v2
59 ; GCN-NEXT: s_setpc_b64 s[30:31]
60 %neg.c = fneg float %c
61 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %b, float %neg.c)
65 define float @v_fma_const_const(float %a) {
66 ; GCN-LABEL: v_fma_const_const:
68 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
69 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
70 ; GCN-NEXT: v_fma_legacy_f32 v0, v0, 2.0, -1.0
71 ; GCN-NEXT: s_setpc_b64 s[30:31]
72 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float 2.0, float -1.0)
76 declare float @llvm.amdgcn.fma.legacy(float, float, float)
77 declare float @llvm.fabs.f32(float)