1 ; RUN: llc -march=x86-64 < %s | FileCheck %s
3 ; CHECK-LABEL: fmul2_f32:
4 ; CHECK: addss %xmm0, %xmm0
5 define float @fmul2_f32(float %x) {
6 %y = fmul float %x, 2.0
10 ; fmul 2.0, x -> fadd x, x for vectors.
12 ; CHECK-LABEL: fmul2_v4f32:
13 ; CHECK: addps %xmm0, %xmm0
15 define <4 x float> @fmul2_v4f32(<4 x float> %x) {
16 %y = fmul <4 x float> %x, <float 2.0, float 2.0, float 2.0, float 2.0>
20 ; CHECK-LABEL: constant_fold_fmul_v4f32:
23 define <4 x float> @constant_fold_fmul_v4f32(<4 x float> %x) {
24 %y = fmul <4 x float> <float 4.0, float 4.0, float 4.0, float 4.0>, <float 2.0, float 2.0, float 2.0, float 2.0>
28 ; CHECK-LABEL: fmul0_v4f32:
29 ; CHECK: xorps %xmm0, %xmm0
31 define <4 x float> @fmul0_v4f32(<4 x float> %x) #0 {
32 %y = fmul <4 x float> %x, <float 0.0, float 0.0, float 0.0, float 0.0>
36 ; CHECK-LABEL: fmul_c2_c4_v4f32:
41 define <4 x float> @fmul_c2_c4_v4f32(<4 x float> %x) #0 {
42 %y = fmul <4 x float> %x, <float 2.0, float 2.0, float 2.0, float 2.0>
43 %z = fmul <4 x float> %y, <float 4.0, float 4.0, float 4.0, float 4.0>
47 ; CHECK-LABEL: fmul_c3_c4_v4f32:
52 define <4 x float> @fmul_c3_c4_v4f32(<4 x float> %x) #0 {
53 %y = fmul <4 x float> %x, <float 3.0, float 3.0, float 3.0, float 3.0>
54 %z = fmul <4 x float> %y, <float 4.0, float 4.0, float 4.0, float 4.0>
58 ; CHECK-LABEL: fmul_c2_c4_f32:
63 define float @fmul_c2_c4_f32(float %x) #0 {
64 %y = fmul float %x, 2.0
65 %z = fmul float %y, 4.0
69 ; CHECK-LABEL: fmul_c3_c4_f32:
74 define float @fmul_c3_c4_f32(float %x) #0 {
75 %y = fmul float %x, 3.0
76 %z = fmul float %y, 4.0
80 ; CHECK-LABEL: fmul_fneg_fneg_f32:
81 ; CHECK: mulss %xmm1, %xmm0
83 define float @fmul_fneg_fneg_f32(float %x, float %y) {
84 %x.neg = fsub float -0.0, %x
85 %y.neg = fsub float -0.0, %y
86 %mul = fmul float %x.neg, %y.neg
89 ; CHECK-LABEL: fmul_fneg_fneg_v4f32:
90 ; CHECK: mulps {{%xmm1|\(%rdx\)}}, %xmm0
92 define <4 x float> @fmul_fneg_fneg_v4f32(<4 x float> %x, <4 x float> %y) {
93 %x.neg = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %x
94 %y.neg = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %y
95 %mul = fmul <4 x float> %x.neg, %y.neg
99 attributes #0 = { "less-precise-fpmad"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" }