[X86] Add XSAVE intrinsic family
[oota-llvm.git] / test / CodeGen / X86 / MergeConsecutiveStores.ll
index 6bbcdaed872765a81e72804caf9eba91b755b322..6670bbe02772cd134c34fd545379d06863ec05d5 100644 (file)
@@ -1,13 +1,10 @@
-; RUN: llc -march=x86-64 -mcpu=corei7 -mattr=+avx < %s | FileCheck %s
-; RUN: llc -march=x86-64 -mcpu=corei7 -mattr=+avx -addr-sink-using-gep=1 < %s | FileCheck %s
-
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.8.0"
+; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx -addr-sink-using-gep=1 < %s | FileCheck %s
 
 %struct.A = type { i8, i8, i8, i8, i8, i8, i8, i8 }
 %struct.B = type { i32, i32, i32, i32, i32, i32, i32, i32 }
 
-; CHECK: merge_const_store
+; CHECK-LABEL: merge_const_store:
 ; save 1,2,3 ... as one big integer.
 ; CHECK: movabsq $578437695752307201
 ; CHECK: ret
@@ -17,24 +14,24 @@ define void @merge_const_store(i32 %count, %struct.A* nocapture %p) nounwind uwt
 .lr.ph:
   %i.02 = phi i32 [ %10, %.lr.ph ], [ 0, %0 ]
   %.01 = phi %struct.A* [ %11, %.lr.ph ], [ %p, %0 ]
-  %2 = getelementptr inbounds %struct.A* %.01, i64 0, i32 0
+  %2 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 0
   store i8 1, i8* %2, align 1
-  %3 = getelementptr inbounds %struct.A* %.01, i64 0, i32 1
+  %3 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 1
   store i8 2, i8* %3, align 1
-  %4 = getelementptr inbounds %struct.A* %.01, i64 0, i32 2
+  %4 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 2
   store i8 3, i8* %4, align 1
-  %5 = getelementptr inbounds %struct.A* %.01, i64 0, i32 3
+  %5 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 3
   store i8 4, i8* %5, align 1
-  %6 = getelementptr inbounds %struct.A* %.01, i64 0, i32 4
+  %6 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 4
   store i8 5, i8* %6, align 1
-  %7 = getelementptr inbounds %struct.A* %.01, i64 0, i32 5
+  %7 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 5
   store i8 6, i8* %7, align 1
-  %8 = getelementptr inbounds %struct.A* %.01, i64 0, i32 6
+  %8 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 6
   store i8 7, i8* %8, align 1
-  %9 = getelementptr inbounds %struct.A* %.01, i64 0, i32 7
+  %9 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 7
   store i8 8, i8* %9, align 1
   %10 = add nsw i32 %i.02, 1
-  %11 = getelementptr inbounds %struct.A* %.01, i64 1
+  %11 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 1
   %exitcond = icmp eq i32 %10, %count
   br i1 %exitcond, label %._crit_edge, label %.lr.ph
 ._crit_edge:
@@ -42,7 +39,7 @@ define void @merge_const_store(i32 %count, %struct.A* nocapture %p) nounwind uwt
 }
 
 ; No vectors because we use noimplicitfloat
-; CHECK: merge_const_store_no_vec
+; CHECK-LABEL: merge_const_store_no_vec:
 ; CHECK-NOT: vmovups
 ; CHECK: ret
 define void @merge_const_store_no_vec(i32 %count, %struct.B* nocapture %p) noimplicitfloat{
@@ -51,24 +48,24 @@ define void @merge_const_store_no_vec(i32 %count, %struct.B* nocapture %p) noimp
 .lr.ph:
   %i.02 = phi i32 [ %10, %.lr.ph ], [ 0, %0 ]
   %.01 = phi %struct.B* [ %11, %.lr.ph ], [ %p, %0 ]
-  %2 = getelementptr inbounds %struct.B* %.01, i64 0, i32 0
+  %2 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 0
   store i32 0, i32* %2, align 4
-  %3 = getelementptr inbounds %struct.B* %.01, i64 0, i32 1
+  %3 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 1
   store i32 0, i32* %3, align 4
-  %4 = getelementptr inbounds %struct.B* %.01, i64 0, i32 2
+  %4 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 2
   store i32 0, i32* %4, align 4
-  %5 = getelementptr inbounds %struct.B* %.01, i64 0, i32 3
+  %5 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 3
   store i32 0, i32* %5, align 4
-  %6 = getelementptr inbounds %struct.B* %.01, i64 0, i32 4
+  %6 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 4
   store i32 0, i32* %6, align 4
-  %7 = getelementptr inbounds %struct.B* %.01, i64 0, i32 5
+  %7 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 5
   store i32 0, i32* %7, align 4
-  %8 = getelementptr inbounds %struct.B* %.01, i64 0, i32 6
+  %8 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 6
   store i32 0, i32* %8, align 4
-  %9 = getelementptr inbounds %struct.B* %.01, i64 0, i32 7
+  %9 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 7
   store i32 0, i32* %9, align 4
   %10 = add nsw i32 %i.02, 1
-  %11 = getelementptr inbounds %struct.B* %.01, i64 1
+  %11 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 1
   %exitcond = icmp eq i32 %10, %count
   br i1 %exitcond, label %._crit_edge, label %.lr.ph
 ._crit_edge:
@@ -76,7 +73,7 @@ define void @merge_const_store_no_vec(i32 %count, %struct.B* nocapture %p) noimp
 }
 
 ; Move the constants using a single vector store.
