1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -march=x86-64 -mcpu=corei7-avx -mattr=+fma4 | FileCheck %s
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=bdver2 -mattr=+avx,-fma | FileCheck %s
5 define < 4 x float > @test_x86_fma_vfmadd_ss_load(< 4 x float > %a0, < 4 x float > %a1, float* %a2) {
6 ; CHECK: vfmaddss (%{{.*}})
7 %x = load float , float *%a2
8 %y = insertelement <4 x float> undef, float %x, i32 0
9 %res = call < 4 x float > @llvm.x86.fma.vfmadd.ss(< 4 x float > %a0, < 4 x float > %a1, < 4 x float > %y)
10 ret < 4 x float > %res
12 define < 4 x float > @test_x86_fma_vfmadd_ss_load2(< 4 x float > %a0, float* %a1, < 4 x float > %a2) {
13 ; CHECK: vfmaddss %{{.*}}, (%{{.*}})
14 %x = load float , float *%a1
15 %y = insertelement <4 x float> undef, float %x, i32 0
16 %res = call < 4 x float > @llvm.x86.fma.vfmadd.ss(< 4 x float > %a0, < 4 x float > %y, < 4 x float > %a2)
17 ret < 4 x float > %res
20 declare < 4 x float > @llvm.x86.fma.vfmadd.ss(< 4 x float >, < 4 x float >, < 4 x float >) nounwind readnone
22 define < 2 x double > @test_x86_fma_vfmadd_sd_load(< 2 x double > %a0, < 2 x double > %a1, double* %a2) {
23 ; CHECK: vfmaddsd (%{{.*}})
24 %x = load double , double *%a2
25 %y = insertelement <2 x double> undef, double %x, i32 0
26 %res = call < 2 x double > @llvm.x86.fma.vfmadd.sd(< 2 x double > %a0, < 2 x double > %a1, < 2 x double > %y)
27 ret < 2 x double > %res
29 define < 2 x double > @test_x86_fma_vfmadd_sd_load2(< 2 x double > %a0, double* %a1, < 2 x double > %a2) {
30 ; CHECK: vfmaddsd %{{.*}}, (%{{.*}})
31 %x = load double , double *%a1
32 %y = insertelement <2 x double> undef, double %x, i32 0
33 %res = call < 2 x double > @llvm.x86.fma.vfmadd.sd(< 2 x double > %a0, < 2 x double > %y, < 2 x double > %a2)
34 ret < 2 x double > %res
36 declare < 2 x double > @llvm.x86.fma.vfmadd.sd(< 2 x double >, < 2 x double >, < 2 x double >) nounwind readnone
37 define < 4 x float > @test_x86_fma_vfmadd_ps_load(< 4 x float > %a0, < 4 x float > %a1, < 4 x float >* %a2) {
38 ; CHECK: vfmaddps (%{{.*}})
39 %x = load <4 x float>, <4 x float>* %a2
40 %res = call < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float > %a0, < 4 x float > %a1, < 4 x float > %x)
41 ret < 4 x float > %res
43 define < 4 x float > @test_x86_fma_vfmadd_ps_load2(< 4 x float > %a0, < 4 x float >* %a1, < 4 x float > %a2) {
44 ; CHECK: vfmaddps %{{.*}}, (%{{.*}})
45 %x = load <4 x float>, <4 x float>* %a1
46 %res = call < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float > %a0, < 4 x float > %x, < 4 x float > %a2)
47 ret < 4 x float > %res
49 declare < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float >, < 4 x float >, < 4 x float >) nounwind readnone
51 ; To test execution dependency
52 define < 4 x float > @test_x86_fma_vfmadd_ps_load3(< 4 x float >* %a0, < 4 x float >* %a1, < 4 x float > %a2) {
54 ; CHECK: vfmaddps %{{.*}}, (%{{.*}})
55 %x = load <4 x float>, <4 x float>* %a0
56 %y = load <4 x float>, <4 x float>* %a1
57 %res = call < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float > %x, < 4 x float > %y, < 4 x float > %a2)
58 ret < 4 x float > %res
61 define < 2 x double > @test_x86_fma_vfmadd_pd_load(< 2 x double > %a0, < 2 x double > %a1, < 2 x double >* %a2) {
62 ; CHECK: vfmaddpd (%{{.*}})
63 %x = load <2 x double>, <2 x double>* %a2
64 %res = call < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double > %a0, < 2 x double > %a1, < 2 x double > %x)
65 ret < 2 x double > %res
67 define < 2 x double > @test_x86_fma_vfmadd_pd_load2(< 2 x double > %a0, < 2 x double >* %a1, < 2 x double > %a2) {
68 ; CHECK: vfmaddpd %{{.*}}, (%{{.*}})
69 %x = load <2 x double>, <2 x double>* %a1
70 %res = call < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double > %a0, < 2 x double > %x, < 2 x double > %a2)
71 ret < 2 x double > %res
73 declare < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double >, < 2 x double >, < 2 x double >) nounwind readnone
75 ; To test execution dependency
76 define < 2 x double > @test_x86_fma_vfmadd_pd_load3(< 2 x double >* %a0, < 2 x double >* %a1, < 2 x double > %a2) {
78 ; CHECK: vfmaddpd %{{.*}}, (%{{.*}})
79 %x = load <2 x double>, <2 x double>* %a0
80 %y = load <2 x double>, <2 x double>* %a1
81 %res = call < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double > %x, < 2 x double > %y, < 2 x double > %a2)
82 ret < 2 x double > %res