1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -slp-vectorizer -slp-vectorize-hor -slp-vectorize-hor-store -S < %s -mtriple=x86_64-apple-macosx -mcpu=haswell | FileCheck %s
4 ;unsigned load_le32(unsigned char *data) {
5 ; unsigned le32 = (data[0]<<0) | (data[1]<<8) | (data[2]<<16) | (data[3]<<24);
9 define i32 @_Z9load_le32Ph(i8* nocapture readonly %data) {
10 ; CHECK-LABEL: @_Z9load_le32Ph(
12 ; CHECK-NEXT: [[TMP0:%.*]] = load i8, i8* [[DATA:%.*]], align 1
13 ; CHECK-NEXT: [[CONV:%.*]] = zext i8 [[TMP0]] to i32
14 ; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i8, i8* [[DATA]], i64 1
15 ; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[ARRAYIDX1]], align 1
16 ; CHECK-NEXT: [[CONV2:%.*]] = zext i8 [[TMP1]] to i32
17 ; CHECK-NEXT: [[SHL3:%.*]] = shl nuw nsw i32 [[CONV2]], 8
18 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[SHL3]], [[CONV]]
19 ; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds i8, i8* [[DATA]], i64 2
20 ; CHECK-NEXT: [[TMP2:%.*]] = load i8, i8* [[ARRAYIDX4]], align 1
21 ; CHECK-NEXT: [[CONV5:%.*]] = zext i8 [[TMP2]] to i32
22 ; CHECK-NEXT: [[SHL6:%.*]] = shl nuw nsw i32 [[CONV5]], 16
23 ; CHECK-NEXT: [[OR7:%.*]] = or i32 [[OR]], [[SHL6]]
24 ; CHECK-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds i8, i8* [[DATA]], i64 3
25 ; CHECK-NEXT: [[TMP3:%.*]] = load i8, i8* [[ARRAYIDX8]], align 1
26 ; CHECK-NEXT: [[CONV9:%.*]] = zext i8 [[TMP3]] to i32
27 ; CHECK-NEXT: [[SHL10:%.*]] = shl nuw i32 [[CONV9]], 24
28 ; CHECK-NEXT: [[OR11:%.*]] = or i32 [[OR7]], [[SHL10]]
29 ; CHECK-NEXT: ret i32 [[OR11]]
32 %0 = load i8, i8* %data, align 1
33 %conv = zext i8 %0 to i32
34 %arrayidx1 = getelementptr inbounds i8, i8* %data, i64 1
35 %1 = load i8, i8* %arrayidx1, align 1
36 %conv2 = zext i8 %1 to i32
37 %shl3 = shl nuw nsw i32 %conv2, 8
38 %or = or i32 %shl3, %conv
39 %arrayidx4 = getelementptr inbounds i8, i8* %data, i64 2
40 %2 = load i8, i8* %arrayidx4, align 1
41 %conv5 = zext i8 %2 to i32
42 %shl6 = shl nuw nsw i32 %conv5, 16
43 %or7 = or i32 %or, %shl6
44 %arrayidx8 = getelementptr inbounds i8, i8* %data, i64 3
45 %3 = load i8, i8* %arrayidx8, align 1
46 %conv9 = zext i8 %3 to i32
47 %shl10 = shl nuw i32 %conv9, 24
48 %or11 = or i32 %or7, %shl10