1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mattr=fma4 | FileCheck %s
4 target triple = "x86_64-unknown-unknown"
6 declare <4 x float> @llvm.x86.fma4.vfmadd.ss(<4 x float>, <4 x float>, <4 x float>)
7 declare <2 x double> @llvm.x86.fma4.vfmadd.sd(<2 x double>, <2 x double>, <2 x double>)
9 define void @fmadd_aab_ss(ptr %a, ptr %b) {
10 ; CHECK-LABEL: fmadd_aab_ss:
12 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
13 ; CHECK-NEXT: vfmaddss {{.*#+}} xmm0 = (xmm0 * xmm0) + mem
14 ; CHECK-NEXT: vmovss %xmm0, (%rdi)
16 %a.val = load float, ptr %a
17 %av0 = insertelement <4 x float> undef, float %a.val, i32 0
18 %av1 = insertelement <4 x float> %av0, float 0.000000e+00, i32 1
19 %av2 = insertelement <4 x float> %av1, float 0.000000e+00, i32 2
20 %av = insertelement <4 x float> %av2, float 0.000000e+00, i32 3
22 %b.val = load float, ptr %b
23 %bv0 = insertelement <4 x float> undef, float %b.val, i32 0
24 %bv1 = insertelement <4 x float> %bv0, float 0.000000e+00, i32 1
25 %bv2 = insertelement <4 x float> %bv1, float 0.000000e+00, i32 2
26 %bv = insertelement <4 x float> %bv2, float 0.000000e+00, i32 3
28 %vr = call <4 x float> @llvm.x86.fma4.vfmadd.ss(<4 x float> %av, <4 x float> %av, <4 x float> %bv)
30 %sr = extractelement <4 x float> %vr, i32 0
31 store float %sr, ptr %a
35 define void @fmadd_aba_ss(ptr %a, ptr %b) {
36 ; CHECK-LABEL: fmadd_aba_ss:
38 ; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
39 ; CHECK-NEXT: vfmaddss {{.*#+}} xmm0 = (xmm0 * mem) + xmm0
40 ; CHECK-NEXT: vmovss %xmm0, (%rdi)
42 %a.val = load float, ptr %a
43 %av0 = insertelement <4 x float> undef, float %a.val, i32 0
44 %av1 = insertelement <4 x float> %av0, float 0.000000e+00, i32 1
45 %av2 = insertelement <4 x float> %av1, float 0.000000e+00, i32 2
46 %av = insertelement <4 x float> %av2, float 0.000000e+00, i32 3
48 %b.val = load float, ptr %b
49 %bv0 = insertelement <4 x float> undef, float %b.val, i32 0
50 %bv1 = insertelement <4 x float> %bv0, float 0.000000e+00, i32 1
51 %bv2 = insertelement <4 x float> %bv1, float 0.000000e+00, i32 2
52 %bv = insertelement <4 x float> %bv2, float 0.000000e+00, i32 3
54 %vr = call <4 x float> @llvm.x86.fma4.vfmadd.ss(<4 x float> %av, <4 x float> %bv, <4 x float> %av)
56 %sr = extractelement <4 x float> %vr, i32 0
57 store float %sr, ptr %a
61 define void @fmadd_aab_sd(ptr %a, ptr %b) {
62 ; CHECK-LABEL: fmadd_aab_sd:
64 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
65 ; CHECK-NEXT: vfmaddsd {{.*#+}} xmm0 = (xmm0 * xmm0) + mem
66 ; CHECK-NEXT: vmovsd %xmm0, (%rdi)
68 %a.val = load double, ptr %a
69 %av0 = insertelement <2 x double> undef, double %a.val, i32 0
70 %av = insertelement <2 x double> %av0, double 0.000000e+00, i32 1
72 %b.val = load double, ptr %b
73 %bv0 = insertelement <2 x double> undef, double %b.val, i32 0
74 %bv = insertelement <2 x double> %bv0, double 0.000000e+00, i32 1
76 %vr = call <2 x double> @llvm.x86.fma4.vfmadd.sd(<2 x double> %av, <2 x double> %av, <2 x double> %bv)
78 %sr = extractelement <2 x double> %vr, i32 0
79 store double %sr, ptr %a
83 define void @fmadd_aba_sd(ptr %a, ptr %b) {
84 ; CHECK-LABEL: fmadd_aba_sd:
86 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
87 ; CHECK-NEXT: vfmaddsd {{.*#+}} xmm0 = (xmm0 * mem) + xmm0
88 ; CHECK-NEXT: vmovsd %xmm0, (%rdi)
90 %a.val = load double, ptr %a
91 %av0 = insertelement <2 x double> undef, double %a.val, i32 0
92 %av = insertelement <2 x double> %av0, double 0.000000e+00, i32 1
94 %b.val = load double, ptr %b
95 %bv0 = insertelement <2 x double> undef, double %b.val, i32 0
96 %bv = insertelement <2 x double> %bv0, double 0.000000e+00, i32 1
98 %vr = call <2 x double> @llvm.x86.fma4.vfmadd.sd(<2 x double> %av, <2 x double> %bv, <2 x double> %av)
100 %sr = extractelement <2 x double> %vr, i32 0
101 store double %sr, ptr %a