1 ; RUN: opt -S < %s -loop-vectorize -instcombine 2>&1 | FileCheck %s
3 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
4 target triple = "aarch64"
6 ;; See https://llvm.org/bugs/show_bug.cgi?id=25490
7 ;; Due to the data structures used, the LLVM IR was not determinisic.
8 ;; This test comes from the PR.
10 ;; CHECK-LABEL: @test(
11 ; CHECK: load <16 x i8>
12 ; CHECK-NEXT: getelementptr
14 ; CHECK-NEXT: load <16 x i8>
15 ; CHECK-NEXT: zext <16 x i8>
16 ; CHECK-NEXT: zext <16 x i8>
17 define void @test(i32 %n, i8* nocapture %a, i8* nocapture %b, i8* nocapture readonly %c) {
19 %cmp.28 = icmp eq i32 %n, 0
20 br i1 %cmp.28, label %for.cond.cleanup, label %for.body.preheader
22 for.body.preheader: ; preds = %entry
25 for.cond.cleanup.loopexit: ; preds = %for.body
26 br label %for.cond.cleanup
28 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
31 for.body: ; preds = %for.body.preheader, %for.body
32 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
33 %arrayidx = getelementptr inbounds i8, i8* %c, i64 %indvars.iv
34 %0 = load i8, i8* %arrayidx, align 1
35 %conv = zext i8 %0 to i32
36 %arrayidx2 = getelementptr inbounds i8, i8* %a, i64 %indvars.iv
37 %1 = load i8, i8* %arrayidx2, align 1
38 %conv3 = zext i8 %1 to i32
39 %mul = mul nuw nsw i32 %conv3, %conv
40 %shr.26 = lshr i32 %mul, 8
41 %conv4 = trunc i32 %shr.26 to i8
42 store i8 %conv4, i8* %arrayidx2, align 1
43 %arrayidx8 = getelementptr inbounds i8, i8* %b, i64 %indvars.iv
44 %2 = load i8, i8* %arrayidx8, align 1
45 %conv9 = zext i8 %2 to i32
46 %mul10 = mul nuw nsw i32 %conv9, %conv
47 %shr11.27 = lshr i32 %mul10, 8
48 %conv12 = trunc i32 %shr11.27 to i8
49 store i8 %conv12, i8* %arrayidx8, align 1
50 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
51 %lftr.wideiv = trunc i64 %indvars.iv.next to i32
52 %exitcond = icmp eq i32 %lftr.wideiv, %n
53 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body