File: fma4-intrinsics-x86_64-folded-load.ll

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (125 lines) | stat: -rw-r--r-- 6,487 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=corei7-avx -mattr=+fma4 -show-mc-encoding | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=bdver2 -mattr=+avx,-fma -show-mc-encoding | FileCheck %s

; VFMADD
define < 4 x float > @test_x86_fma4_vfmadd_ss_load(< 4 x float > %a0, < 4 x float > %a1, ptr %a2) {
; CHECK-LABEL: test_x86_fma4_vfmadd_ss_load:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vfmaddss (%rdi), %xmm1, %xmm0, %xmm0 # encoding: [0xc4,0xe3,0xf9,0x6a,0x07,0x10]
; CHECK-NEXT:    # xmm0 = (xmm0 * xmm1) + mem
; CHECK-NEXT:    retq # encoding: [0xc3]
  %x = load float , ptr%a2
  %y = insertelement <4 x float> undef, float %x, i32 0
  %res = call < 4 x float > @llvm.x86.fma4.vfmadd.ss(< 4 x float > %a0, < 4 x float > %a1, < 4 x float > %y)
  ret < 4 x float > %res
}
define < 4 x float > @test_x86_fma4_vfmadd_ss_load2(< 4 x float > %a0, ptr %a1, < 4 x float > %a2) {
; CHECK-LABEL: test_x86_fma4_vfmadd_ss_load2:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vfmaddss %xmm1, (%rdi), %xmm0, %xmm0 # encoding: [0xc4,0xe3,0x79,0x6a,0x07,0x10]
; CHECK-NEXT:    # xmm0 = (xmm0 * mem) + xmm1
; CHECK-NEXT:    retq # encoding: [0xc3]
  %x = load float , ptr%a1
  %y = insertelement <4 x float> undef, float %x, i32 0
  %res = call < 4 x float > @llvm.x86.fma4.vfmadd.ss(< 4 x float > %a0, < 4 x float > %y, < 4 x float > %a2)
  ret < 4 x float > %res
}

declare < 4 x float > @llvm.x86.fma4.vfmadd.ss(< 4 x float >, < 4 x float >, < 4 x float >) nounwind readnone

define < 2 x double > @test_x86_fma4_vfmadd_sd_load(< 2 x double > %a0, < 2 x double > %a1, ptr %a2) {
; CHECK-LABEL: test_x86_fma4_vfmadd_sd_load:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vfmaddsd (%rdi), %xmm1, %xmm0, %xmm0 # encoding: [0xc4,0xe3,0xf9,0x6b,0x07,0x10]
; CHECK-NEXT:    # xmm0 = (xmm0 * xmm1) + mem
; CHECK-NEXT:    retq # encoding: [0xc3]
  %x = load double , ptr%a2
  %y = insertelement <2 x double> undef, double %x, i32 0
  %res = call < 2 x double > @llvm.x86.fma4.vfmadd.sd(< 2 x double > %a0, < 2 x double > %a1, < 2 x double > %y)
  ret < 2 x double > %res
}
define < 2 x double > @test_x86_fma4_vfmadd_sd_load2(< 2 x double > %a0, ptr %a1, < 2 x double > %a2) {
; CHECK-LABEL: test_x86_fma4_vfmadd_sd_load2:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vfmaddsd %xmm1, (%rdi), %xmm0, %xmm0 # encoding: [0xc4,0xe3,0x79,0x6b,0x07,0x10]
; CHECK-NEXT:    # xmm0 = (xmm0 * mem) + xmm1
; CHECK-NEXT:    retq # encoding: [0xc3]
  %x = load double , ptr%a1
  %y = insertelement <2 x double> undef, double %x, i32 0
  %res = call < 2 x double > @llvm.x86.fma4.vfmadd.sd(< 2 x double > %a0, < 2 x double > %y, < 2 x double > %a2)
  ret < 2 x double > %res
}
declare < 2 x double > @llvm.x86.fma4.vfmadd.sd(< 2 x double >, < 2 x double >, < 2 x double >) nounwind readnone
define < 4 x float > @test_x86_fma_vfmadd_ps_load(< 4 x float > %a0, < 4 x float > %a1, ptr %a2) {
; CHECK-LABEL: test_x86_fma_vfmadd_ps_load:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vfmaddps (%rdi), %xmm1, %xmm0, %xmm0 # encoding: [0xc4,0xe3,0xf9,0x68,0x07,0x10]
; CHECK-NEXT:    # xmm0 = (xmm0 * xmm1) + mem
; CHECK-NEXT:    retq # encoding: [0xc3]
  %x = load <4 x float>, ptr %a2
  %res = call < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float > %a0, < 4 x float > %a1, < 4 x float > %x)
  ret < 4 x float > %res
}
define < 4 x float > @test_x86_fma_vfmadd_ps_load2(< 4 x float > %a0, ptr %a1, < 4 x float > %a2) {
; CHECK-LABEL: test_x86_fma_vfmadd_ps_load2:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vfmaddps %xmm1, (%rdi), %xmm0, %xmm0 # encoding: [0xc4,0xe3,0x79,0x68,0x07,0x10]
; CHECK-NEXT:    # xmm0 = (xmm0 * mem) + xmm1
; CHECK-NEXT:    retq # encoding: [0xc3]
  %x = load <4 x float>, ptr %a1
  %res = call < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float > %a0, < 4 x float > %x, < 4 x float > %a2)
  ret < 4 x float > %res
}
declare < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float >, < 4 x float >, < 4 x float >) nounwind readnone

