From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id A2D38385354F for ; Fri, 28 Apr 2023 12:37:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A2D38385354F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5C61812FC; Fri, 28 Apr 2023 05:37:50 -0700 (PDT) Received: from [10.57.70.10] (unknown [10.57.70.10]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 79B483F5A1; Fri, 28 Apr 2023 05:37:05 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------YL0XZdpTvoTvVQFN8B0aprRF" Message-ID: Date: Fri, 28 Apr 2023 13:36:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US To: Richard Biener Cc: Richard Biener , Richard Sandiford , "gcc-patches@gcc.gnu.org" References: <51ce8969-3130-452e-092e-f9d91eff2dad@arm.com> From: "Andre Vieira (lists)" Subject: [PATCH 1/3] Refactor to allow internal_fn's In-Reply-To: X-Spam-Status: No, score=-14.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_LOTSOFHASH,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: This is a multi-part message in MIME format. --------------YL0XZdpTvoTvVQFN8B0aprRF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, I'm posting the patches separately now with ChangeLogs. I made the suggested changes and tried to simplify the code a bit further. Where internal to tree-vect-stmts I changed most functions to use code_helper to avoid having to check at places we didn't need to. I was trying to simplify things further by also modifying supportable_half_widening_operation and supportable_convert_operation but the result of that was that I ended up moving the code to cast to tree code inside them rather than at the call site and it didn't look simpler, so I left those. Though if we did make those changes we'd no longer need to keep around the tc1 variable in vectorizable_conversion... Let me know what you think. gcc/ChangeLog: 2023-04-28 Andre Vieira Joel Hutton * tree-vect-patterns.cc (vect_gimple_build): New Function. (vect_recog_widen_op_pattern): Refactor to use code_helper. * tree-vect-stmts.cc (vect_gen_widened_results_half): Likewise. (vect_create_vectorized_demotion_stmts): Likewise. (vect_create_vectorized_promotion_stmts): Likewise. (vect_create_half_widening_stmts): Likewise. (vectorizable_conversion): Likewise. (vectorizable_call): Likewise. (supportable_widening_operation): Likewise. (supportable_narrowing_operation): Likewise. (simple_integer_narrowing): Likewise. * tree-vectorizer.h (supportable_widening_operation): Likewise. (supportable_narrowing_operation): Likewise. (vect_gimple_build): New function prototype. * tree.h (code_helper::safe_as_tree_code): New function. (code_helper::safe_as_fn_code): New function. --------------YL0XZdpTvoTvVQFN8B0aprRF Content-Type: text/plain; charset=UTF-8; name="ifn0_v2.patch" Content-Disposition: attachment; filename="ifn0_v2.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2djYy90cmVlLXZlY3QtcGF0dGVybnMuY2MgYi9nY2MvdHJlZS12ZWN0 LXBhdHRlcm5zLmNjCmluZGV4IDg4MDIxNDFjZDZlZGIyOTg4NjYwMjViOGE1NTg0M2VhZTFm MGViMTcuLmIzNTAyM2FkYWRlOTRjMTk5NmNkMDc2YzRiNzQxOTU2MGU4MTljNmIgMTAwNjQ0 Ci0tLSBhL2djYy90cmVlLXZlY3QtcGF0dGVybnMuY2MKKysrIGIvZ2NjL3RyZWUtdmVjdC1w YXR0ZXJucy5jYwpAQCAtMjUsNiArMjUsOCB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