[llvm] [DAG] fold `avgs(sext(x), sext(y))` -> `sext(avgs(x, y))` (PR #95365)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 06:38:16 PDT 2024


================
@@ -870,10 +866,6 @@ define <4 x i16> @hadd8_zext_lsr(<4 x i8> %src1, <4 x i8> %src2) {
 define <2 x i16> @hadd8x2_sext_asr(<2 x i8> %src1, <2 x i8> %src2) {
 ; CHECK-LABEL: hadd8x2_sext_asr:
 ; CHECK:       // %bb.0:
-; CHECK-NEXT:    shl.2s v1, v1, #24
-; CHECK-NEXT:    shl.2s v0, v0, #24
-; CHECK-NEXT:    sshr.2s v1, v1, #24
-; CHECK-NEXT:    sshr.2s v0, v0, #24
 ; CHECK-NEXT:    shadd.2s v0, v0, v1
----------------
RKSimon wrote:

Found the problem - m_SExt is matching ISD::SIGN_EXTEND_INREG nodes, which isn't what we want here. 

@mshockwave I think this is a bug as we can't easily discriminate between ISD::SIGN_EXTEND and ISD::SIGN_EXTEND_INREG.

https://github.com/llvm/llvm-project/pull/95365


More information about the llvm-commits mailing list