brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 7684cf8 Raw
51 lines · plain
1; RUN: opt -passes='loop-vectorize' -mcpu=z13 -force-vector-width=2 -S < %s | FileCheck %s2;3; Forcing VF=2 to trigger vector code gen4;5; This is a test case to exercise more cases in truncateToMinimalBitWidths().6; Test passes if vector code is generated w/o hitting llvm_unreachable().7;8; Performing minimal check in the output to ensure the loop is actually9; vectorized.10;11; CHECK: vector.body12 13target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"14target triple = "s390x-ibm-linux"15 16define void @test(i32 zeroext %width, ptr nocapture %row, i16 zeroext %src, ptr nocapture readonly %dst) {17entry:18  %cmp10 = icmp eq i32 %width, 019  br i1 %cmp10, label %for.end, label %for.body.lr.ph20 21for.body.lr.ph:                                   ; preds = %entry22  %conv1 = zext i16 %src to i3223  br label %for.body24 25for.body:                                         ; preds = %for.inc, %for.body.lr.ph26  %i.012 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]27  %sp.011 = phi ptr [ %row, %for.body.lr.ph ], [ %incdec.ptr, %for.inc ]28  %0 = load i8, ptr %sp.011, align 129  %conv = zext i8 %0 to i3230  %cmp2 = icmp eq i32 %conv, %conv131  br i1 %cmp2, label %if.then, label %for.inc32 33if.then:                                          ; preds = %for.body34  %1 = load i16, ptr %dst, align 235  %conv4 = trunc i16 %1 to i836  store i8 %conv4, ptr %sp.011, align 137  br label %for.inc38 39for.inc:                                          ; preds = %for.body, %if.then40  %inc = add nuw i32 %i.012, 141  %incdec.ptr = getelementptr inbounds i8, ptr %sp.011, i64 142  %exitcond = icmp eq i32 %inc, %width43  br i1 %exitcond, label %for.end.loopexit, label %for.body44 45for.end.loopexit:                                 ; preds = %for.inc46  br label %for.end47 48for.end:                                          ; preds = %for.end.loopexit, %entry49  ret void50}51