diff --git a/llvm/test/Transforms/InstCombine/and-narrow.ll b/llvm/test/Transforms/InstCombine/and-narrow.ll index a8661a9f796573..d53aef9ce97c6e 100644 --- a/llvm/test/Transforms/InstCombine/and-narrow.ll +++ b/llvm/test/Transforms/InstCombine/and-narrow.ll @@ -175,6 +175,16 @@ define <2 x i16> @zext_lshr_vec_overshift(<2 x i8> %x) { ret <2 x i16> %r } +define <2 x i16> @zext_lshr_vec_undef(<2 x i8> %x) { +; CHECK-LABEL: @zext_lshr_vec_undef( +; CHECK-NEXT: ret <2 x i16> zeroinitializer +; + %z = zext <2 x i8> %x to <2 x i16> + %b = lshr <2 x i16> %z, undef + %r = and <2 x i16> %b, %z + ret <2 x i16> %r +} + ; Don't create poison by narrowing a shift below the shift amount. define <2 x i16> @zext_shl_vec_overshift(<2 x i8> %x) { @@ -190,3 +200,13 @@ define <2 x i16> @zext_shl_vec_overshift(<2 x i8> %x) { ret <2 x i16> %r } +define <2 x i16> @zext_shl_vec_undef(<2 x i8> %x) { +; CHECK-LABEL: @zext_shl_vec_undef( +; CHECK-NEXT: ret <2 x i16> zeroinitializer +; + %z = zext <2 x i8> %x to <2 x i16> + %b = shl <2 x i16> %z, undef + %r = and <2 x i16> %b, %z + ret <2 x i16> %r +} +