Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit d27af43

Browse files
committed
[SLP] Test for PR35047, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317482 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 6e1c5e0 commit d27af43

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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
3+
4+
;unsigned load_le32(unsigned char *data) {
5+
; unsigned le32 = (data[0]<<0) | (data[1]<<8) | (data[2]<<16) | (data[3]<<24);
6+
; return le32;
7+
;}
8+
9+
define i32 @_Z9load_le32Ph(i8* nocapture readonly %data) {
10+
; CHECK-LABEL: @_Z9load_le32Ph(
11+
; CHECK-NEXT: entry:
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: [[ARRAYIDX8:%.*]] = getelementptr inbounds i8, i8* [[DATA]], i64 3
21+
; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[ARRAYIDX4]] to <2 x i8>*
22+
; CHECK-NEXT: [[TMP3:%.*]] = load <2 x i8>, <2 x i8>* [[TMP2]], align 1
23+
; CHECK-NEXT: [[TMP4:%.*]] = zext <2 x i8> [[TMP3]] to <2 x i32>
24+
; CHECK-NEXT: [[TMP5:%.*]] = shl nuw <2 x i32> [[TMP4]], <i32 16, i32 24>
25+
; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x i32> [[TMP5]], i32 0
26+
; CHECK-NEXT: [[OR7:%.*]] = or i32 [[OR]], [[TMP6]]
27+
; CHECK-NEXT: [[TMP7:%.*]] = extractelement <2 x i32> [[TMP5]], i32 1
28+
; CHECK-NEXT: [[OR11:%.*]] = or i32 [[OR7]], [[TMP7]]
29+
; CHECK-NEXT: ret i32 [[OR11]]
30+
;
31+
entry:
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
49+
ret i32 %or11
50+
}

0 commit comments

Comments
 (0)