1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx,fma | FileCheck %s --check-prefixes=CHECK,FMA3
3 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx,fma4 | FileCheck %s --check-prefixes=CHECK,FMA4
5 define float @test_fneg_fma_subx_y_negz_f32(float %w, float %x, float %y, float %z) {
6 ; FMA3-LABEL: test_fneg_fma_subx_y_negz_f32:
7 ; FMA3: # %bb.0: # %entry
8 ; FMA3-NEXT: vsubss %xmm0, %xmm1, %xmm0
9 ; FMA3-NEXT: vfmadd213ss {{.*#+}} xmm0 = (xmm2 * xmm0) + xmm3
12 ; FMA4-LABEL: test_fneg_fma_subx_y_negz_f32:
13 ; FMA4: # %bb.0: # %entry
14 ; FMA4-NEXT: vsubss %xmm0, %xmm1, %xmm0
15 ; FMA4-NEXT: vfmaddss %xmm3, %xmm2, %xmm0, %xmm0
18 %subx = fsub nsz float %w, %x
19 %negz = fsub float -0.000000e+00, %z
20 %0 = tail call nsz float @llvm.fma.f32(float %subx, float %y, float %negz)
21 %1 = fsub float -0.000000e+00, %0
25 define float @test_fneg_fma_x_suby_negz_f32(float %w, float %x, float %y, float %z) {
26 ; FMA3-LABEL: test_fneg_fma_x_suby_negz_f32:
27 ; FMA3: # %bb.0: # %entry
28 ; FMA3-NEXT: vsubss %xmm0, %xmm2, %xmm0
29 ; FMA3-NEXT: vfmadd213ss {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm3
32 ; FMA4-LABEL: test_fneg_fma_x_suby_negz_f32:
33 ; FMA4: # %bb.0: # %entry
34 ; FMA4-NEXT: vsubss %xmm0, %xmm2, %xmm0
35 ; FMA4-NEXT: vfmaddss %xmm3, %xmm0, %xmm1, %xmm0
38 %suby = fsub nsz float %w, %y
39 %negz = fsub float -0.000000e+00, %z
40 %0 = tail call nsz float @llvm.fma.f32(float %x, float %suby, float %negz)
41 %1 = fsub float -0.000000e+00, %0
45 define float @test_fneg_fma_subx_suby_negz_f32(float %w, float %x, float %y, float %z) {
46 ; FMA3-LABEL: test_fneg_fma_subx_suby_negz_f32:
47 ; FMA3: # %bb.0: # %entry
48 ; FMA3-NEXT: vsubss %xmm0, %xmm1, %xmm1
49 ; FMA3-NEXT: vsubss %xmm2, %xmm0, %xmm0
50 ; FMA3-NEXT: vfmadd213ss {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm3
53 ; FMA4-LABEL: test_fneg_fma_subx_suby_negz_f32:
54 ; FMA4: # %bb.0: # %entry
55 ; FMA4-NEXT: vsubss %xmm0, %xmm1, %xmm1
56 ; FMA4-NEXT: vsubss %xmm2, %xmm0, %xmm0
57 ; FMA4-NEXT: vfmaddss %xmm3, %xmm0, %xmm1, %xmm0
60 %subx = fsub nsz float %w, %x
61 %suby = fsub nsz float %w, %y
62 %negz = fsub float -0.000000e+00, %z
63 %0 = tail call nsz float @llvm.fma.f32(float %subx, float %suby, float %negz)
64 %1 = fsub float -0.000000e+00, %0
68 define float @test_fneg_fma_subx_negy_negz_f32(float %w, float %x, float %y, float %z) {
69 ; FMA3-LABEL: test_fneg_fma_subx_negy_negz_f32:
70 ; FMA3: # %bb.0: # %entry
71 ; FMA3-NEXT: vsubss %xmm1, %xmm0, %xmm0
72 ; FMA3-NEXT: vfmadd213ss {{.*#+}} xmm0 = (xmm2 * xmm0) + xmm3
75 ; FMA4-LABEL: test_fneg_fma_subx_negy_negz_f32:
76 ; FMA4: # %bb.0: # %entry
77 ; FMA4-NEXT: vsubss %xmm1, %xmm0, %xmm0
78 ; FMA4-NEXT: vfmaddss %xmm3, %xmm2, %xmm0, %xmm0
81 %subx = fsub nsz float %w, %x
82 %negy = fsub float -0.000000e+00, %y
83 %negz = fsub float -0.000000e+00, %z
84 %0 = tail call nsz float @llvm.fma.f32(float %subx, float %negy, float %negz)
85 %1 = fsub float -0.000000e+00, %0
89 declare float @llvm.fma.f32(float, float, float)