[InstCombine] add tests for demanded bits ashr/lshr splat constants; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300884 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjay Patel 2017-04-20 20:44:54 +00:00
parent 52a72dacab
commit cef604c5bb

View File

@ -1268,3 +1268,25 @@ define <2 x i64> @test_64_splat_vec(<2 x i32> %t) {
ret <2 x i64> %shl
}
define <2 x i8> @ashr_demanded_bits_splat(<2 x i8> %x) {
; CHECK-LABEL: @ashr_demanded_bits_splat(
; CHECK-NEXT: [[AND:%.*]] = and <2 x i8> %x, <i8 -128, i8 -128>
; CHECK-NEXT: [[SHR:%.*]] = ashr exact <2 x i8> [[AND]], <i8 7, i8 7>
; CHECK-NEXT: ret <2 x i8> [[SHR]]
;
%and = and <2 x i8> %x, <i8 128, i8 128>
%shr = ashr <2 x i8> %and, <i8 7, i8 7>
ret <2 x i8> %shr
}
define <2 x i8> @lshr_demanded_bits_splat(<2 x i8> %x) {
; CHECK-LABEL: @lshr_demanded_bits_splat(
; CHECK-NEXT: [[AND:%.*]] = and <2 x i8> %x, <i8 -128, i8 -128>
; CHECK-NEXT: [[SHR:%.*]] = lshr exact <2 x i8> [[AND]], <i8 7, i8 7>
; CHECK-NEXT: ret <2 x i8> [[SHR]]
;
%and = and <2 x i8> %x, <i8 128, i8 128>
%shr = lshr <2 x i8> %and, <i8 7, i8 7>
ret <2 x i8> %shr
}