1; RUN: opt < %s -sroa -S | FileCheck %s
2target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64"
3
4define <4 x i64> @vector_ptrtoint({<2 x i32*>, <2 x i32*>} %x) {
5; CHECK-LABEL: @vector_ptrtoint
6  %a = alloca {<2 x i32*>, <2 x i32*>}
7; CHECK-NOT: alloca
8
9  store {<2 x i32*>, <2 x i32*>} %x, {<2 x i32*>, <2 x i32*>}* %a
10; CHECK-NOT: store
11
12  %cast = bitcast {<2 x i32*>, <2 x i32*>}* %a to <4 x i64>*
13  %vec = load <4 x i64>, <4 x i64>* %cast
14; CHECK-NOT: load
15; CHECK: ptrtoint
16
17  ret <4 x i64> %vec
18}
19
20define <4 x i32*> @vector_inttoptr({<2 x i64>, <2 x i64>} %x) {
21; CHECK-LABEL: @vector_inttoptr
22  %a = alloca {<2 x i64>, <2 x i64>}
23; CHECK-NOT: alloca
24
25  store {<2 x i64>, <2 x i64>} %x, {<2 x i64>, <2 x i64>}* %a
26; CHECK-NOT: store
27
28  %cast = bitcast {<2 x i64>, <2 x i64>}* %a to <4 x i32*>*
29  %vec = load <4 x i32*>, <4 x i32*>* %cast
30; CHECK-NOT: load
31; CHECK: inttoptr
32
33  ret <4 x i32*> %vec
34}
35
36define <2 x i64> @vector_ptrtointbitcast({<1 x i32*>, <1 x i32*>} %x) {
37; CHECK-LABEL: @vector_ptrtointbitcast(
38  %a = alloca {<1 x i32*>, <1 x i32*>}
39; CHECK-NOT: alloca
40
41  store {<1 x i32*>, <1 x i32*>} %x, {<1 x i32*>, <1 x i32*>}* %a
42; CHECK-NOT: store
43
44  %cast = bitcast {<1 x i32*>, <1 x i32*>}* %a to <2 x i64>*
45  %vec = load <2 x i64>, <2 x i64>* %cast
46; CHECK-NOT: load
47; CHECK: ptrtoint
48; CHECK: bitcast
49; CHECK: ptrtoint
50; CHECK: bitcast
51
52  ret <2 x i64> %vec
53}
54
55define <2 x i8*> @vector_inttoptrbitcast_vector({<16 x i8>, <16 x i8>} %x) {
56; CHECK-LABEL: @vector_inttoptrbitcast_vector(
57  %a = alloca {<16 x i8>, <16 x i8>}
58; CHECK-NOT: alloca
59
60  store {<16 x i8>, <16 x i8>} %x, {<16 x i8>, <16 x i8>}* %a
61; CHECK-NOT: store
62
63  %cast = bitcast {<16 x i8>, <16 x i8>}* %a to <2 x i8*>*
64  %vec = load <2 x i8*>, <2 x i8*>* %cast
65; CHECK-NOT: load
66; CHECK: extractvalue
67; CHECK: extractvalue
68; CHECK: bitcast
69; CHECK: inttoptr
70
71  ret <2 x i8*> %vec
72}
73
74define <16 x i8> @vector_ptrtointbitcast_vector({<2 x i8*>, <2 x i8*>} %x) {
75; CHECK-LABEL: @vector_ptrtointbitcast_vector(
76  %a = alloca {<2 x i8*>, <2 x i8*>}
77; CHECK-NOT: alloca
78
79  store {<2 x i8*>, <2 x i8*>} %x, {<2 x i8*>, <2 x i8*>}* %a
80; CHECK-NOT: store
81
82  %cast = bitcast {<2 x i8*>, <2 x i8*>}* %a to <16 x i8>*
83  %vec = load <16 x i8>, <16 x i8>* %cast
84; CHECK-NOT: load
85; CHECK: extractvalue
86; CHECK: ptrtoint
87; CHECK: bitcast
88; CHECK: extractvalue
89
90  ret <16 x i8> %vec
91}
92