1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 13:11:39 +01:00

[InstCombine] add test to show hole in demanded bits; NFC

llvm-svn: 322660
This commit is contained in:
Sanjay Patel 2018-01-17 14:27:35 +00:00
parent 787e68e0a3
commit 3e4761d633

View File

@ -368,6 +368,25 @@ define <2 x i32> @and_demanded_bits_splat_vec(<2 x i32> %x) {
ret <2 x i32> %z
}
; zext (x >> 8) has all zeros in the high 24-bits: 0x000000xx
; (y | 255) has all ones in the low 8-bits: 0xyyyyyyff
; 'and' of those is all known bits - it's just 'z'.
define i32 @and_zext_demanded(i16 %x, i32 %y) {
; CHECK-LABEL: @and_zext_demanded(
; CHECK-NEXT: [[S:%.*]] = lshr i16 %x, 8
; CHECK-NEXT: [[Z:%.*]] = zext i16 [[S]] to i32
; CHECK-NEXT: [[O:%.*]] = or i32 %y, 255
; CHECK-NEXT: [[A:%.*]] = and i32 [[O]], [[Z]]
; CHECK-NEXT: ret i32 [[A]]
;
%s = lshr i16 %x, 8
%z = zext i16 %s to i32
%o = or i32 %y, 255
%a = and i32 %o, %z
ret i32 %a
}
define i32 @test32(i32 %In) {
; CHECK-LABEL: @test32(
; CHECK-NEXT: ret i32 0