-; CHECK: merge_const_store_vec
+; CHECK-LABEL: merge_const_store_vec:
 ; CHECK: vmovups
 ; CHECK: ret
 define void @merge_const_store_vec(i32 %count, %struct.B* nocapture %p) nounwind uwtable noinline ssp {
@@ -85,24 +82,24 @@ define void @merge_const_store_vec(i32 %count, %struct.B* nocapture %p) nounwind
 .lr.ph:
   %i.02 = phi i32 [ %10, %.lr.ph ], [ 0, %0 ]
   %.01 = phi %struct.B* [ %11, %.lr.ph ], [ %p, %0 ]
-  %2 = getelementptr inbounds %struct.B* %.01, i64 0, i32 0
+  %2 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 0
   store i32 0, i32* %2, align 4
-  %3 = getelementptr inbounds %struct.B* %.01, i64 0, i32 1
+  %3 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 1
   store i32 0, i32* %3, align 4
-  %4 = getelementptr inbounds %struct.B* %.01, i64 0, i32 2
+  %4 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 2
   store i32 0, i32* %4, align 4
-  %5 = getelementptr inbounds %struct.B* %.01, i64 0, i32 3
+  %5 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 3
   store i32 0, i32* %5, align 4
-  %6 = getelementptr inbounds %struct.B* %.01, i64 0, i32 4
+  %6 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 4
   store i32 0, i32* %6, align 4
-  %7 = getelementptr inbounds %struct.B* %.01, i64 0, i32 5
+  %7 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 5
   store i32 0, i32* %7, align 4
-  %8 = getelementptr inbounds %struct.B* %.01, i64 0, i32 6
+  %8 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 6
   store i32 0, i32* %8, align 4
-  %9 = getelementptr inbounds %struct.B* %.01, i64 0, i32 7
+  %9 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 7
   store i32 0, i32* %9, align 4
   %10 = add nsw i32 %i.02, 1
-  %11 = getelementptr inbounds %struct.B* %.01, i64 1
+  %11 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 1
   %exitcond = icmp eq i32 %10, %count
   br i1 %exitcond, label %._crit_edge, label %.lr.ph
 ._crit_edge:
@@ -110,7 +107,7 @@ define void @merge_const_store_vec(i32 %count, %struct.B* nocapture %p) nounwind
 }
 
 ; Move the first 4 constants as a single vector. Move the rest as scalars.
-; CHECK: merge_nonconst_store
+; CHECK-LABEL: merge_nonconst_store:
 ; CHECK: movl $67305985
 ; CHECK: movb
 ; CHECK: movb
@@ -123,24 +120,24 @@ define void @merge_nonconst_store(i32 %count, i8 %zz, %struct.A* nocapture %p) n
 .lr.ph:
   %i.02 = phi i32 [ %10, %.lr.ph ], [ 0, %0 ]
   %.01 = phi %struct.A* [ %11, %.lr.ph ], [ %p, %0 ]
-  %2 = getelementptr inbounds %struct.A* %.01, i64 0, i32 0
+  %2 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 0
   store i8 1, i8* %2, align 1
-  %3 = getelementptr inbounds %struct.A* %.01, i64 0, i32 1
+  %3 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 1
   store i8 2, i8* %3, align 1
-  %4 = getelementptr inbounds %struct.A* %.01, i64 0, i32 2
+  %4 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 2
   store i8 3, i8* %4, align 1
