• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s  -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -S | FileCheck %s
3target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
4
5
6; Function Attrs: nofree norecurse nounwind
7define void @a(i8* readnone %b) {
8; CHECK-LABEL: @a(
9; CHECK:       vector.ph:
10; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i64 [[TMP0:%.*]], 4
11; CHECK-NEXT:    [[N_VEC:%.*]] = sub i64 [[TMP0]], [[N_MOD_VF]]
12; CHECK-NEXT:    [[TMP1:%.*]] = mul i64 [[N_VEC]], -1
13; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr i8, i8* null, i64 [[TMP1]]
14; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
15; CHECK:       vector.body:
16; CHECK-NEXT:    [[POINTER_PHI:%.*]] = phi i8* [ null, %vector.ph ], [ [[PTR_IND:%.*]], %pred.store.continue7 ]
17; CHECK-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %pred.store.continue7 ]
18; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr i8, i8* [[POINTER_PHI]], <4 x i64> <i64 0, i64 -1, i64 -2, i64 -3>
19; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr inbounds i8, <4 x i8*> [[TMP2]], i64 -1
20; CHECK-NEXT:    [[TMP4:%.*]] = extractelement <4 x i8*> [[TMP3]], i32 0
21; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr i8, i8* [[TMP4]], i32 0
22; CHECK-NEXT:    [[TMP6:%.*]] = getelementptr i8, i8* [[TMP5]], i32 -3
23; CHECK-NEXT:    [[TMP7:%.*]] = bitcast i8* [[TMP6]] to <4 x i8>*
24; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <4 x i8>, <4 x i8>* [[TMP7]], align 1
25; CHECK-NEXT:    [[REVERSE:%.*]] = shufflevector <4 x i8> [[WIDE_LOAD]], <4 x i8> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
26; CHECK-NEXT:    [[TMP8:%.*]] = icmp eq <4 x i8> [[REVERSE]], zeroinitializer
27; CHECK-NEXT:    [[TMP9:%.*]] = xor <4 x i1> [[TMP8]], <i1 true, i1 true, i1 true, i1 true>
28; CHECK-NEXT:    [[TMP10:%.*]] = extractelement <4 x i1> [[TMP9]], i32 0
29; CHECK:       pred.store.continue7:
30; CHECK-NEXT:    [[INDEX_NEXT]] = add i64 [[INDEX]], 4
31; CHECK-NEXT:    [[TMP18:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
32; CHECK-NEXT:    [[PTR_IND]] = getelementptr i8, i8* [[POINTER_PHI]], i64 -4
33
34entry:
35  %cmp.not4 = icmp eq i8* %b, null
36  br i1 %cmp.not4, label %for.cond.cleanup, label %for.body.preheader
37
38for.body.preheader:                               ; preds = %entry
39  br label %for.body
40
41for.cond.cleanup.loopexit:                        ; preds = %if.end
42  br label %for.cond.cleanup
43
44for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry
45  ret void
46
47for.body:                                         ; preds = %for.body.preheader, %if.end
48  %c.05 = phi i8* [ %incdec.ptr, %if.end ], [ null, %for.body.preheader ]
49  %incdec.ptr = getelementptr inbounds i8, i8* %c.05, i64 -1
50  %0 = load i8, i8* %incdec.ptr, align 1
51  %tobool.not = icmp eq i8 %0, 0
52  br i1 %tobool.not, label %if.end, label %if.then
53
54if.then:                                          ; preds = %for.body
55  store i8 95, i8* %incdec.ptr, align 1
56  br label %if.end
57
58if.end:                                           ; preds = %for.body, %if.then
59  %cmp.not = icmp eq i8* %incdec.ptr, %b
60  br i1 %cmp.not, label %for.cond.cleanup.loopexit, label %for.body
61}
62
63