diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-05-09 23:40:13 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-05-09 23:40:13 +0000 |
commit | a06384f3d8e2b596b75d7a63c9bf1eb25e6d552e (patch) | |
tree | a858efa7907754f3f9f5ac641adbc59e4f64d6f4 /llvm/test/Transforms/InstCombine/add.ll | |
parent | 4b62b5cdddf5f153cd5a41e4409995f3f8d69358 (diff) | |
download | bcm5719-llvm-a06384f3d8e2b596b75d7a63c9bf1eb25e6d552e.tar.gz bcm5719-llvm-a06384f3d8e2b596b75d7a63c9bf1eb25e6d552e.zip |
[InstCombine] add tests for andn; NFC
llvm-svn: 302599
Diffstat (limited to 'llvm/test/Transforms/InstCombine/add.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/add.ll | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/add.ll b/llvm/test/Transforms/InstCombine/add.ll index 648305d134c..955ffaaeecd 100644 --- a/llvm/test/Transforms/InstCombine/add.ll +++ b/llvm/test/Transforms/InstCombine/add.ll @@ -27,6 +27,34 @@ define <2 x i32> @select_0_or_1_from_bool_vec(<2 x i1> %x) { ret <2 x i32> %add } +; This is an 'andn' of the low bit. + +define i32 @flip_and_mask(i32 %x) { +; CHECK-LABEL: @flip_and_mask( +; CHECK-NEXT: [[SHL:%.*]] = shl i32 %x, 31 +; CHECK-NEXT: [[SHR:%.*]] = ashr exact i32 [[SHL]], 31 +; CHECK-NEXT: [[INC:%.*]] = add nsw i32 [[SHR]], 1 +; CHECK-NEXT: ret i32 [[INC]] +; + %shl = shl i32 %x, 31 + %shr = ashr i32 %shl, 31 + %inc = add i32 %shr, 1 + ret i32 %inc +} + +define <2 x i8> @flip_and_mask_splat(<2 x i8> %x) { +; CHECK-LABEL: @flip_and_mask_splat( +; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i8> %x, <i8 7, i8 7> +; CHECK-NEXT: [[SHR:%.*]] = ashr exact <2 x i8> [[SHL]], <i8 7, i8 7> +; CHECK-NEXT: [[INC:%.*]] = add nsw <2 x i8> [[SHR]], <i8 1, i8 1> +; CHECK-NEXT: ret <2 x i8> [[INC]] +; + %shl = shl <2 x i8> %x, <i8 7, i8 7> + %shr = ashr <2 x i8> %shl, <i8 7, i8 7> + %inc = add <2 x i8> %shr, <i8 1, i8 1> + ret <2 x i8> %inc +} + define i32 @test1(i32 %A) { ; CHECK-LABEL: @test1( ; CHECK-NEXT: ret i32 %A |