• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-pc-linux-gnu -mcpu=corei7 | FileCheck %s
3; RUN: llc < %s -mtriple=i686-pc-linux-gnu -mcpu=core-avx-i | FileCheck %s --check-prefix=AVX
4
5define <1 x float> @test1(<1 x double> %x) nounwind {
6; CHECK-LABEL: test1:
7; CHECK:       # %bb.0:
8; CHECK-NEXT:    pushl %eax
9; CHECK-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
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:    vmovsd {{.*#+}} xmm0 = mem[0],zero
20; AVX-NEXT:    vcvtsd2ss %xmm0, %xmm0, %xmm0
21; AVX-NEXT:    vmovss %xmm0, (%esp)
22; AVX-NEXT:    flds (%esp)
23; AVX-NEXT:    popl %eax
24; AVX-NEXT:    retl
25  %y = fptrunc <1 x double> %x to <1 x float>
26  ret <1 x float> %y
27}
28
29define <2 x float> @test2(<2 x double> %x) nounwind {
30; CHECK-LABEL: test2:
31; CHECK:       # %bb.0:
32; CHECK-NEXT:    cvtpd2ps %xmm0, %xmm0
33; CHECK-NEXT:    retl
34;
35; AVX-LABEL: test2:
36; AVX:       # %bb.0:
37; AVX-NEXT:    vcvtpd2ps %xmm0, %xmm0
38; AVX-NEXT:    retl
39  %y = fptrunc <2 x double> %x to <2 x float>
40  ret <2 x float> %y
41}
42
43define <4 x float> @test3(<4 x double> %x) nounwind {
44; CHECK-LABEL: test3:
45; CHECK:       # %bb.0:
46; CHECK-NEXT:    cvtpd2ps %xmm1, %xmm1
47; CHECK-NEXT:    cvtpd2ps %xmm0, %xmm0
48; CHECK-NEXT:    unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm1[0]
49; CHECK-NEXT:    retl
50;
51; AVX-LABEL: test3:
52; AVX:       # %bb.0:
53; AVX-NEXT:    vcvtpd2ps %ymm0, %xmm0
54; AVX-NEXT:    vzeroupper
55; AVX-NEXT:    retl
56  %y = fptrunc <4 x double> %x to <4 x float>
57  ret <4 x float> %y
58}
59
60define <8 x float> @test4(<8 x double> %x) nounwind {
61; CHECK-LABEL: test4:
62; CHECK:       # %bb.0:
63; CHECK-NEXT:    subl $12, %esp
64; CHECK-NEXT:    cvtpd2ps %xmm1, %xmm1
65; CHECK-NEXT:    cvtpd2ps %xmm0, %xmm0
66; CHECK-NEXT:    unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm1[0]
67; CHECK-NEXT:    cvtpd2ps %xmm2, %xmm1
68; CHECK-NEXT:    cvtpd2ps {{[0-9]+}}(%esp), %xmm2
69; CHECK-NEXT:    unpcklpd {{.*#+}} xmm1 = xmm1[0],xmm2[0]
70; CHECK-NEXT:    addl $12, %esp
71; CHECK-NEXT:    retl
72;
73; AVX-LABEL: test4:
74; AVX:       # %bb.0:
75; AVX-NEXT:    vcvtpd2ps %ymm0, %xmm0
76; AVX-NEXT:    vcvtpd2ps %ymm1, %xmm1
77; AVX-NEXT:    vinsertf128 $1, %xmm1, %ymm0, %ymm0
78; AVX-NEXT:    retl
79  %y = fptrunc <8 x double> %x to <8 x float>
80  ret <8 x float> %y
81}
82
83
84