1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc -mtriple=x86_64-unknown-unknown < %s | FileCheck %s 3 4 define float @fadd_zero_f32(float %x) #0 { 5 ; CHECK-LABEL: fadd_zero_f32: 6 ; CHECK: # BB#0: 7 ; CHECK-NEXT: retq 8 %y = fadd float %x, 0.0 9 ret float %y 10 } 11 12 define <4 x float> @fadd_zero_4f32(<4 x float> %x) #0 { 13 ; CHECK-LABEL: fadd_zero_4f32: 14 ; CHECK: # BB#0: 15 ; CHECK-NEXT: retq 16 %y = fadd <4 x float> %x, zeroinitializer 17 ret <4 x float> %y 18 } 19 20 ; CHECK: float 3 21 define float @fadd_2const_f32(float %x) #0 { 22 ; CHECK-LABEL: fadd_2const_f32: 23 ; CHECK: # BB#0: 24 ; CHECK-NEXT: addss {{.*}}(%rip), %xmm0 25 ; CHECK-NEXT: retq 26 %y = fadd float %x, 1.0 27 %z = fadd float %y, 2.0 28 ret float %z 29 } 30 31 ; CHECK: float 5 32 ; CHECK: float 5 33 ; CHECK: float 5 34 ; CHECK: float 5 35 define <4 x float> @fadd_2const_4f32(<4 x float> %x) #0 { 36 ; CHECK-LABEL: fadd_2const_4f32: 37 ; CHECK: # BB#0: 38 ; CHECK-NEXT: addps {{.*}}(%rip), %xmm0 39 ; CHECK-NEXT: retq 40 %y = fadd <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 4.0> 41 %z = fadd <4 x float> %y, <float 4.0, float 3.0, float 2.0, float 1.0> 42 ret <4 x float> %z 43 } 44 45 ; CHECK: float 3 46 define float @fadd_x_fmul_x_c_f32(float %x) #0 { 47 ; CHECK-LABEL: fadd_x_fmul_x_c_f32: 48 ; CHECK: # BB#0: 49 ; CHECK-NEXT: mulss {{.*}}(%rip), %xmm0 50 ; CHECK-NEXT: retq 51 %y = fmul float %x, 2.0 52 %z = fadd float %x, %y 53 ret float %z 54 } 55 56 ; CHECK: float 2 57 ; CHECK: float 3 58 ; CHECK: float 4 59 ; CHECK: float 5 60 define <4 x float> @fadd_x_fmul_x_c_4f32(<4 x float> %x) #0 { 61 ; CHECK-LABEL: fadd_x_fmul_x_c_4f32: 62 ; CHECK: # BB#0: 63 ; CHECK-NEXT: mulps {{.*}}(%rip), %xmm0 64 ; CHECK-NEXT: retq 65 %y = fmul <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 4.0> 66 %z = fadd <4 x float> %x, %y 67 ret <4 x float> %z 68 } 69 70 ; CHECK: float 3 71 define float @fadd_fmul_x_c_x_f32(float %x) #0 { 72 ; CHECK-LABEL: fadd_fmul_x_c_x_f32: 73 ; CHECK: # BB#0: 74 ; CHECK-NEXT: mulss {{.*}}(%rip), %xmm0 75 ; CHECK-NEXT: retq 76 %y = fmul float %x, 2.0 77 %z = fadd float %y, %x 78 ret float %z 79 } 80 81 ; CHECK: float 2 82 ; CHECK: float 3 83 ; CHECK: float 4 84 ; CHECK: float 5 85 define <4 x float> @fadd_fmul_x_c_x_4f32(<4 x float> %x) #0 { 86 ; CHECK-LABEL: fadd_fmul_x_c_x_4f32: 87 ; CHECK: # BB#0: 88 ; CHECK-NEXT: mulps {{.*}}(%rip), %xmm0 89 ; CHECK-NEXT: retq 90 %y = fmul <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 4.0> 91 %z = fadd <4 x float> %y, %x 92 ret <4 x float> %z 93 } 94 95 ; CHECK: float 4 96 define float @fadd_fadd_x_x_fmul_x_c_f32(float %x) #0 { 97 ; CHECK-LABEL: fadd_fadd_x_x_fmul_x_c_f32: 98 ; CHECK: # BB#0: 99 ; CHECK-NEXT: mulss {{.*}}(%rip), %xmm0 100 ; CHECK-NEXT: retq 101 %y = fadd float %x, %x 102 %z = fmul float %x, 2.0 103 %w = fadd float %y, %z 104 ret float %w 105 } 106 107 ; CHECK: float 3 108 ; CHECK: float 4 109 ; CHECK: float 5 110 ; CHECK: float 6 111 define <4 x float> @fadd_fadd_x_x_fmul_x_c_4f32(<4 x float> %x) #0 { 112 ; CHECK-LABEL: fadd_fadd_x_x_fmul_x_c_4f32: 113 ; CHECK: # BB#0: 114 ; CHECK-NEXT: mulps {{.*}}(%rip), %xmm0 115 ; CHECK-NEXT: retq 116 %y = fadd <4 x float> %x, %x 117 %z = fmul <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 4.0> 118 %w = fadd <4 x float> %y, %z 119 ret <4 x float> %w 120 } 121 122 ; CHECK: float 4 123 define float @fadd_fmul_x_c_fadd_x_x_f32(float %x) #0 { 124 ; CHECK-LABEL: fadd_fmul_x_c_fadd_x_x_f32: 125 ; CHECK: # BB#0: 126 ; CHECK-NEXT: mulss {{.*}}(%rip), %xmm0 127 ; CHECK-NEXT: retq 128 %y = fadd float %x, %x 129 %z = fmul float %x, 2.0 130 %w = fadd float %z, %y 131 ret float %w 132 } 133 134 ; CHECK: float 3 135 ; CHECK: float 4 136 ; CHECK: float 5 137 ; CHECK: float 6 138 define <4 x float> @fadd_fmul_x_c_fadd_x_x_4f32(<4 x float> %x) #0 { 139 ; CHECK-LABEL: fadd_fmul_x_c_fadd_x_x_4f32: 140 ; CHECK: # BB#0: 141 ; CHECK-NEXT: mulps {{.*}}(%rip), %xmm0 142 ; CHECK-NEXT: retq 143 %y = fadd <4 x float> %x, %x 144 %z = fmul <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 4.0> 145 %w = fadd <4 x float> %z, %y 146 ret <4 x float> %w 147 } 148 149 ; CHECK: float 3 150 define float @fadd_x_fadd_x_x_f32(float %x) #0 { 151 ; CHECK-LABEL: fadd_x_fadd_x_x_f32: 152 ; CHECK: # BB#0: 153 ; CHECK-NEXT: mulss {{.*}}(%rip), %xmm0 154 ; CHECK-NEXT: retq 155 %y = fadd float %x, %x 156 %z = fadd float %x, %y 157 ret float %z 158 } 159 160 ; CHECK: float 3 161 ; CHECK: float 3 162 ; CHECK: float 3 163 ; CHECK: float 3 164 define <4 x float> @fadd_x_fadd_x_x_4f32(<4 x float> %x) #0 { 165 ; CHECK-LABEL: fadd_x_fadd_x_x_4f32: 166 ; CHECK: # BB#0: 167 ; CHECK-NEXT: mulps {{.*}}(%rip), %xmm0 168 ; CHECK-NEXT: retq 169 %y = fadd <4 x float> %x, %x 170 %z = fadd <4 x float> %x, %y 171 ret <4 x float> %z 172 } 173 174 ; CHECK: float 3 175 define float @fadd_fadd_x_x_x_f32(float %x) #0 { 176 ; CHECK-LABEL: fadd_fadd_x_x_x_f32: 177 ; CHECK: # BB#0: 178 ; CHECK-NEXT: mulss {{.*}}(%rip), %xmm0 179 ; CHECK-NEXT: retq 180 %y = fadd float %x, %x 181 %z = fadd float %y, %x 182 ret float %z 183 } 184 185 ; CHECK: float 3 186 ; CHECK: float 3 187 ; CHECK: float 3 188 ; CHECK: float 3 189 define <4 x float> @fadd_fadd_x_x_x_4f32(<4 x float> %x) #0 { 190 ; CHECK-LABEL: fadd_fadd_x_x_x_4f32: 191 ; CHECK: # BB#0: 192 ; CHECK-NEXT: mulps {{.*}}(%rip), %xmm0 193 ; CHECK-NEXT: retq 194 %y = fadd <4 x float> %x, %x 195 %z = fadd <4 x float> %y, %x 196 ret <4 x float> %z 197 } 198 199 ; CHECK: float 4 200 define float @fadd_fadd_x_x_fadd_x_x_f32(float %x) #0 { 201 ; CHECK-LABEL: fadd_fadd_x_x_fadd_x_x_f32: 202 ; CHECK: # BB#0: 203 ; CHECK-NEXT: mulss {{.*}}(%rip), %xmm0 204 ; CHECK-NEXT: retq 205 %y = fadd float %x, %x 206 %z = fadd float %y, %y 207 ret float %z 208 } 209 210 ; CHECK: float 4 211 ; CHECK: float 4 212 ; CHECK: float 4 213 ; CHECK: float 4 214 define <4 x float> @fadd_fadd_x_x_fadd_x_x_4f32(<4 x float> %x) #0 { 215 ; CHECK-LABEL: fadd_fadd_x_x_fadd_x_x_4f32: 216 ; CHECK: # BB#0: 217 ; CHECK-NEXT: mulps {{.*}}(%rip), %xmm0 218 ; CHECK-NEXT: retq 219 %y = fadd <4 x float> %x, %x 220 %z = fadd <4 x float> %y, %y 221 ret <4 x float> %z 222 } 223 224 attributes #0 = { "less-precise-fpmad"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" } 225