• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-- -mattr=+sse2  | FileCheck %s
3
4define float @ext_fadd_v4f32(<4 x float> %x) {
5; CHECK-LABEL: ext_fadd_v4f32:
6; CHECK:       # %bb.0:
7; CHECK-NEXT:    movhlps {{.*#+}} xmm0 = xmm0[1,1]
8; CHECK-NEXT:    addss {{.*}}(%rip), %xmm0
9; CHECK-NEXT:    retq
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
12  ret float %ext
13}
14
15define float @ext_fsub_v4f32(<4 x float> %x) {
16; CHECK-LABEL: ext_fsub_v4f32:
17; CHECK:       # %bb.0:
18; CHECK-NEXT:    shufps {{.*#+}} xmm0 = xmm0[1,1,1,1]
19; CHECK-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
20; CHECK-NEXT:    subss %xmm0, %xmm1
21; CHECK-NEXT:    movaps %xmm1, %xmm0
22; CHECK-NEXT:    retq
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
25  ret float %ext
26}
27
28define float @ext_fmul_v4f32(<4 x float> %x) {
29; CHECK-LABEL: ext_fmul_v4f32:
30; CHECK:       # %bb.0:
31; CHECK-NEXT:    shufps {{.*#+}} xmm0 = xmm0[3,3,3,3]
32; CHECK-NEXT:    mulss {{.*}}(%rip), %xmm0
33; CHECK-NEXT:    retq
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
36  ret float %ext
37}
38
39; X / 1.0 --> X
40
41define float @ext_fdiv_v4f32(<4 x float> %x) {
42; CHECK-LABEL: ext_fdiv_v4f32:
43; CHECK:       # %bb.0:
44; CHECK-NEXT:    retq
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
47  ret float %ext
48}
49
50define float @ext_fdiv_v4f32_constant_op0(<4 x float> %x) {
51; CHECK-LABEL: ext_fdiv_v4f32_constant_op0:
52; CHECK:       # %bb.0:
53; CHECK-NEXT:    shufps {{.*#+}} xmm0 = xmm0[1,1,1,1]
54; CHECK-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
55; CHECK-NEXT:    divss %xmm0, %xmm1
56; CHECK-NEXT:    movaps %xmm1, %xmm0
57; CHECK-NEXT:    retq
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
60  ret float %ext
61}
62
63define float @ext_frem_v4f32(<4 x float> %x) {
64; CHECK-LABEL: ext_frem_v4f32:
65; CHECK:       # %bb.0:
66; CHECK-NEXT:    movhlps {{.*#+}} xmm0 = xmm0[1,1]
67; CHECK-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
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
71  ret float %ext
72}
73
74define float @ext_frem_v4f32_constant_op0(<4 x float> %x) {
75; CHECK-LABEL: ext_frem_v4f32_constant_op0:
76; CHECK:       # %bb.0:
77; CHECK-NEXT:    movaps %xmm0, %xmm1
78; CHECK-NEXT:    shufps {{.*#+}} xmm1 = xmm1[1,1],xmm0[1,1]
79; CHECK-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
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
83  ret float %ext
84}
85
86define float @ext_maxnum_v4f32(<4 x float> %x) nounwind {
87; CHECK-LABEL: ext_maxnum_v4f32:
88; CHECK:       # %bb.0:
89; CHECK-NEXT:    movhlps {{.*#+}} xmm0 = xmm0[1,1]
90; CHECK-NEXT:    maxss {{.*}}(%rip), %xmm0
91; CHECK-NEXT:    retq
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
94  ret float %r
95}
96
97define double @ext_minnum_v2f64(<2 x double> %x) nounwind {
98; CHECK-LABEL: ext_minnum_v2f64:
99; CHECK:       # %bb.0:
100; CHECK-NEXT:    unpckhpd {{.*#+}} xmm0 = xmm0[1,1]
101; CHECK-NEXT:    minsd {{.*}}(%rip), %xmm0
102; CHECK-NEXT:    retq
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
105  ret double %r
106}
107
108;define double @ext_maximum_v4f64(<2 x double> %x) nounwind {
109;  %v = call <2 x double> @llvm.maximum.v2f64(<2 x double> %x, <2 x double> <double 42.0, double 43.0>)
110;  %r = extractelement <2 x double> %v, i32 1
111;  ret double %r
112;}
113
114;define float @ext_minimum_v4f32(<4 x float> %x) nounwind {
115;  %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>)
116;  %r = extractelement <4 x float> %v, i32 1
117;  ret float %r
118;}
119
120declare <4 x float> @llvm.maxnum.v4f32(<4 x float>, <4 x float>)
121declare <2 x double> @llvm.minnum.v2f64(<2 x double>, <2 x double>)
122