fa08c1f69b279116d157d17d87a745c8d5718322
[oota-llvm.git] / test / CodeGen / ARM / vector-DAGCombine.ll
1 ; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s
2
3 ; PR7158
4 define arm_aapcs_vfpcc i32 @test_pr7158() nounwind {
5 bb.nph55.bb.nph55.split_crit_edge:
6   br label %bb3
7
8 bb3:                                              ; preds = %bb3, %bb.nph55.bb.nph55.split_crit_edge
9   br i1 undef, label %bb.i19, label %bb3
10
11 bb.i19:                                           ; preds = %bb.i19, %bb3
12   %0 = insertelement <4 x float> undef, float undef, i32 3 ; <<4 x float>> [#uses=3]
13   %1 = fmul <4 x float> %0, %0                    ; <<4 x float>> [#uses=1]
14   %2 = bitcast <4 x float> %1 to <2 x double>     ; <<2 x double>> [#uses=0]
15   %3 = fmul <4 x float> %0, undef                 ; <<4 x float>> [#uses=0]
16   br label %bb.i19
17 }
18
19 ; Check that the DAG combiner does not arbitrarily modify BUILD_VECTORs
20 ; after legalization.
21 define void @test_illegal_build_vector() nounwind {
22 entry:
23   store <2 x i64> undef, <2 x i64>* undef, align 16
24   %0 = load <16 x i8>* undef, align 16            ; <<16 x i8>> [#uses=1]
25   %1 = or <16 x i8> zeroinitializer, %0           ; <<16 x i8>> [#uses=1]
26   store <16 x i8> %1, <16 x i8>* undef, align 16
27   ret void
28 }
29
30 ; Radar 8407927: Make sure that VMOVRRD gets optimized away when the result is
31 ; converted back to be used as a vector type.
32 ; CHECK: test_vmovrrd_combine
33 define <4 x i32> @test_vmovrrd_combine() nounwind {
34 entry:
35   br i1 undef, label %bb1, label %bb2
36
37 bb1:
38   %0 = bitcast <2 x i64> zeroinitializer to <2 x double>
39   %1 = extractelement <2 x double> %0, i32 0
40   %2 = bitcast double %1 to i64
41   %3 = insertelement <1 x i64> undef, i64 %2, i32 0
42 ; CHECK-NOT: vmov s
43 ; CHECK: vext.8
44   %4 = shufflevector <1 x i64> %3, <1 x i64> undef, <2 x i32> <i32 0, i32 1>
45   %tmp2006.3 = bitcast <2 x i64> %4 to <16 x i8>
46   %5 = shufflevector <16 x i8> %tmp2006.3, <16 x i8> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19>
47   %tmp2004.3 = bitcast <16 x i8> %5 to <4 x i32>
48   br i1 undef, label %bb2, label %bb1
49
50 bb2:
51   %result = phi <4 x i32> [ undef, %entry ], [ %tmp2004.3, %bb1 ]
52   ret <4 x i32> %result
53 }
54
55 ; Test trying to do a ShiftCombine on illegal types.
56 ; The vector should be split first.
57 define void @lshrIllegalType(<8 x i32>* %A) nounwind {
58        %tmp1 = load <8 x i32>* %A
59        %tmp2 = lshr <8 x i32> %tmp1, < i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
60        store <8 x i32> %tmp2, <8 x i32>* %A
61        ret void
62 }
63