• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=x86 -mcpu=corei7 | FileCheck %s
2; RUN: llc < %s -march=x86 -mcpu=core-avx-i | FileCheck %s --check-prefix=AVX
3
4define <1 x float> @test1(<1 x double>* %p) nounwind {
5; CHECK-LABEL: test1:
6; CHECK:       # BB#0:
7; CHECK-NEXT:    pushl %eax
8; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
9; CHECK-NEXT:    movsd (%eax), %xmm0
10; CHECK-NEXT:    cvtsd2ss %xmm0, %xmm0
11; CHECK-NEXT:    movss %xmm0, (%esp)
12; CHECK-NEXT:    flds (%esp)
13; CHECK-NEXT:    popl %eax
14; CHECK-NEXT:    retl
15;
16; AVX-LABEL: test1:
17; AVX:       # BB#0:
18; AVX-NEXT:    pushl %eax
19; AVX-NEXT:    movl {{[0-9]+}}(%esp), %eax
20; AVX-NEXT:    vmovsd (%eax), %xmm0
21; AVX-NEXT:    vcvtsd2ss %xmm0, %xmm0, %xmm0
22; AVX-NEXT:    vmovss %xmm0, (%esp)
23; AVX-NEXT:    flds (%esp)
24; AVX-NEXT:    popl %eax
25; AVX-NEXT:    retl
26  %x = load <1 x double>, <1 x double>* %p
27  %y = fptrunc <1 x double> %x to <1 x float>
28  ret <1 x float> %y
29}
30
31define <2 x float> @test2(<2 x double>* %p) nounwind {
32; CHECK-LABEL: test2:
33; CHECK:       # BB#0:
34; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
35; CHECK-NEXT:    cvtpd2ps (%eax), %xmm0
36; CHECK-NEXT:    retl
37;
38; AVX-LABEL: test2:
39; AVX:       # BB#0:
40; AVX-NEXT:    movl {{[0-9]+}}(%esp), %eax
41; AVX-NEXT:    vcvtpd2psx (%eax), %xmm0
42; AVX-NEXT:    retl
43  %x = load <2 x double>, <2 x double>* %p
44  %y = fptrunc <2 x double> %x to <2 x float>
45  ret <2 x float> %y
46}
47
48define <4 x float> @test3(<4 x double>* %p) nounwind {
49; CHECK-LABEL: test3:
50; CHECK:       # BB#0:
51; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
52; CHECK-NEXT:    cvtpd2ps 16(%eax), %xmm1
53; CHECK-NEXT:    cvtpd2ps (%eax), %xmm0
54; CHECK-NEXT:    unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm1[0]
55; CHECK-NEXT:    retl
56;
57; AVX-LABEL: test3:
58; AVX:       # BB#0:
59; AVX-NEXT:    movl {{[0-9]+}}(%esp), %eax
60; AVX-NEXT:    vcvtpd2psy (%eax), %xmm0
61; AVX-NEXT:    retl
62  %x = load <4 x double>, <4 x double>* %p
63  %y = fptrunc <4 x double> %x to <4 x float>
64  ret <4 x float> %y
65}
66
67define <8 x float> @test4(<8 x double>* %p) nounwind {
68; CHECK-LABEL: test4:
69; CHECK:       # BB#0:
70; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
71; CHECK-NEXT:    cvtpd2ps 16(%eax), %xmm1
72; CHECK-NEXT:    cvtpd2ps (%eax), %xmm0
73; CHECK-NEXT:    unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm1[0]
74; CHECK-NEXT:    cvtpd2ps 48(%eax), %xmm2
75; CHECK-NEXT:    cvtpd2ps 32(%eax), %xmm1
76; CHECK-NEXT:    unpcklpd {{.*#+}} xmm1 = xmm1[0],xmm2[0]
77; CHECK-NEXT:    retl
78;
79; AVX-LABEL: test4:
80; AVX:       # BB#0:
81; AVX-NEXT:    movl {{[0-9]+}}(%esp), %eax
82; AVX-NEXT:    vcvtpd2psy (%eax), %xmm0
83; AVX-NEXT:    vcvtpd2psy 32(%eax), %xmm1
84; AVX-NEXT:    vinsertf128 $1, %xmm1, %ymm0, %ymm0
85; AVX-NEXT:    retl
86  %x = load <8 x double>, <8 x double>* %p
87  %y = fptrunc <8 x double> %x to <8 x float>
88  ret <8 x float> %y
89}
90
91
92