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=GFX10 %s
3 ; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1030 < %s | FileCheck -check-prefix=GFX10 %s
4 ; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1100 < %s | FileCheck -check-prefix=GFX11 %s
5 ; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1100 < %s | FileCheck -check-prefix=GFX11 %s
7 define float @v_fma(float %a, float %b, float %c) {
10 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11 ; GFX10-NEXT: v_fma_legacy_f32 v0, v0, v1, v2
12 ; GFX10-NEXT: s_setpc_b64 s[30:31]
16 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17 ; GFX11-NEXT: v_fma_dx9_zero_f32 v0, v0, v1, v2
18 ; GFX11-NEXT: s_setpc_b64 s[30:31]
19 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %b, float %c)
23 define float @v_fma_imm(float %a, float %c) {
24 ; GFX10-LABEL: v_fma_imm:
26 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
27 ; GFX10-NEXT: v_fma_legacy_f32 v0, 0x41200000, v0, v1
28 ; GFX10-NEXT: s_setpc_b64 s[30:31]
30 ; GFX11-LABEL: v_fma_imm:
32 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
33 ; GFX11-NEXT: v_fma_dx9_zero_f32 v0, 0x41200000, v0, v1
34 ; GFX11-NEXT: s_setpc_b64 s[30:31]
35 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float 10.0, float %c)
39 define float @v_fabs_fma(float %a, float %b, float %c) {
40 ; GFX10-LABEL: v_fabs_fma:
42 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
43 ; GFX10-NEXT: v_fma_legacy_f32 v0, |v0|, v1, v2
44 ; GFX10-NEXT: s_setpc_b64 s[30:31]
46 ; GFX11-LABEL: v_fabs_fma:
48 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
49 ; GFX11-NEXT: v_fma_dx9_zero_f32 v0, |v0|, v1, v2
50 ; GFX11-NEXT: s_setpc_b64 s[30:31]
51 %fabs.a = call float @llvm.fabs.f32(float %a)
52 %fma = call float @llvm.amdgcn.fma.legacy(float %fabs.a, float %b, float %c)
56 define float @v_fneg_fabs_fma(float %a, float %b, float %c) {
57 ; GFX10-LABEL: v_fneg_fabs_fma:
59 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
60 ; GFX10-NEXT: v_fma_legacy_f32 v0, v0, -|v1|, v2
61 ; GFX10-NEXT: s_setpc_b64 s[30:31]
63 ; GFX11-LABEL: v_fneg_fabs_fma:
65 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
66 ; GFX11-NEXT: v_fma_dx9_zero_f32 v0, v0, -|v1|, v2
67 ; GFX11-NEXT: s_setpc_b64 s[30:31]
68 %fabs.b = call float @llvm.fabs.f32(float %b)
69 %neg.fabs.b = fneg float %fabs.b
70 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %neg.fabs.b, float %c)
74 define float @v_fneg_fma(float %a, float %b, float %c) {
75 ; GFX10-LABEL: v_fneg_fma:
77 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
78 ; GFX10-NEXT: v_fma_legacy_f32 v0, v0, v1, -v2
79 ; GFX10-NEXT: s_setpc_b64 s[30:31]
81 ; GFX11-LABEL: v_fneg_fma:
83 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
84 ; GFX11-NEXT: v_fma_dx9_zero_f32 v0, v0, v1, -v2
85 ; GFX11-NEXT: s_setpc_b64 s[30:31]
86 %neg.c = fneg float %c
87 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %b, float %neg.c)
91 define float @v_fma_const_const(float %a) {
92 ; GFX10-LABEL: v_fma_const_const:
94 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
95 ; GFX10-NEXT: v_fma_legacy_f32 v0, v0, 2.0, -1.0
96 ; GFX10-NEXT: s_setpc_b64 s[30:31]
98 ; GFX11-LABEL: v_fma_const_const:
100 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
101 ; GFX11-NEXT: v_fma_dx9_zero_f32 v0, v0, 2.0, -1.0
102 ; GFX11-NEXT: s_setpc_b64 s[30:31]
103 %fma = call float @llvm.amdgcn.fma.legacy(float %a, float 2.0, float -1.0)
107 declare float @llvm.amdgcn.fma.legacy(float, float, float)
108 declare float @llvm.fabs.f32(float)