; To test execution dependency
define < 4 x float > @test_x86_fma_vfmadd_ps_load3(ptr %a0, ptr %a1, < 4 x float > %a2) {
; CHECK-LABEL: test_x86_fma_vfmadd_ps_load3:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vmovaps (%rdi), %xmm1 # encoding: [0xc5,0xf8,0x28,0x0f]
; CHECK-NEXT:    vfmaddps %xmm0, (%rsi), %xmm1, %xmm0 # encoding: [0xc4,0xe3,0x71,0x68,0x06,0x00]
; CHECK-NEXT:    # xmm0 = (xmm1 * mem) + xmm0
; CHECK-NEXT:    retq # encoding: [0xc3]
  %x = load <4 x float>, ptr %a0
  %y = load <4 x float>, ptr %a1
  %res = call < 4 x float > @llvm.x86.fma.vfmadd.ps(< 4 x float > %x, < 4 x float > %y, < 4 x float > %a2)
  ret < 4 x float > %res
}

define < 2 x double > @test_x86_fma_vfmadd_pd_load(< 2 x double > %a0, < 2 x double > %a1, ptr %a2) {
; CHECK-LABEL: test_x86_fma_vfmadd_pd_load:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vfmaddpd (%rdi), %xmm1, %xmm0, %xmm0 # encoding: [0xc4,0xe3,0xf9,0x69,0x07,0x10]
; CHECK-NEXT:    # xmm0 = (xmm0 * xmm1) + mem
; CHECK-NEXT:    retq # encoding: [0xc3]
  %x = load <2 x double>, ptr %a2
  %res = call < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double > %a0, < 2 x double > %a1, < 2 x double > %x)
  ret < 2 x double > %res
}
define < 2 x double > @test_x86_fma_vfmadd_pd_load2(< 2 x double > %a0, ptr %a1, < 2 x double > %a2) {
; CHECK-LABEL: test_x86_fma_vfmadd_pd_load2:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vfmaddpd %xmm1, (%rdi), %xmm0, %xmm0 # encoding: [0xc4,0xe3,0x79,0x69,0x07,0x10]
; CHECK-NEXT:    # xmm0 = (xmm0 * mem) + xmm1
; CHECK-NEXT:    retq # encoding: [0xc3]
  %x = load <2 x double>, ptr %a1
  %res = call < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double > %a0, < 2 x double > %x, < 2 x double > %a2)
  ret < 2 x double > %res
}
declare < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double >, < 2 x double >, < 2 x double >) nounwind readnone

; To test execution dependency
define < 2 x double > @test_x86_fma_vfmadd_pd_load3(ptr %a0, ptr %a1, < 2 x double > %a2) {
; CHECK-LABEL: test_x86_fma_vfmadd_pd_load3:
; CHECK:       # %bb.0:
; CHECK-NEXT:    vmovapd (%rdi), %xmm1 # encoding: [0xc5,0xf9,0x28,0x0f]
; CHECK-NEXT:    vfmaddpd %xmm0, (%rsi), %xmm1, %xmm0 # encoding: [0xc4,0xe3,0x71,0x69,0x06,0x00]
; CHECK-NEXT:    # xmm0 = (xmm1 * mem) + xmm0
; CHECK-NEXT:    retq # encoding: [0xc3]
  %x = load <2 x double>, ptr %a0
  %y = load <2 x double>, ptr %a1
  %res = call < 2 x double > @llvm.x86.fma.vfmadd.pd(< 2 x double > %x, < 2 x double > %y, < 2 x double > %a2)
  ret < 2 x double > %res
}