Change memcpy/memset/memmove to have dest and source alignments.
[oota-llvm.git] / test / Transforms / ScalarRepl / 2009-12-11-NeonTypes.ll
1 ; RUN: opt < %s -scalarrepl -S | FileCheck %s
2 ; Radar 7441282
3
4 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32-n32"
5 target triple = "thumbv7-apple-darwin10"
6
7 %struct.__neon_int16x8x2_t = type { <8 x i16>, <8 x i16> }
8 %struct.int16x8_t = type { <8 x i16> }
9 %struct.int16x8x2_t = type { [2 x %struct.int16x8_t] }
10 %union..0anon = type { %struct.int16x8x2_t }
11
12 define void @test(<8 x i16> %tmp.0, %struct.int16x8x2_t* %dst) nounwind {
13 ; CHECK-LABEL: @test(
14 ; CHECK-NOT: alloca
15 ; CHECK: "alloca point"
16 ; CHECK: store <8 x i16>
17 ; CHECK: store <8 x i16>
18
19 entry:
20   %tmp_addr = alloca %struct.int16x8_t
21   %dst_addr = alloca %struct.int16x8x2_t*
22   %__rv = alloca %union..0anon
23   %__bx = alloca %struct.int16x8_t
24   %__ax = alloca %struct.int16x8_t
25   %tmp2 = alloca %struct.int16x8x2_t
26   %0 = alloca %struct.int16x8x2_t
27   %"alloca point" = bitcast i32 0 to i32
28   %1 = getelementptr inbounds %struct.int16x8_t, %struct.int16x8_t* %tmp_addr, i32 0, i32 0
29   store <8 x i16> %tmp.0, <8 x i16>* %1
30   store %struct.int16x8x2_t* %dst, %struct.int16x8x2_t** %dst_addr
31   %2 = getelementptr inbounds %struct.int16x8_t, %struct.int16x8_t* %__ax, i32 0, i32 0
32   %3 = getelementptr inbounds %struct.int16x8_t, %struct.int16x8_t* %tmp_addr, i32 0, i32 0
33   %4 = load <8 x i16>, <8 x i16>* %3, align 16
34   store <8 x i16> %4, <8 x i16>* %2, align 16
35   %5 = getelementptr inbounds %struct.int16x8_t, %struct.int16x8_t* %__bx, i32 0, i32 0
36   %6 = getelementptr inbounds %struct.int16x8_t, %struct.int16x8_t* %tmp_addr, i32 0, i32 0
37   %7 = load <8 x i16>, <8 x i16>* %6, align 16
38   store <8 x i16> %7, <8 x i16>* %5, align 16
39   %8 = getelementptr inbounds %struct.int16x8_t, %struct.int16x8_t* %__ax, i32 0, i32 0
40   %9 = load <8 x i16>, <8 x i16>* %8, align 16
41   %10 = getelementptr inbounds %struct.int16x8_t, %struct.int16x8_t* %__bx, i32 0, i32 0
42   %11 = load <8 x i16>, <8 x i16>* %10, align 16
43   %12 = getelementptr inbounds %union..0anon, %union..0anon* %__rv, i32 0, i32 0
44   %13 = bitcast %struct.int16x8x2_t* %12 to %struct.__neon_int16x8x2_t*
45   %14 = shufflevector <8 x i16> %9, <8 x i16> %11, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
46   %15 = getelementptr inbounds %struct.__neon_int16x8x2_t, %struct.__neon_int16x8x2_t* %13, i32 0, i32 0
47   store <8 x i16> %14, <8 x i16>* %15
48   %16 = shufflevector <8 x i16> %9, <8 x i16> %11, <8 x i32> <i32 1, i32 9, i32 3, i32 11, i32 5, i32 13, i32 7, i32 15>
49   %17 = getelementptr inbounds %struct.__neon_int16x8x2_t, %struct.__neon_int16x8x2_t* %13, i32 0, i32 1
50   store <8 x i16> %16, <8 x i16>* %17
51   %18 = getelementptr inbounds %union..0anon, %union..0anon* %__rv, i32 0, i32 0
52   %19 = bitcast %struct.int16x8x2_t* %0 to i8*
53   %20 = bitcast %struct.int16x8x2_t* %18 to i8*
54   call void @llvm.memcpy.p0i8.p0i8.i32(i8* %19, i8* %20, i32 32, i1 false)
55   %tmp21 = bitcast %struct.int16x8x2_t* %tmp2 to i8*
56   %21 = bitcast %struct.int16x8x2_t* %0 to i8*
57   call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp21, i8* %21, i32 32, i1 false)
58   %22 = load %struct.int16x8x2_t*, %struct.int16x8x2_t** %dst_addr, align 4
59   %23 = bitcast %struct.int16x8x2_t* %22 to i8*
60   %tmp22 = bitcast %struct.int16x8x2_t* %tmp2 to i8*
61   call void @llvm.memcpy.p0i8.p0i8.i32(i8* %23, i8* %tmp22, i32 32, i1 false)
62   br label %return
63
64 return:                                           ; preds = %entry
65   ret void
66 }
67
68 ; Radar 7466574
69 %struct._NSRange = type { i64 }
70
71 define void @test_memcpy_self() nounwind {
72 entry:
73   %range = alloca %struct._NSRange
74   br i1 undef, label %cond.true, label %cond.false
75
76 cond.true:                                        ; preds = %entry
77   %tmp3 = bitcast %struct._NSRange* %range to i8*
78   %tmp4 = bitcast %struct._NSRange* %range to i8*
79   call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp3, i8* %tmp4, i32 8, i1 false)
80   ret void
81
82 cond.false:                                       ; preds = %entry
83   ret void
84
85 ; CHECK-LABEL: @test_memcpy_self(
86 ; CHECK-NOT: alloca
87 ; CHECK: br i1
88 }
89
90 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind