1; RUN: opt -mtriple=amdgcn-amd-amdhsa -mattr=+max-private-element-size-4 -load-store-vectorizer -S -o - %s | FileCheck -check-prefixes=ELT4,ALIGNED,ALL %s
2; RUN: opt -mtriple=amdgcn-amd-amdhsa -mattr=+max-private-element-size-8 -load-store-vectorizer -S -o - %s | FileCheck -check-prefixes=ELT8,ALIGNED,ALL %s
3; RUN: opt -mtriple=amdgcn-amd-amdhsa -mattr=+max-private-element-size-8,+unaligned-scratch-access -load-store-vectorizer -S -o - %s | FileCheck -check-prefix=ELT8-UNALIGNED -check-prefix=ALL %s
4; RUN: opt -mtriple=amdgcn-amd-amdhsa -mattr=+max-private-element-size-16 -load-store-vectorizer -S -o - %s | FileCheck -check-prefixes=ELT16,ALIGNED,ALL %s
5; RUN: opt -mtriple=amdgcn-amd-amdhsa -mattr=+max-private-element-size-16,+unaligned-scratch-access -load-store-vectorizer -S -o - %s | FileCheck -check-prefix=ELT16-UNALIGNED -check-prefix=ALL %s
6
7target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
8
9; ALL-LABEL: @merge_private_store_4_vector_elts_loads_v4i32
10; ALIGNED: store i32
11; ALIGNED: store i32
12; ALIGNED: store i32
13; ALIGNED: store i32
14
15; ELT8-UNALIGNED: store <2 x i32>
16; ELT8-UNALIGNED: store <2 x i32>
17
18; ELT16-UNALIGNED: store <4 x i32>
19define void @merge_private_store_4_vector_elts_loads_v4i32(i32* %out) #0 {
20  %out.gep.1 = getelementptr i32, i32* %out, i32 1
21  %out.gep.2 = getelementptr i32, i32* %out, i32 2
22  %out.gep.3 = getelementptr i32, i32* %out, i32 3
23
24  store i32 9, i32* %out
25  store i32 1, i32* %out.gep.1
26  store i32 23, i32* %out.gep.2
27  store i32 19, i32* %out.gep.3
28  ret void
29}
30
31; ALL-LABEL: @merge_private_store_4_vector_elts_loads_v4i8(
32; ALL: store <4 x i8>
33define void @merge_private_store_4_vector_elts_loads_v4i8(i8* %out) #0 {
34  %out.gep.1 = getelementptr i8, i8* %out, i32 1
35  %out.gep.2 = getelementptr i8, i8* %out, i32 2
36  %out.gep.3 = getelementptr i8, i8* %out, i32 3
37
38  store i8 9, i8* %out, align 4
39  store i8 1, i8* %out.gep.1
40  store i8 23, i8* %out.gep.2
41  store i8 19, i8* %out.gep.3
42  ret void
43}
44
45; ALL-LABEL: @merge_private_store_4_vector_elts_loads_v2i16(
46; ALL: store <2 x i16>
47define void @merge_private_store_4_vector_elts_loads_v2i16(i16* %out) #0 {
48  %out.gep.1 = getelementptr i16, i16* %out, i32 1
49
50  store i16 9, i16* %out, align 4
51  store i16 12, i16* %out.gep.1
52  ret void
53}
54
55attributes #0 = { nounwind }
56