temporarily disable this.
[oota-llvm.git] / test / CodeGen / X86 / vec_ss_load_fold.ll
1 ; RUN: llc < %s -march=x86 -mattr=+sse,+sse2,+sse41 | FileCheck %s
2 ; XFAIL: *
3
4 target datalayout = "e-p:32:32"
5 target triple = "i686-apple-darwin8.7.2"
6
7 define i16 @test1(float %f) nounwind {
8         %tmp = insertelement <4 x float> undef, float %f, i32 0         ; <<4 x float>> [#uses=1]
9         %tmp10 = insertelement <4 x float> %tmp, float 0.000000e+00, i32 1              ; <<4 x float>> [#uses=1]
10         %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, i32 2            ; <<4 x float>> [#uses=1]
11         %tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, i32 3            ; <<4 x float>> [#uses=1]
12         %tmp28 = tail call <4 x float> @llvm.x86.sse.sub.ss( <4 x float> %tmp12, <4 x float> < float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > )               ; <<4 x float>> [#uses=1]
13         %tmp37 = tail call <4 x float> @llvm.x86.sse.mul.ss( <4 x float> %tmp28, <4 x float> < float 5.000000e-01, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > )               ; <<4 x float>> [#uses=1]
14         %tmp48 = tail call <4 x float> @llvm.x86.sse.min.ss( <4 x float> %tmp37, <4 x float> < float 6.553500e+04, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > )               ; <<4 x float>> [#uses=1]
15         %tmp59 = tail call <4 x float> @llvm.x86.sse.max.ss( <4 x float> %tmp48, <4 x float> zeroinitializer )          ; <<4 x float>> [#uses=1]
16         %tmp.upgrd.1 = tail call i32 @llvm.x86.sse.cvttss2si( <4 x float> %tmp59 )              ; <i32> [#uses=1]
17         %tmp69 = trunc i32 %tmp.upgrd.1 to i16          ; <i16> [#uses=1]
18         ret i16 %tmp69
19 ; CHECK: test1:
20 ; CHECK: subss  LCPI1_
21 ; CHECK: mulss  LCPI1_
22 ; CHECK: minss  LCPI1_
23 }
24
25 define i16 @test2(float %f) nounwind {
26         %tmp28 = fsub float %f, 1.000000e+00            ; <float> [#uses=1]
27         %tmp37 = fmul float %tmp28, 5.000000e-01                ; <float> [#uses=1]
28         %tmp375 = insertelement <4 x float> undef, float %tmp37, i32 0          ; <<4 x float>> [#uses=1]
29         %tmp48 = tail call <4 x float> @llvm.x86.sse.min.ss( <4 x float> %tmp375, <4 x float> < float 6.553500e+04, float undef, float undef, float undef > )           ; <<4 x float>> [#uses=1]
30         %tmp59 = tail call <4 x float> @llvm.x86.sse.max.ss( <4 x float> %tmp48, <4 x float> < float 0.000000e+00, float undef, float undef, float undef > )            ; <<4 x float>> [#uses=1]
31         %tmp = tail call i32 @llvm.x86.sse.cvttss2si( <4 x float> %tmp59 )              ; <i32> [#uses=1]
32         %tmp69 = trunc i32 %tmp to i16          ; <i16> [#uses=1]
33         ret i16 %tmp69
34 ; CHECK: test2:
35 ; CHECK: addss  LCPI2_
36 ; CHECK: mulss  LCPI2_
37 ; CHECK: minss  LCPI2_
38 }
39
40 declare <4 x float> @llvm.x86.sse.sub.ss(<4 x float>, <4 x float>)
41
42 declare <4 x float> @llvm.x86.sse.mul.ss(<4 x float>, <4 x float>)
43
44 declare <4 x float> @llvm.x86.sse.min.ss(<4 x float>, <4 x float>)
45
46 declare <4 x float> @llvm.x86.sse.max.ss(<4 x float>, <4 x float>)
47
48 declare i32 @llvm.x86.sse.cvttss2si(<4 x float>)
49
50
51 declare <4 x float> @llvm.x86.sse41.round.ss(<4 x float>, <4 x float>, i32)
52 declare <4 x float> @f()
53
54 define <4 x float> @test3(<4 x float> %A, float *%b, i32 %C) nounwind {
55   %a = load float *%b
56   %B = insertelement <4 x float> undef, float %a, i32 0
57   %X = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %A, <4 x float> %B, i32 4)
58   ret <4 x float> %X
59 ; CHECK: test3:
60 ; CHECK: roundss        $4, (%eax), %xmm0
61 }
62
63 define <4 x float> @test4(<4 x float> %A, float *%b, i32 %C) nounwind {
64   %a = load float *%b
65   %B = insertelement <4 x float> undef, float %a, i32 0
66   %q = call <4 x float> @f()
67   %X = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %q, <4 x float> %B, i32 4)
68   ret <4 x float> %X
69 ; CHECK: test4:
70 ; CHECK: movss  (%eax), %xmm
71 ; CHECK: call
72 ; CHECK: roundss $4, %xmm{{.*}}, %xmm0
73 }