1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt %s -passes='function(scalarizer<load-store>,dce)' -S | FileCheck %s
3 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"
5 define <1 x i32> @f1(<1 x ptr> %src, i32 %index) {
7 ; CHECK-NEXT: [[INDEX_IS_0:%.*]] = icmp eq i32 [[INDEX:%.*]], 0
8 ; CHECK-NEXT: [[SRC_I0:%.*]] = extractelement <1 x ptr> [[SRC:%.*]], i64 0
9 ; CHECK-NEXT: [[DOTUPTO0:%.*]] = select i1 [[INDEX_IS_0]], ptr [[SRC_I0]], ptr poison
10 ; CHECK-NEXT: [[DOTI0:%.*]] = load i32, ptr [[DOTUPTO0]], align 4
11 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <1 x i32> poison, i32 [[DOTI0]], i64 0
12 ; CHECK-NEXT: ret <1 x i32> [[TMP1]]
14 %1 = extractelement <1 x ptr> %src, i32 %index
15 %2 = load <1 x i32>, ptr %1, align 4
19 define <1 x i32> @f1b(<1 x ptr> %src) {
21 ; CHECK-NEXT: [[SRC_I0:%.*]] = extractelement <1 x ptr> [[SRC:%.*]], i64 0
22 ; CHECK-NEXT: [[DOTI0:%.*]] = load i32, ptr [[SRC_I0]], align 4
23 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <1 x i32> poison, i32 [[DOTI0]], i64 0
24 ; CHECK-NEXT: ret <1 x i32> [[TMP1]]
26 %1 = extractelement <1 x ptr> %src, i32 0
27 %2 = load <1 x i32>, ptr %1, align 4
31 define <2 x i32> @f2(<1 x ptr> %src, i32 %index) {
33 ; CHECK-NEXT: [[INDEX_IS_0:%.*]] = icmp eq i32 [[INDEX:%.*]], 0
34 ; CHECK-NEXT: [[SRC_I0:%.*]] = extractelement <1 x ptr> [[SRC:%.*]], i64 0
35 ; CHECK-NEXT: [[DOTUPTO0:%.*]] = select i1 [[INDEX_IS_0]], ptr [[SRC_I0]], ptr poison
36 ; CHECK-NEXT: [[DOTUPTO0_I1:%.*]] = getelementptr i32, ptr [[DOTUPTO0]], i32 1
37 ; CHECK-NEXT: [[DOTI0:%.*]] = load i32, ptr [[DOTUPTO0]], align 4
38 ; CHECK-NEXT: [[DOTI1:%.*]] = load i32, ptr [[DOTUPTO0_I1]], align 4
39 ; CHECK-NEXT: [[DOTUPTO01:%.*]] = insertelement <2 x i32> poison, i32 [[DOTI0]], i64 0
40 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i32> [[DOTUPTO01]], i32 [[DOTI1]], i64 1
41 ; CHECK-NEXT: ret <2 x i32> [[TMP1]]
43 %1 = extractelement <1 x ptr> %src, i32 %index
44 %2 = load <2 x i32>, ptr %1, align 4
48 define <2 x i32> @f2b(<1 x ptr> %src) {
50 ; CHECK-NEXT: [[SRC_I0:%.*]] = extractelement <1 x ptr> [[SRC:%.*]], i64 0
51 ; CHECK-NEXT: [[SRC_I0_I1:%.*]] = getelementptr i32, ptr [[SRC_I0]], i32 1
52 ; CHECK-NEXT: [[DOTI0:%.*]] = load i32, ptr [[SRC_I0]], align 4
53 ; CHECK-NEXT: [[DOTI1:%.*]] = load i32, ptr [[SRC_I0_I1]], align 4
54 ; CHECK-NEXT: [[DOTUPTO0:%.*]] = insertelement <2 x i32> poison, i32 [[DOTI0]], i64 0
55 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i32> [[DOTUPTO0]], i32 [[DOTI1]], i64 1
56 ; CHECK-NEXT: ret <2 x i32> [[TMP1]]
58 %1 = extractelement <1 x ptr> %src, i32 0
59 %2 = load <2 x i32>, ptr %1, align 4
63 define void @f3(<1 x ptr> %src, i32 %index, <2 x i32> %val) {
65 ; CHECK-NEXT: [[VAL_I0:%.*]] = extractelement <2 x i32> [[VAL:%.*]], i64 0
66 ; CHECK-NEXT: [[VAL_I1:%.*]] = extractelement <2 x i32> [[VAL]], i64 1
67 ; CHECK-NEXT: [[INDEX_IS_0:%.*]] = icmp eq i32 [[INDEX:%.*]], 0
68 ; CHECK-NEXT: [[SRC_I0:%.*]] = extractelement <1 x ptr> [[SRC:%.*]], i64 0
69 ; CHECK-NEXT: [[DOTUPTO0:%.*]] = select i1 [[INDEX_IS_0]], ptr [[SRC_I0]], ptr poison
70 ; CHECK-NEXT: [[DOTUPTO0_I1:%.*]] = getelementptr i32, ptr [[DOTUPTO0]], i32 1
71 ; CHECK-NEXT: store i32 [[VAL_I0]], ptr [[DOTUPTO0]], align 4
72 ; CHECK-NEXT: store i32 [[VAL_I1]], ptr [[DOTUPTO0_I1]], align 4
73 ; CHECK-NEXT: ret void
75 %1 = extractelement <1 x ptr> %src, i32 %index
76 store <2 x i32> %val, ptr %1, align 4
80 define void @f3b(<1 x ptr> %src, <2 x i32> %val) {
82 ; CHECK-NEXT: [[VAL_I0:%.*]] = extractelement <2 x i32> [[VAL:%.*]], i64 0
83 ; CHECK-NEXT: [[VAL_I1:%.*]] = extractelement <2 x i32> [[VAL]], i64 1
84 ; CHECK-NEXT: [[SRC_I0:%.*]] = extractelement <1 x ptr> [[SRC:%.*]], i64 0
85 ; CHECK-NEXT: [[SRC_I0_I1:%.*]] = getelementptr i32, ptr [[SRC_I0]], i32 1
86 ; CHECK-NEXT: store i32 [[VAL_I0]], ptr [[SRC_I0]], align 4
87 ; CHECK-NEXT: store i32 [[VAL_I1]], ptr [[SRC_I0_I1]], align 4
88 ; CHECK-NEXT: ret void
90 %1 = extractelement <1 x ptr> %src, i32 0
91 store <2 x i32> %val, ptr %1, align 4