public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104595] unvectorized loop due to bool condition loaded from memory Date: Wed, 23 Feb 2022 07:18:17 +0000 [thread overview] Message-ID: <bug-104595-4-jbBjjIJjCk@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104595-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104595 --- Comment #8 from Kewen Lin <linkw at gcc dot gnu.org> --- I had one local hack and just found it can survive on x86 bootstrapping and regression testing. I guess maybe it's good to post here. Just ignore this if it looks like noise. :) The point is to do the conversion for the loaded bool value from memory, normally it should be like a nop, but for this test case, it can help us to generate the expected char comparison. diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index 2baf974627e..d4b8920203b 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -3911,6 +3911,11 @@ check_bool_pattern (tree var, vec_info *vinfo, hash_set<gimple *> &stmts) return false; break; + case ARRAY_REF: + if (TYPE_PRECISION (TREE_TYPE (var)) != 1) + return false; + break; + default: if (TREE_CODE_CLASS (rhs_code) == tcc_comparison) { @@ -4005,6 +4010,19 @@ adjust_bool_pattern (vec_info *vinfo, tree var, tree out_type, SSA_NAME, irhs1); break; + case ARRAY_REF: + { + itype = TREE_TYPE (var); + gcc_assert (TYPE_PRECISION (itype) == 1); + machine_mode mode = TYPE_MODE (itype); + tree scalar_type = build_nonstandard_integer_type ( + GET_MODE_BITSIZE (mode).to_constant (), TYPE_UNSIGNED (itype)); + pattern_stmt + = gimple_build_assign (vect_recog_temp_ssa_var (scalar_type, NULL), + CONVERT_EXPR, var); + } + break; + case BIT_NOT_EXPR: irhs1 = *defs.get (rhs1); itype = TREE_TYPE (irhs1);
next prev parent reply other threads:[~2022-02-23 7:18 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-18 10:05 [Bug tree-optimization/104595] New: " linkw at gcc dot gnu.org 2022-02-18 10:27 ` [Bug tree-optimization/104595] " rguenth at gcc dot gnu.org 2022-02-18 16:26 ` segher at gcc dot gnu.org 2022-02-20 3:52 ` pinskia at gcc dot gnu.org 2022-02-20 3:58 ` pinskia at gcc dot gnu.org 2022-02-21 7:54 ` rguenth at gcc dot gnu.org 2022-02-21 10:01 ` rguenth at gcc dot gnu.org 2022-02-21 13:26 ` rguenth at gcc dot gnu.org 2022-02-21 13:45 ` rguenth at gcc dot gnu.org 2022-02-23 7:18 ` linkw at gcc dot gnu.org [this message] 2022-02-23 7:41 ` rguenther at suse dot de 2022-02-23 8:55 ` linkw at gcc dot gnu.org 2022-05-05 8:37 ` cvs-commit at gcc dot gnu.org 2022-05-05 8:39 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-104595-4-jbBjjIJjCk@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).