1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+sse2 | FileCheck %s
4 define float @ext_fadd_v4f32(<4 x float> %x) {
5 ; CHECK-LABEL: ext_fadd_v4f32:
7 ; CHECK-NEXT: movhlps {{.*#+}} xmm0 = xmm0[1,1]
8 ; CHECK-NEXT: addss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
10 %bo = fadd <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 42.0>
11 %ext = extractelement <4 x float> %bo, i32 2
15 define float @ext_fsub_v4f32(<4 x float> %x) {
16 ; CHECK-LABEL: ext_fsub_v4f32:
18 ; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,1,1,1]
19 ; CHECK-NEXT: movss {{.*#+}} xmm1 = [2.0E+0,0.0E+0,0.0E+0,0.0E+0]
20 ; CHECK-NEXT: subss %xmm0, %xmm1
21 ; CHECK-NEXT: movaps %xmm1, %xmm0
23 %bo = fsub <4 x float> <float 1.0, float 2.0, float 3.0, float 42.0>, %x
24 %ext = extractelement <4 x float> %bo, i32 1
28 define float @ext_fmul_v4f32(<4 x float> %x) {
29 ; CHECK-LABEL: ext_fmul_v4f32:
31 ; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,3,3,3]
32 ; CHECK-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
34 %bo = fmul <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 42.0>
35 %ext = extractelement <4 x float> %bo, i32 3
41 define float @ext_fdiv_v4f32(<4 x float> %x) {
42 ; CHECK-LABEL: ext_fdiv_v4f32:
45 %bo = fdiv <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 42.0>
46 %ext = extractelement <4 x float> %bo, i32 0
50 define float @ext_fdiv_v4f32_constant_op0(<4 x float> %x) {
51 ; CHECK-LABEL: ext_fdiv_v4f32_constant_op0:
53 ; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,1,1,1]
54 ; CHECK-NEXT: movss {{.*#+}} xmm1 = [2.0E+0,0.0E+0,0.0E+0,0.0E+0]
55 ; CHECK-NEXT: divss %xmm0, %xmm1
56 ; CHECK-NEXT: movaps %xmm1, %xmm0
58 %bo = fdiv <4 x float> <float 1.0, float 2.0, float 3.0, float 42.0>, %x
59 %ext = extractelement <4 x float> %bo, i32 1
63 define float @ext_frem_v4f32(<4 x float> %x) {
64 ; CHECK-LABEL: ext_frem_v4f32:
66 ; CHECK-NEXT: movhlps {{.*#+}} xmm0 = xmm0[1,1]
67 ; CHECK-NEXT: movss {{.*#+}} xmm1 = [3.0E+0,0.0E+0,0.0E+0,0.0E+0]
68 ; CHECK-NEXT: jmp fmodf@PLT # TAILCALL
69 %bo = frem <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 42.0>
70 %ext = extractelement <4 x float> %bo, i32 2
74 define float @ext_frem_v4f32_constant_op0(<4 x float> %x) {
75 ; CHECK-LABEL: ext_frem_v4f32_constant_op0:
77 ; CHECK-NEXT: movaps %xmm0, %xmm1
78 ; CHECK-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,1],xmm0[1,1]
79 ; CHECK-NEXT: movss {{.*#+}} xmm0 = [2.0E+0,0.0E+0,0.0E+0,0.0E+0]
80 ; CHECK-NEXT: jmp fmodf@PLT # TAILCALL
81 %bo = frem <4 x float> <float 1.0, float 2.0, float 3.0, float 42.0>, %x
82 %ext = extractelement <4 x float> %bo, i32 1
86 define float @ext_maxnum_v4f32(<4 x float> %x) nounwind {
87 ; CHECK-LABEL: ext_maxnum_v4f32:
89 ; CHECK-NEXT: movhlps {{.*#+}} xmm0 = xmm0[1,1]
90 ; CHECK-NEXT: maxss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
92 %v = call <4 x float> @llvm.maxnum.v4f32(<4 x float> %x, <4 x float> <float 0.0, float 1.0, float 2.0, float 3.0>)
93 %r = extractelement <4 x float> %v, i32 2
97 define double @ext_minnum_v2f64(<2 x double> %x) nounwind {
98 ; CHECK-LABEL: ext_minnum_v2f64:
100 ; CHECK-NEXT: unpckhpd {{.*#+}} xmm0 = xmm0[1,1]
101 ; CHECK-NEXT: minsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
103 %v = call <2 x double> @llvm.minnum.v2f64(<2 x double> <double 0.0, double 1.0>, <2 x double> %x)
104 %r = extractelement <2 x double> %v, i32 1
108 define double @ext_maximum_v4f64(<2 x double> %x) nounwind {
109 ; CHECK-LABEL: ext_maximum_v4f64:
111 ; CHECK-NEXT: unpckhpd {{.*#+}} xmm0 = xmm0[1,1]
112 ; CHECK-NEXT: movsd {{.*#+}} xmm1 = [4.3E+1,0.0E+0]
113 ; CHECK-NEXT: maxsd %xmm0, %xmm1
114 ; CHECK-NEXT: movapd %xmm1, %xmm0
116 %v = call <2 x double> @llvm.maximum.v2f64(<2 x double> %x, <2 x double> <double 42.0, double 43.0>)
117 %r = extractelement <2 x double> %v, i32 1
121 define float @ext_minimum_v4f32(<4 x float> %x) nounwind {
122 ; CHECK-LABEL: ext_minimum_v4f32:
124 ; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,1,1,1]
125 ; CHECK-NEXT: movss {{.*#+}} xmm1 = [1.0E+0,0.0E+0,0.0E+0,0.0E+0]
126 ; CHECK-NEXT: minss %xmm0, %xmm1
127 ; CHECK-NEXT: movaps %xmm1, %xmm0
129 %v = call <4 x float> @llvm.minimum.v4f32(<4 x float> %x, <4 x float> <float 0.0, float 1.0, float 2.0, float 42.0>)
130 %r = extractelement <4 x float> %v, i32 1
134 declare <4 x float> @llvm.maxnum.v4f32(<4 x float>, <4 x float>)
135 declare <2 x double> @llvm.minnum.v2f64(<2 x double>, <2 x double>)
136 declare <2 x double> @llvm.maximum.v2f64(<2 x double>, <2 x double>)
137 declare <4 x float> @llvm.minimum.v4f32(<4 x float>, <4 x float>)