From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id B7D403858C31 for ; Sat, 19 Aug 2023 15:49:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B7D403858C31 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fe1d462762so18202245e9.0 for ; Sat, 19 Aug 2023 08:49:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692460170; x=1693064970; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NUmrIAseLzojd4rWyGOavosHE4ycUrhkLMzPTXcN97M=; b=belsB8u0ykJv/ixg0IEB/kENSyv843+UrhaRql07Qhc6lJl8lywEwkfitWW3wDThPO PtQ7Q6gUvqGb2PrzSunc2GhNmWOylUbSfwnX3igSNfAGurZtlubK51V3aeYbxgyq79du G7LS/RQxgP5+2nByzv8rb7skYMgRj14ELPlk2VZPnW+pWZGuLTeitZj4+jGhEABsZWlj A6gSmMOkZmIZL77nGVBCFmMGo3EVClGQBy+/is6FtMeoyYW0dAuCE/truWFJEcxAEzs4 +Hku3BjM3SKWdF6GIgA0VWiF90QcINdXBQ4TQxYjMbdQo8lv7BWrUnDOBM2k0qB+XnlC YL1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692460170; x=1693064970; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NUmrIAseLzojd4rWyGOavosHE4ycUrhkLMzPTXcN97M=; b=AXMlFVlqEjYd47naIhEjxqO38B2GqnnrdxgnsRjkyxBcNzDK3Cq6j4PAPMzLQvLp1Q 5Tcav5apswYibTcgJW2qd8Rm2A/HRWEx4udEyiHJM6/pc9X9v8W3lrjt0lWk5oFGMs4x FUvhEBtkuwSN+vLqYN4iTVgg5eCgMLJMoSKWYzQBgxphCYcAhRRIcwh+f6wWYFJrHNuS cTrsFZWYSGPd6jDI1L9bMKwv3qhUF64vn1vA3GfOYUzz7SuWHiPW7GBgyQCYLERg/Es7 CHg7tU3m8hdhUgxZSbGjuz/6awEB6s7NBzT2z2Xk3sfYpN9KwPKcXrYq0eCn7HTYNMUw HOvw== X-Gm-Message-State: AOJu0YyghzM9Nzc2gwdIadCzWa0l/90nwRNRLUjL/DWM0nspcvrgGQA0 ZELtof1seSusya30UouPAp/dNMjAiXWlYI/E/R5ucA== X-Google-Smtp-Source: AGHT+IHO26wfLXNhRVrgaS4A/OR43TA5ZyPqadMQbKi46YW40UoNmLj/CYqdiCOsxEdQZHkblRAaGYh0wxdmRT//vzg= X-Received: by 2002:adf:e702:0:b0:31a:e3ad:f30e with SMTP id c2-20020adfe702000000b0031ae3adf30emr1538538wrm.68.1692460169760; Sat, 19 Aug 2023 08:49:29 -0700 (PDT) MIME-Version: 1.0 References: <20230728070552.50C1413276@imap2.suse-dmz.suse.de> <320f94c3-8805-ec64-dd4b-0454c8ecce14@gmail.com> In-Reply-To: From: Prathamesh Kulkarni Date: Sat, 19 Aug 2023 21:18:53 +0530 Message-ID: Subject: Re: [PATCH][RFC] tree-optimization/92335 - Improve sinking heuristics for vectorization To: Richard Biener Cc: Jeff Law , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Content-Type: multipart/mixed; boundary="000000000000373ff3060348972f" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000373ff3060348972f Content-Type: text/plain; charset="UTF-8" On Fri, 18 Aug 2023 at 17:11, Richard Biener wrote: > > On Fri, 18 Aug 2023, Richard Biener wrote: > > > On Thu, 17 Aug 2023, Prathamesh Kulkarni wrote: > > > > > On Tue, 15 Aug 2023 at 14:28, Richard Sandiford > > > wrote: > > > > > > > > Richard Biener writes: > > > > > On Mon, 14 Aug 2023, Prathamesh Kulkarni wrote: > > > > >> On Mon, 7 Aug 2023 at 13:19, Richard Biener wrote: > > > > >> > It doesn't seem to make a difference for x86. That said, the "fix" is > > > > >> > probably sticking the correct target on the dump-check, it seems > > > > >> > that vect_fold_extract_last is no longer correct here. > > > > >> Um sorry, I did go thru various checks in target-supports.exp, but not > > > > >> sure which one will be appropriate for this case, > > > > >> and am stuck here :/ Could you please suggest how to proceed ? > > > > > > > > > > Maybe Richard S. knows the magic thing to test, he originally > > > > > implemented the direct conversion support. I suggest to implement > > > > > such dg-checks if they are not present (I can't find them), > > > > > possibly quite specific to the modes involved (like we have > > > > > other checks with _qi_to_hi suffixes, for float modes maybe > > > > > just _float). > > > > > > > > Yeah, can't remember specific selectors for that feature. TBH I think > > > > most (all?) of the tests were AArch64-specific. > > > Hi, > > > As Richi mentioned above, the test now vectorizes on AArch64 because > > > it has support for direct conversion > > > between vectors while x86 doesn't. IIUC this is because > > > supportable_convert_operation returns true > > > for V4HI -> V4SI on Aarch64 since it can use extend_v4hiv4si2 for > > > doing the conversion ? > > > > > > In the attached patch, I added a new target check vect_extend which > > > (currently) returns 1 only for aarch64*-*-*, > > > which makes the test PASS on both the targets, altho I am not sure if > > > this is entirely correct. > > > Does the patch look OK ? > > > > Can you make vect_extend more specific, say vect_extend_hi_si or > > what is specifically needed here? Note I'll have to investigate > > why x86 cannot vectorize here since in fact it does have > > the extend operation ... it might be also worth splitting the > > sign/zero extend case, so - vect_sign_extend_hi_si or > > vect_extend_short_int? > > And now having anaylzed _why_ x86 doesn't vectorize it's rather > why we get this vectorized with NEON which is because > > static opt_machine_mode > aarch64_vectorize_related_mode (machine_mode vector_mode, > scalar_mode element_mode, > poly_uint64 nunits) > { > ... > /* Prefer to use 1 128-bit vector instead of 2 64-bit vectors. */ > if (TARGET_SIMD > && (vec_flags & VEC_ADVSIMD) > && known_eq (nunits, 0U) > && known_eq (GET_MODE_BITSIZE (vector_mode), 64U) > && maybe_ge (GET_MODE_BITSIZE (element_mode) > * GET_MODE_NUNITS (vector_mode), 128U)) > { > machine_mode res = aarch64_simd_container_mode (element_mode, 128); > if (VECTOR_MODE_P (res)) > return res; > > which makes us get a V4SImode vector for a V4HImode loop vector_mode. Thanks for the explanation! > > So I think the appropriate effective dejagnu target is > aarch64-*-* (there's none specifically to advsimd, not sure if one > can disable that?) The attached patch uses aarch64*-*-* target check, and additionally for SVE (and other targets supporting vect_fold_extract_last) it checks if the condition reduction was carried out using FOLD_EXTRACT_LAST. Does that look OK ? Thanks, Prathamesh > > Richard. > > > > Thanks, > > > Prathamesh > > > > > > > > Thanks, > > > > Richard > > > > > > > > > -- > Richard Biener > SUSE Software Solutions Germany GmbH, > Frankenstrasse 146, 90461 Nuernberg, Germany; > GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg) --000000000000373ff3060348972f Content-Type: text/plain; charset="US-ASCII"; name="gnu-875-2.txt" Content-Disposition: attachment; filename="gnu-875-2.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lli6wnmg0 ZGlmZiAtLWdpdCBhL2djYy90ZXN0c3VpdGUvZ2NjLmRnL3ZlY3QvcHI2NTk0Ny03LmMgYi9nY2Mv dGVzdHN1aXRlL2djYy5kZy92ZWN0L3ByNjU5NDctNy5jCmluZGV4IDE2Y2RjZDFjNmViLi41OGM0 NmRmNWM1NCAxMDA2NDQKLS0tIGEvZ2NjL3Rlc3RzdWl0ZS9nY2MuZGcvdmVjdC9wcjY1OTQ3LTcu YworKysgYi9nY2MvdGVzdHN1aXRlL2djYy5kZy92ZWN0L3ByNjU5NDctNy5jCkBAIC01Miw1ICs1 Miw1IEBAIG1haW4gKHZvaWQpCiAgIHJldHVybiAwOwogfQogCi0vKiB7IGRnLWZpbmFsIHsgc2Nh bi10cmVlLWR1bXAgIkxPT1AgVkVDVE9SSVpFRCIgInZlY3QiIHsgdGFyZ2V0IHZlY3RfZm9sZF9l eHRyYWN0X2xhc3QgfSB9IH0gKi8KLS8qIHsgZGctZmluYWwgeyBzY2FuLXRyZWUtZHVtcC1ub3Qg IkxPT1AgVkVDVE9SSVpFRCIgInZlY3QiIHsgdGFyZ2V0IHsgISB2ZWN0X2ZvbGRfZXh0cmFjdF9s YXN0IH0gfSB9IH0gKi8KKy8qIHsgZGctZmluYWwgeyBzY2FuLXRyZWUtZHVtcCAib3B0aW1pemlu ZyBjb25kaXRpb24gcmVkdWN0aW9uIHdpdGggRk9MRF9FWFRSQUNUX0xBU1QiICJ2ZWN0IiB7IHRh cmdldCB2ZWN0X2ZvbGRfZXh0cmFjdF9sYXN0IH0gfSB9ICovCisvKiB7IGRnLWZpbmFsIHsgc2Nh bi10cmVlLWR1bXAgIkxPT1AgVkVDVE9SSVpFRCIgInZlY3QiIHsgdGFyZ2V0IGFhcmNoNjQqLSot KiB9IH0gfSAqLwo= --000000000000373ff3060348972f--