1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=corei7-avx -mattr=+fma4 -show-mc-encoding | FileCheck %s
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=bdver2 -mattr=+avx,-fma -show-mc-encoding | FileCheck %s
6 define < 4 x float > @test_x86_fma4_vfmadd_ss_load(< 4 x float > %a0, < 4 x float > %a1, ptr %a2) {
7 ; CHECK-LABEL: test_x86_fma4_vfmadd_ss_load:
9 ; CHECK-NEXT: vfmaddss (%rdi), %xmm1, %xmm0, %xmm0 # encoding: [0xc4,0xe3,0xf9,0x6a,0x07,0x10]
10 ; CHECK-NEXT: # xmm0 = (xmm0 * xmm1) + mem
11 ; CHECK-NEXT: retq # encoding: [0xc3]
12 %x = load float , ptr%a2
13 %y = insertelement <4 x float> undef, float %x, i32 0
14 %res = call < 4 x float > @llvm.x86.fma4.vfmadd.ss(< 4 x float > %a0, < 4 x float > %a1, < 4 x float > %y)
15 ret < 4 x float > %res
17 define < 4 x float > @test_x86_fma4_vfmadd_ss_load2(< 4 x float > %a0, ptr %a1, < 4 x float > %a2) {
18 ; CHECK-LABEL: test_x86_fma4_vfmadd_ss_load2:
20 ; CHECK-NEXT: vfmaddss %xmm1, (%rdi), %xmm0, %xmm0 # encoding: [0xc4,0xe3,0x79,0x6a,0x07,0x10]
21 ; CHECK-NEXT: # xmm0 = (xmm0 * mem) + xmm1
22 ; CHECK-NEXT: retq # encoding: [0xc3]
23 %x = load float , ptr%a1
24 %y = insertelement <4 x float> undef, float %x, i32 0
25 %res = call < 4 x float > @llvm.x86.fma4.vfmadd.ss(< 4 x float > %a0, < 4 x float > %y, < 4 x float > %a2)
26 ret < 4 x float > %res
29 declare < 4 x float > @llvm.x86.fma4.vfmadd.ss(< 4 x float >, < 4 x float >, < 4 x float >) nounwind readnone
31 define < 2 x double > @test_x86_fma4_vfmadd_sd_load(< 2 x double > %a0, < 2 x double > %a1, ptr %a2) {
32 ; CHECK-LABEL: test_x86_fma4_vfmadd_sd_load:
34 ; CHECK-NEXT: vfmaddsd (%rdi), %xmm1, %xmm0, %xmm0 # encoding: [0xc4,0xe3,0xf9,0x6b,0x07,0x10]
35 ; CHECK-NEXT: # xmm0 = (xmm0 * xmm1) + mem
36 ; CHECK-NEXT: retq # encoding: [0xc3]
37 %x = load double , ptr%a2
38 %y = insertelement <2 x double> undef, double %x, i32 0
39 %res = call < 2 x double > @llvm.x86.fma4.vfmadd.sd(< 2 x double > %a0, < 2 x double > %a1, < 2 x double > %y)
40 ret < 2 x double > %res
42 define < 2 x double > @test_x86_fma4_vfmadd_sd_load2(< 2 x double > %a0, ptr %a1, < 2 x double > %a2) {
43 ; CHECK-LABEL: test_x86_fma4_vfmadd_sd_load2:
45 ; CHECK-NEXT: vfmaddsd %xmm1, (%rdi), %xmm0, %xmm0 # encoding: [0xc4,0xe3,0x79,0x6b,0x07,0x10]
46 ; CHECK-NEXT: # xmm0 = (xmm0 * mem) + xmm1
47 ; CHECK-NEXT: retq # encoding: [0xc3]
48 %x = load double , ptr%a1
49 %y = insertelement <2 x double> undef, double %x, i32 0
50 %res = call < 2 x double > @llvm.x86.fma4.vfmadd.sd(< 2 x double > %a0, < 2 x double > %y, < 2 x double > %a2)
51 ret < 2 x double > %res
53 declare < 2 x double > @llvm.x86.fma4.vfmadd.sd(< 2 x double >, < 2 x double >, < 2 x double >) nounwind readnone
54 define < 4 x float > @test_x86_fma_vfmadd_ps_load(< 4 x float > %a0, < 4 x float > %a1, ptr %a2) {
55 ; CHECK-LABEL: test_x86_fma_vfmadd_ps_load:
57 ; CHECK-NEXT: vfmaddps (%rdi), %xmm1, %xmm0, %xmm0 # encoding: [0xc4,0xe3,0xf9,0x68,0x07,0x10]
58 ; CHECK-NEXT: # xmm0 = (xmm0 * xmm1) + mem
59 ; CHECK-NEXT: retq # encoding: [0xc3]
60 %x = load <4 x float>, ptr %a2
61 %res = call < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float > %a0, < 4 x float > %a1, < 4 x float > %x)
62 ret < 4 x float > %res
64 define < 4 x float > @test_x86_fma_vfmadd_ps_load2(< 4 x float > %a0, ptr %a1, < 4 x float > %a2) {
65 ; CHECK-LABEL: test_x86_fma_vfmadd_ps_load2:
67 ; CHECK-NEXT: vfmaddps %xmm1, (%rdi), %xmm0, %xmm0 # encoding: [0xc4,0xe3,0x79,0x68,0x07,0x10]
68 ; CHECK-NEXT: # xmm0 = (xmm0 * mem) + xmm1
69 ; CHECK-NEXT: retq # encoding: [0xc3]
70 %x = load <4 x float>, ptr %a1
71 %res = call < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float > %a0, < 4 x float > %x, < 4 x float > %a2)
72 ret < 4 x float > %res
74 declare < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float >, < 4 x float >, < 4 x float >) nounwind readnone
76 ; To test execution dependency
77 define < 4 x float > @test_x86_fma_vfmadd_ps_load3(ptr %a0, ptr %a1, < 4 x float > %a2) {
78 ; CHECK-LABEL: test_x86_fma_vfmadd_ps_load3:
80 ; CHECK-NEXT: vmovaps (%rdi), %xmm1 # encoding: [0xc5,0xf8,0x28,0x0f]
81 ; CHECK-NEXT: vfmaddps %xmm0, (%rsi), %xmm1, %xmm0 # encoding: [0xc4,0xe3,0x71,0x68,0x06,0x00]
82 ; CHECK-NEXT: # xmm0 = (xmm1 * mem) + xmm0
83 ; CHECK-NEXT: retq # encoding: [0xc3]
84 %x = load <4 x float>, ptr %a0
85 %y = load <4 x float>, ptr %a1
86 %res = call < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float > %x, < 4 x float > %y, < 4 x float > %a2)
87 ret < 4 x float > %res
90 define < 2 x double > @test_x86_fma_vfmadd_pd_load(< 2 x double > %a0, < 2 x double > %a1, ptr %a2) {
91 ; CHECK-LABEL: test_x86_fma_vfmadd_pd_load:
93 ; CHECK-NEXT: vfmaddpd (%rdi), %xmm1, %xmm0, %xmm0 # encoding: [0xc4,0xe3,0xf9,0x69,0x07,0x10]
94 ; CHECK-NEXT: # xmm0 = (xmm0 * xmm1) + mem
95 ; CHECK-NEXT: retq # encoding: [0xc3]
96 %x = load <2 x double>, ptr %a2
97 %res = call < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double > %a0, < 2 x double > %a1, < 2 x double > %x)
98 ret < 2 x double > %res
100 define < 2 x double > @test_x86_fma_vfmadd_pd_load2(< 2 x double > %a0, ptr %a1, < 2 x double > %a2) {
101 ; CHECK-LABEL: test_x86_fma_vfmadd_pd_load2:
103 ; CHECK-NEXT: vfmaddpd %xmm1, (%rdi), %xmm0, %xmm0 # encoding: [0xc4,0xe3,0x79,0x69,0x07,0x10]
104 ; CHECK-NEXT: # xmm0 = (xmm0 * mem) + xmm1
105 ; CHECK-NEXT: retq # encoding: [0xc3]
106 %x = load <2 x double>, ptr %a1
107 %res = call < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double > %a0, < 2 x double > %x, < 2 x double > %a2)
108 ret < 2 x double > %res
110 declare < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double >, < 2 x double >, < 2 x double >) nounwind readnone
112 ; To test execution dependency
113 define < 2 x double > @test_x86_fma_vfmadd_pd_load3(ptr %a0, ptr %a1, < 2 x double > %a2) {
114 ; CHECK-LABEL: test_x86_fma_vfmadd_pd_load3:
116 ; CHECK-NEXT: vmovapd (%rdi), %xmm1 # encoding: [0xc5,0xf9,0x28,0x0f]
117 ; CHECK-NEXT: vfmaddpd %xmm0, (%rsi), %xmm1, %xmm0 # encoding: [0xc4,0xe3,0x71,0x69,0x06,0x00]
118 ; CHECK-NEXT: # xmm0 = (xmm1 * mem) + xmm0
119 ; CHECK-NEXT: retq # encoding: [0xc3]
120 %x = load <2 x double>, ptr %a0
121 %y = load <2 x double>, ptr %a1
122 %res = call < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double > %x, < 2 x double > %y, < 2 x double > %a2)
123 ret < 2 x double > %res