diff options
| author | Max Kazantsev <max.kazantsev@azul.com> | 2018-02-05 08:09:49 +0000 |
|---|---|---|
| committer | Max Kazantsev <max.kazantsev@azul.com> | 2018-02-05 08:09:49 +0000 |
| commit | f7667483c191b8c30ec0b3b6b2c9d9789322681a (patch) | |
| tree | 40e917028817f284a2ed45aeb79d523d8189eaee /llvm/test/Transforms/LoopVectorize | |
| parent | 6e93980e8251213269aa3e314036d933e77e6f33 (diff) | |
| download | bcm5719-llvm-f7667483c191b8c30ec0b3b6b2c9d9789322681a.tar.gz bcm5719-llvm-f7667483c191b8c30ec0b3b6b2c9d9789322681a.zip | |
[NFC] Add tests for PR35743
llvm-svn: 324209
Diffstat (limited to 'llvm/test/Transforms/LoopVectorize')
| -rw-r--r-- | llvm/test/Transforms/LoopVectorize/pr35743.ll | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/pr35743.ll b/llvm/test/Transforms/LoopVectorize/pr35743.ll new file mode 100644 index 00000000000..7dc67e4a9b6 --- /dev/null +++ b/llvm/test/Transforms/LoopVectorize/pr35743.ll @@ -0,0 +1,102 @@ +; RUN: opt < %s -loop-vectorize -S | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1" +target triple = "x86_64-unknown-linux-gnu" + +; This cannot be correctly vectorized with type i1. +define i8 @test_01(i8 %c) #0 { + +; CHECK-LABEL: @test_01( +; CHECK-NOT: vector.body: +; CHECK-NOT: zext i1 {{.*}} to i8 + +entry: + br label %loop + +exit: ; preds = %loop + ret i8 %accum.plus + +loop: ; preds = %loop, %entry + %accum.phi = phi i8 [ %c, %entry ], [ %accum.plus, %loop ] + %iv = phi i32 [ 1, %entry ], [ %iv.next, %loop ] + %accum.and = and i8 %accum.phi, 1 + %accum.plus = add nuw nsw i8 %accum.and, 3 + %iv.next = add nuw nsw i32 %iv, 1 + %cond = icmp ugt i32 %iv, 191 + br i1 %cond, label %exit, label %loop +} + +; TODO: This can be vectorized with type i1 because the result is not used. +define void @test_02(i8 %c) #0 { + +; CHECK-LABEL: @test_02( +; CHECK-NOT: vector.body: + +entry: + br label %loop + +exit: ; preds = %loop + %lcssa = phi i8 [ %accum.plus, %loop ] + ret void + +loop: ; preds = %loop, %entry + %accum.phi = phi i8 [ %c, %entry ], [ %accum.plus, %loop ] + %iv = phi i32 [ 1, %entry ], [ %iv.next, %loop ] + %accum.and = and i8 %accum.phi, 1 + %accum.plus = add nuw nsw i8 %accum.and, 3 + %iv.next = add nuw nsw i32 %iv, 1 + %cond = icmp ugt i32 %iv, 191 + br i1 %cond, label %exit, label %loop +} + +; This can be vectorized with type i1 because the result is truncated properly. +define i1 @test_03(i8 %c) #0 { + +; CHECK-LABEL: @test_03( +; CHECK: vector.body: +; CHECK: zext i1 {{.*}} to i8 + +entry: + br label %loop + +exit: ; preds = %loop + %lcssa = phi i8 [ %accum.plus, %loop ] + %trunc = trunc i8 %lcssa to i1 + ret i1 %trunc + +loop: ; preds = %loop, %entry + %accum.phi = phi i8 [ %c, %entry ], [ %accum.plus, %loop ] + %iv = phi i32 [ 1, %entry ], [ %iv.next, %loop ] + %accum.and = and i8 %accum.phi, 1 + %accum.plus = add nuw nsw i8 %accum.and, 3 + %iv.next = add nuw nsw i32 %iv, 1 + %cond = icmp ugt i32 %iv, 191 + br i1 %cond, label %exit, label %loop +} + +; This cannot be vectorized with type i1 because the result is truncated to a +; wrong type. +; TODO: It can also be vectorized with type i32 (or maybe i4?) +define i4 @test_04(i8 %c) #0 { + +; CHECK-LABEL: @test_04( +; CHECK-NOT: vector.body: +; CHECK-NOT: zext i1 {{.*}} to i8 + +entry: + br label %loop + +exit: ; preds = %loop + %lcssa = phi i8 [ %accum.plus, %loop ] + %trunc = trunc i8 %lcssa to i4 + ret i4 %trunc + +loop: ; preds = %loop, %entry + %accum.phi = phi i8 [ %c, %entry ], [ %accum.plus, %loop ] + %iv = phi i32 [ 1, %entry ], [ %iv.next, %loop ] + %accum.and = and i8 %accum.phi, 1 + %accum.plus = add nuw nsw i8 %accum.and, 3 + %iv.next = add nuw nsw i32 %iv, 1 + %cond = icmp ugt i32 %iv, 191 + br i1 %cond, label %exit, label %loop +} |