-  %5 = getelementptr inbounds %struct.A* %.01, i64 0, i32 3
+  %5 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 3
   store i8 4, i8* %5, align 1
-  %6 = getelementptr inbounds %struct.A* %.01, i64 0, i32 4
+  %6 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 4
   store i8 %zz, i8* %6, align 1                     ;  <----------- Not a const;
-  %7 = getelementptr inbounds %struct.A* %.01, i64 0, i32 5
+  %7 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 5
   store i8 6, i8* %7, align 1
-  %8 = getelementptr inbounds %struct.A* %.01, i64 0, i32 6
+  %8 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 6
   store i8 7, i8* %8, align 1
-  %9 = getelementptr inbounds %struct.A* %.01, i64 0, i32 7
+  %9 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 7
   store i8 8, i8* %9, align 1
   %10 = add nsw i32 %i.02, 1
-  %11 = getelementptr inbounds %struct.A* %.01, i64 1
+  %11 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 1
   %exitcond = icmp eq i32 %10, %count
   br i1 %exitcond, label %._crit_edge, label %.lr.ph
 ._crit_edge:
@@ -159,21 +156,21 @@ define void @merge_loads_i16(i32 %count, %struct.A* noalias nocapture %q, %struc
   br i1 %1, label %.lr.ph, label %._crit_edge
 
 .lr.ph:                                           ; preds = %0
-  %2 = getelementptr inbounds %struct.A* %q, i64 0, i32 0
-  %3 = getelementptr inbounds %struct.A* %q, i64 0, i32 1
+  %2 = getelementptr inbounds %struct.A, %struct.A* %q, i64 0, i32 0
+  %3 = getelementptr inbounds %struct.A, %struct.A* %q, i64 0, i32 1
   br label %4
 
 ; <label>:4                                       ; preds = %4, %.lr.ph
   %i.02 = phi i32 [ 0, %.lr.ph ], [ %9, %4 ]
   %.01 = phi %struct.A* [ %p, %.lr.ph ], [ %10, %4 ]
-  %5 = load i8* %2, align 1
-  %6 = load i8* %3, align 1
-  %7 = getelementptr inbounds %struct.A* %.01, i64 0, i32 0
+  %5 = load i8, i8* %2, align 1
+  %6 = load i8, i8* %3, align 1
+  %7 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 0
   store i8 %5, i8* %7, align 1
-  %8 = getelementptr inbounds %struct.A* %.01, i64 0, i32 1
+  %8 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 1
   store i8 %6, i8* %8, align 1
   %9 = add nsw i32 %i.02, 1
-  %10 = getelementptr inbounds %struct.A* %.01, i64 1
+  %10 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 1
   %exitcond = icmp eq i32 %9, %count
   br i1 %exitcond, label %._crit_edge, label %4
 
@@ -193,21 +190,21 @@ define void @no_merge_loads(i32 %count, %struct.A* noalias nocapture %q, %struct
   br i1 %1, label %.lr.ph, label %._crit_edge
 
 .lr.ph:                                           ; preds = %0
-  %2 = getelementptr inbounds %struct.A* %q, i64 0, i32 0
-  %3 = getelementptr inbounds %struct.A* %q, i64 0, i32 1
+  %2 = getelementptr inbounds %struct.A, %struct.A* %q, i64 0, i32 0
+  %3 = getelementptr inbounds %struct.A, %struct.A* %q, i64 0, i32 1
   br label %a4
 
 a4:                                       ; preds = %4, %.lr.ph
   %i.02 = phi i32 [ 0, %.lr.ph ], [ %a9, %a4 ]
   %.01 = phi %struct.A* [ %p, %.lr.ph ], [ %a10, %a4 ]
-  %a5 = load i8* %2, align 1
-  %a7 = getelementptr inbounds %struct.A* %.01, i64 0, i32 0
+  %a5 = load i8, i8* %2, align 1
+  %a7 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 0
   store i8 %a5, i8* %a7, align 1
-  %a8 = getelementptr inbounds %struct.A* %.01, i64 0, i32 1
-  %a6 = load i8* %3, align 1
+  %a8 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 0, i32 1
+  %a6 = load i8, i8* %3, align 1
   store i8 %a6, i8* %a8, align 1
   %a9 = add nsw i32 %i.02, 1
-  %a10 = getelementptr inbounds %struct.A* %.01, i64 1
+  %a10 = getelementptr inbounds %struct.A, %struct.A* %.01, i64 1
   %exitcond = icmp eq i32 %a9, %count
   br i1 %exitcond, label %._crit_edge, label %a4
 
@@ -227,21 +224,21 @@ define void @merge_loads_integer(i32 %count, %struct.B* noalias nocapture %q, %s
   br i1 %1, label %.lr.ph, label %._crit_edge
 
 .lr.ph:                                           ; preds = %0
-  %2 = getelementptr inbounds %struct.B* %q, i64 0, i32 0
-  %3 = getelementptr inbounds %struct.B* %q, i64 0, i32 1
+  %2 = getelementptr inbounds %struct.B, %struct.B* %q, i64 0, i32 0
+  %3 = getelementptr inbounds %struct.B, %struct.B* %q, i64 0, i32 1
   br label %4
 
 ; <label>:4                                       ; preds = %4, %.lr.ph
   %i.02 = phi i32 [ 0, %.lr.ph ], [ %9, %4 ]
   %.01 = phi %struct.B* [ %p, %.lr.ph ], [ %10, %4 ]
-  %5 = load i32* %2
-  %6 = load i32* %3
-  %7 = getelementptr inbounds %struct.B* %.01, i64 0, i32 0
+  %5 = load i32, i32* %2
+  %6 = load i32, i32* %3
+  %7 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 0
   store i32 %5, i32* %7
-  %8 = getelementptr inbounds %struct.B* %.01, i64 0, i32 1
+  %8 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 1
   store i32 %6, i32* %8
   %9 = add nsw i32 %i.02, 1
-  %10 = getelementptr inbounds %struct.B* %.01, i64 1
+  %10 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 1
   %exitcond = icmp eq i32 %9, %count
   br i1 %exitcond, label %._crit_edge, label %4
 
@@ -261,29 +258,29 @@ define void @merge_loads_vector(i32 %count, %struct.B* noalias nocapture %q, %st
   br i1 %a1, label %.lr.ph, label %._crit_edge
 
 .lr.ph:                                           ; preds = %0
-  %a2 = getelementptr inbounds %struct.B* %q, i64 0, i32 0
-  %a3 = getelementptr inbounds %struct.B* %q, i64 0, i32 1
-  %a4 = getelementptr inbounds %struct.B* %q, i64 0, i32 2
-  %a5 = getelementptr inbounds %struct.B* %q, i64 0, i32 3
+  %a2 = getelementptr inbounds %struct.B, %struct.B* %q, i64 0, i32 0
+  %a3 = getelementptr inbounds %struct.B, %struct.B* %q, i64 0, i32 1
+  %a4 = getelementptr inbounds %struct.B, %struct.B* %q, i64 0, i32 2
+  %a5 = getelementptr inbounds %struct.B, %struct.B* %q, i64 0, i32 3
   br label %block4
 
 block4:                                       ; preds = %4, %.lr.ph
   %i.02 = phi i32 [ 0, %.lr.ph ], [ %c9, %block4 ]
   %.01 = phi %struct.B* [ %p, %.lr.ph ], [ %c10, %block4 ]
-  %a7 = getelementptr inbounds %struct.B* %.01, i64 0, i32 0
-  %a8 = getelementptr inbounds %struct.B* %.01, i64 0, i32 1
-  %a9 = getelementptr inbounds %struct.B* %.01, i64 0, i32 2
-  %a10 = getelementptr inbounds %struct.B* %.01, i64 0, i32 3
-  %b1 = load i32* %a2
-  %b2 = load i32* %a3
-  %b3 = load i32* %a4
-  %b4 = load i32* %a5
+  %a7 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 0
+  %a8 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 1
+  %a9 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 2
+  %a10 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 3
+  %b1 = load i32, i32* %a2
+  %b2 = load i32, i32* %a3
+  %b3 = load i32, i32* %a4
+  %b4 = load i32, i32* %a5
   store i32 %b1, i32* %a7
   store i32 %b2, i32* %a8
   store i32 %b3, i32* %a9
   store i32 %b4, i32* %a10
   %c9 = add nsw i32 %i.02, 1
-  %c10 = getelementptr inbounds %struct.B* %.01, i64 1
+  %c10 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 1
   %exitcond = icmp eq i32 %c9, %count
   br i1 %exitcond, label %._crit_edge, label %block4
 
@@ -291,46 +288,41 @@ block4:                                       ; preds = %4, %.lr.ph
   ret void
 }
 
+;; On x86, even unaligned copies can be merged to vector ops.
 ; CHECK-LABEL: merge_loads_no_align:
 ;  load:
-; CHECK: movl
-; CHECK: movl
-; CHECK: movl
-; CHECK: movl
+; CHECK: vmovups
 ;  store:
-; CHECK: movl
-; CHECK: movl
-; CHECK: movl
-; CHECK: movl
+; CHECK: vmovups
 ; CHECK: ret
 define void @merge_loads_no_align(i32 %count, %struct.B* noalias nocapture %q, %struct.B* noalias nocapture %p) nounwind uwtable noinline ssp {
   %a1 = icmp sgt i32 %count, 0
   br i1 %a1, label %.lr.ph, label %._crit_edge
 
 .lr.ph:                                           ; preds = %0
-  %a2 = getelementptr inbounds %struct.B* %q, i64 0, i32 0
-  %a3 = getelementptr inbounds %struct.B* %q, i64 0, i32 1
-  %a4 = getelementptr inbounds %struct.B* %q, i64 0, i32 2
-  %a5 = getelementptr inbounds %struct.B* %q, i64 0, i32 3
+  %a2 = getelementptr inbounds %struct.B, %struct.B* %q, i64 0, i32 0
+  %a3 = getelementptr inbounds %struct.B, %struct.B* %q, i64 0, i32 1
+  %a4 = getelementptr inbounds %struct.B, %struct.B* %q, i64 0, i32 2
+  %a5 = getelementptr inbounds %struct.B, %struct.B* %q, i64 0, i32 3
   br label %block4
 
 block4:                                       ; preds = %4, %.lr.ph
   %i.02 = phi i32 [ 0, %.lr.ph ], [ %c9, %block4 ]
   %.01 = phi %struct.B* [ %p, %.lr.ph ], [ %c10, %block4 ]
-  %a7 = getelementptr inbounds %struct.B* %.01, i64 0, i32 0
-  %a8 = getelementptr inbounds %struct.B* %.01, i64 0, i32 1
-  %a9 = getelementptr inbounds %struct.B* %.01, i64 0, i32 2
-  %a10 = getelementptr inbounds %struct.B* %.01, i64 0, i32 3
-  %b1 = load i32* %a2, align 1
-  %b2 = load i32* %a3, align 1
-  %b3 = load i32* %a4, align 1
-  %b4 = load i32* %a5, align 1
+  %a7 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 0
+  %a8 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 1
+  %a9 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 2
+  %a10 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 0, i32 3
+  %b1 = load i32, i32* %a2, align 1
+  %b2 = load i32, i32* %a3, align 1
+  %b3 = load i32, i32* %a4, align 1
+  %b4 = load i32, i32* %a5, align 1
   store i32 %b1, i32* %a7, align 1
   store i32 %b2, i32* %a8, align 1
   store i32 %b3, i32* %a9, align 1
   store i32 %b4, i32* %a10, align 1
   %c9 = add nsw i32 %i.02, 1
-  %c10 = getelementptr inbounds %struct.B* %.01, i64 1
+  %c10 = getelementptr inbounds %struct.B, %struct.B* %.01, i64 1
   %exitcond = icmp eq i32 %c9, %count
   br i1 %exitcond, label %._crit_edge, label %block4
 
@@ -340,7 +332,7 @@ block4:                                       ; preds = %4, %.lr.ph
 
 ; Make sure that we merge the consecutive load/store sequence below and use a
 ; word (16 bit) instead of a byte copy.
-; CHECK: MergeLoadStoreBaseIndexOffset
+; CHECK-LABEL: MergeLoadStoreBaseIndexOffset:
 ; CHECK: movw    (%{{.*}},%{{.*}}), [[REG:%[a-z]+]]
 ; CHECK: movw    [[REG]], (%{{.*}})
 define void @MergeLoadStoreBaseIndexOffset(i64* %a, i8* %b, i8* %c, i32 %n) {
@@ -350,17 +342,17 @@ define void @MergeLoadStoreBaseIndexOffset(i64* %a, i8* %b, i8* %c, i32 %n) {
   %.09 = phi i32 [ %n, %0 ], [ %11, %1 ]
   %.08 = phi i8* [ %b, %0 ], [ %10, %1 ]
   %.0 = phi i64* [ %a, %0 ], [ %2, %1 ]
-  %2 = getelementptr inbounds i64* %.0, i64 1
-  %3 = load i64* %.0, align 1
-  %4 = getelementptr inbounds i8* %c, i64 %3
-  %5 = load i8* %4, align 1
+  %2 = getelementptr inbounds i64, i64* %.0, i64 1
+  %3 = load i64, i64* %.0, align 1
+  %4 = getelementptr inbounds i8, i8* %c, i64 %3
+  %5 = load i8, i8* %4, align 1
   %6 = add i64 %3, 1
-  %7 = getelementptr inbounds i8* %c, i64 %6
-  %8 = load i8* %7, align 1
+  %7 = getelementptr inbounds i8, i8* %c, i64 %6
+  %8 = load i8, i8* %7, align 1
   store i8 %5, i8* %.08, align 1
-  %9 = getelementptr inbounds i8* %.08, i64 1
+  %9 = getelementptr inbounds i8, i8* %.08, i64 1
   store i8 %8, i8* %9, align 1
-  %10 = getelementptr inbounds i8* %.08, i64 2
+  %10 = getelementptr inbounds i8, i8* %.08, i64 2
   %11 = add nsw i32 %.09, -1
   %12 = icmp eq i32 %11, 0
   br i1 %12, label %13, label %1
@@ -372,7 +364,7 @@ define void @MergeLoadStoreBaseIndexOffset(i64* %a, i8* %b, i8* %c, i32 %n) {
 ; Make sure that we merge the consecutive load/store sequence below and use a
 ; word (16 bit) instead of a byte copy even if there are intermediate sign
 ; extensions.
-; CHECK: MergeLoadStoreBaseIndexOffsetSext
+; CHECK-LABEL: MergeLoadStoreBaseIndexOffsetSext:
 ; CHECK: movw    (%{{.*}},%{{.*}}), [[REG:%[a-z]+]]
 ; CHECK: movw    [[REG]], (%{{.*}})
 define void @MergeLoadStoreBaseIndexOffsetSext(i8* %a, i8* %b, i8* %c, i32 %n) {
@@ -382,18 +374,18 @@ define void @MergeLoadStoreBaseIndexOffsetSext(i8* %a, i8* %b, i8* %c, i32 %n) {
   %.09 = phi i32 [ %n, %0 ], [ %12, %1 ]
   %.08 = phi i8* [ %b, %0 ], [ %11, %1 ]
   %.0 = phi i8* [ %a, %0 ], [ %2, %1 ]
-  %2 = getelementptr inbounds i8* %.0, i64 1
-  %3 = load i8* %.0, align 1
+  %2 = getelementptr inbounds i8, i8* %.0, i64 1
+  %3 = load i8, i8* %.0, align 1
   %4 = sext i8 %3 to i64
-  %5 = getelementptr inbounds i8* %c, i64 %4
-  %6 = load i8* %5, align 1
+  %5 = getelementptr inbounds i8, i8* %c, i64 %4
+  %6 = load i8, i8* %5, align 1
   %7 = add i64 %4, 1
-  %8 = getelementptr inbounds i8* %c, i64 %7
-  %9 = load i8* %8, align 1
+  %8 = getelementptr inbounds i8, i8* %c, i64 %7
+  %9 = load i8, i8* %8, align 1
   store i8 %6, i8* %.08, align 1
-  %10 = getelementptr inbounds i8* %.08, i64 1
+  %10 = getelementptr inbounds i8, i8* %.08, i64 1
   store i8 %9, i8* %10, align 1
-  %11 = getelementptr inbounds i8* %.08, i64 2
+  %11 = getelementptr inbounds i8, i8* %.08, i64 2
   %12 = add nsw i32 %.09, -1
   %13 = icmp eq i32 %12, 0
   br i1 %13, label %14, label %1
@@ -404,7 +396,7 @@ define void @MergeLoadStoreBaseIndexOffsetSext(i8* %a, i8* %b, i8* %c, i32 %n) {
 
 ; However, we can only merge ignore sign extensions when they are on all memory
 ; computations;
-; CHECK: loadStoreBaseIndexOffsetSextNoSex
+; CHECK-LABEL: loadStoreBaseIndexOffsetSextNoSex:
 ; CHECK-NOT: movw    (%{{.*}},%{{.*}}), [[REG:%[a-z]+]]
 ; CHECK-NOT: movw    [[REG]], (%{{.*}})
 define void @loadStoreBaseIndexOffsetSextNoSex(i8* %a, i8* %b, i8* %c, i32 %n) {
@@ -414,19 +406,19 @@ define void @loadStoreBaseIndexOffsetSextNoSex(i8* %a, i8* %b, i8* %c, i32 %n) {
   %.09 = phi i32 [ %n, %0 ], [ %12, %1 ]
   %.08 = phi i8* [ %b, %0 ], [ %11, %1 ]
   %.0 = phi i8* [ %a, %0 ], [ %2, %1 ]
-  %2 = getelementptr inbounds i8* %.0, i64 1
-  %3 = load i8* %.0, align 1
+  %2 = getelementptr inbounds i8, i8* %.0, i64 1
+  %3 = load i8, i8* %.0, align 1
   %4 = sext i8 %3 to i64
-  %5 = getelementptr inbounds i8* %c, i64 %4
-  %6 = load i8* %5, align 1
+  %5 = getelementptr inbounds i8, i8* %c, i64 %4
+  %6 = load i8, i8* %5, align 1
   %7 = add i8 %3, 1
   %wrap.4 = sext i8 %7 to i64
-  %8 = getelementptr inbounds i8* %c, i64 %wrap.4
-  %9 = load i8* %8, align 1
+  %8 = getelementptr inbounds i8, i8* %c, i64 %wrap.4
+  %9 = load i8, i8* %8, align 1
   store i8 %6, i8* %.08, align 1
-  %10 = getelementptr inbounds i8* %.08, i64 1
+  %10 = getelementptr inbounds i8, i8* %.08, i64 1
   store i8 %9, i8* %10, align 1
-  %11 = getelementptr inbounds i8* %.08, i64 2
+  %11 = getelementptr inbounds i8, i8* %.08, i64 2
   %12 = add nsw i32 %.09, -1
   %13 = icmp eq i32 %12, 0
   br i1 %13, label %14, label %1
@@ -445,13 +437,13 @@ define void @merge_vec_element_store(<8 x float> %v, float* %ptr) {
   %vecext5 = extractelement <8 x float> %v, i32 5
   %vecext6 = extractelement <8 x float> %v, i32 6
   %vecext7 = extractelement <8 x float> %v, i32 7
-  %arrayidx1 = getelementptr inbounds float* %ptr, i64 1
-  %arrayidx2 = getelementptr inbounds float* %ptr, i64 2
-  %arrayidx3 = getelementptr inbounds float* %ptr, i64 3
-  %arrayidx4 = getelementptr inbounds float* %ptr, i64 4
-  %arrayidx5 = getelementptr inbounds float* %ptr, i64 5
-  %arrayidx6 = getelementptr inbounds float* %ptr, i64 6
-  %arrayidx7 = getelementptr inbounds float* %ptr, i64 7
+  %arrayidx1 = getelementptr inbounds float, float* %ptr, i64 1
+  %arrayidx2 = getelementptr inbounds float, float* %ptr, i64 2
+  %arrayidx3 = getelementptr inbounds float, float* %ptr, i64 3
+  %arrayidx4 = getelementptr inbounds float, float* %ptr, i64 4
+  %arrayidx5 = getelementptr inbounds float, float* %ptr, i64 5
+  %arrayidx6 = getelementptr inbounds float, float* %ptr, i64 6
+  %arrayidx7 = getelementptr inbounds float, float* %ptr, i64 7
   store float %vecext0, float* %ptr, align 4
   store float %vecext1, float* %arrayidx1, align 4
   store float %vecext2, float* %arrayidx2, align 4
@@ -469,11 +461,12 @@ define void @merge_vec_element_store(<8 x float> %v, float* %ptr) {
 }
 
 ; PR21711 - Merge vector stores into wider vector stores.
+; These should be merged into 32-byte stores.
 define void @merge_vec_extract_stores(<8 x float> %v1, <8 x float> %v2, <4 x float>* %ptr) {
-  %idx0 = getelementptr inbounds <4 x float>* %ptr, i64 3
-  %idx1 = getelementptr inbounds <4 x float>* %ptr, i64 4
-  %idx2 = getelementptr inbounds <4 x float>* %ptr, i64 5
-  %idx3 = getelementptr inbounds <4 x float>* %ptr, i64 6
+  %idx0 = getelementptr inbounds <4 x float>, <4 x float>* %ptr, i64 3
+  %idx1 = getelementptr inbounds <4 x float>, <4 x float>* %ptr, i64 4
+  %idx2 = getelementptr inbounds <4 x float>, <4 x float>* %ptr, i64 5
+  %idx3 = getelementptr inbounds <4 x float>, <4 x float>* %ptr, i64 6
   %shuffle0 = shufflevector <8 x float> %v1, <8 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
   %shuffle1 = shufflevector <8 x float> %v1, <8 x float> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
   %shuffle2 = shufflevector <8 x float> %v2, <8 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
@@ -493,12 +486,12 @@ define void @merge_vec_extract_stores(<8 x float> %v1, <8 x float> %v2, <4 x flo
 
 ; Merging vector stores when sourced from vector loads is not currently handled.
 define void @merge_vec_stores_from_loads(<4 x float>* %v, <4 x float>* %ptr) {
-  %load_idx0 = getelementptr inbounds <4 x float>* %v, i64 0
-  %load_idx1 = getelementptr inbounds <4 x float>* %v, i64 1
-  %v0 = load <4 x float>* %load_idx0
-  %v1 = load <4 x float>* %load_idx1
-  %store_idx0 = getelementptr inbounds <4 x float>* %ptr, i64 0
-  %store_idx1 = getelementptr inbounds <4 x float>* %ptr, i64 1
+  %load_idx0 = getelementptr inbounds <4 x float>, <4 x float>* %v, i64 0
+  %load_idx1 = getelementptr inbounds <4 x float>, <4 x float>* %v, i64 1
+  %v0 = load <4 x float>, <4 x float>* %load_idx0
+  %v1 = load <4 x float>, <4 x float>* %load_idx1
+  %store_idx0 = getelementptr inbounds <4 x float>, <4 x float>* %ptr, i64 0
+  %store_idx1 = getelementptr inbounds <4 x float>, <4 x float>* %ptr, i64 1
   store <4 x float> %v0, <4 x float>* %store_idx0, align 16
   store <4 x float> %v1, <4 x float>* %store_idx1, align 16
   ret void
@@ -513,8 +506,8 @@ define void @merge_vec_stores_from_loads(<4 x float>* %v, <4 x float>* %ptr) {
 
 ; Merging vector stores when sourced from a constant vector is not currently handled. 
 define void @merge_vec_stores_of_constants(<4 x i32>* %ptr) {
-  %idx0 = getelementptr inbounds <4 x i32>* %ptr, i64 3
-  %idx1 = getelementptr inbounds <4 x i32>* %ptr, i64 4
+  %idx0 = getelementptr inbounds <4 x i32>, <4 x i32>* %ptr, i64 3
+  %idx1 = getelementptr inbounds <4 x i32>, <4 x i32>* %ptr, i64 4
   store <4 x i32> <i32 0, i32 0, i32 0, i32 0>, <4 x i32>* %idx0, align 16
   store <4 x i32> <i32 0, i32 0, i32 0, i32 0>, <4 x i32>* %idx1, align 16
   ret void
@@ -530,16 +523,16 @@ define void @merge_vec_stores_of_constants(<4 x i32>* %ptr) {
 ; We could merge stores (and loads) like this...
 
 define void @merge_vec_element_and_scalar_load([6 x i64]* %array) {
-  %idx0 = getelementptr inbounds [6 x i64]* %array, i64 0, i64 0
-  %idx1 = getelementptr inbounds [6 x i64]* %array, i64 0, i64 1
-  %idx4 = getelementptr inbounds [6 x i64]* %array, i64 0, i64 4
-  %idx5 = getelementptr inbounds [6 x i64]* %array, i64 0, i64 5
+  %idx0 = getelementptr inbounds [6 x i64], [6 x i64]* %array, i64 0, i64 0
+  %idx1 = getelementptr inbounds [6 x i64], [6 x i64]* %array, i64 0, i64 1
+  %idx4 = getelementptr inbounds [6 x i64], [6 x i64]* %array, i64 0, i64 4
+  %idx5 = getelementptr inbounds [6 x i64], [6 x i64]* %array, i64 0, i64 5
 
-  %a0 = load i64* %idx0, align 8
+  %a0 = load i64, i64* %idx0, align 8
   store i64 %a0, i64* %idx4, align 8
 
   %b = bitcast i64* %idx1 to <2 x i64>*
-  %v = load <2 x i64>* %b, align 8
+  %v = load <2 x i64>, <2 x i64>* %b, align 8
   %a1 = extractelement <2 x i64> %v, i32 0
   store i64 %a1, i64* %idx5, align 8
   ret void