public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/31966] [4.1/4.2/4.3 Regression] Miscompiles valid code with -ftree-vectorize Date: Sun, 01 Jul 2007 09:33:00 -0000 [thread overview] Message-ID: <20070701093330.23819.qmail@sourceware.org> (raw) In-Reply-To: <bug-31966-6477@http.gcc.gnu.org/bugzilla/> ------- Comment #5 from ubizjak at gmail dot com 2007-07-01 09:33 ------- Confirmed. This is the same bug as PR32533, but this one comes with the c testcase. The problem is in ifcvt pass. In -march=nocona case (-march=nocona -O2 -ftree-vectorize), we have following code before ifcvt pass: if (high_top_bit_11 != 0) goto <bb 5>; else goto <bb 4>; <bb 4>: if (d_7(D) <= high_19) goto <bb 5>; else goto <bb 6>; <bb 5>: high_21 = high_19 - d_7(D); quotient_22 = quotient_20 | 1; <bb 6>: # quotient_3 = PHI <quotient_20(4), quotient_22(5)> # high_1 = PHI <high_19(4), high_21(5)> j_23 = j_32 + 1; This code is converted by ifcvt pass to: quotient_20 = quotient_31 << 1; [+] D.2068_5 = high_top_bit_11 == 0; D.2069_4 = d_7(D) <= high_19; _ifc_.29_2 = D.2068_5 && D.2069_4; D.2071_29 = high_top_bit_11 == 0; D.2072_33 = d_7(D) > high_19; _ifc_.30_34 = D.2071_29 && D.2072_33; high_21 = high_19 - d_7(D); quotient_22 = quotient_20 | 1; [++] quotient_3 = high_top_bit_11 == 0 ? quotient_20 : quotient_22; <<< here! high_1 = high_top_bit_11 == 0 ? high_19 : high_21; <<< here! j_23 = j_32 + 1; The condition for quotient_3 [and high_1], produced by ifcvt pass is wrong, and should be: quotient_3 = _ifc_.3034 ? quotient_20 : quotient_22; This is evident from the inner loop of the testcase: --cut here-- { word high_top_bit = (high & MP_WORD_TOP_BIT); high <<= 1; high |= (n0 >> (MP_WORD_BITS-1-j)) & 1; quotient <<= 1; [+] if(high_top_bit || high >= d) <<<< _the_condition_ { high -= d; quotient |= 1; [++] } } --cut here-- Due to slighlty different gimple generation for -march=core2 (please look into _.004t.gimple) where only if branch is created, ifcvt is able to create correct code: quotient_20 = quotient_34 << 1; [+] D.2065_21 = high_top_bit_11 != 0; D.2066_22 = high_19 >= d_7(D); D.2067_23 = D.2065_21 || D.2066_22; high_24 = high_19 - d_7(D); quotient_25 = quotient_20 | 1; [++] quotient_3 = D.2067_23 ? quotient_25 : quotient_20; <<<< here -- ubizjak at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ubizjak at gmail dot com Priority|P3 |P1 Summary|Miscompiles valid code with |[4.1/4.2/4.3 Regression] |-ftree-vectorize and - |Miscompiles valid code with |march=nocona |-ftree-vectorize Target Milestone|--- |4.1.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31966
next prev parent reply other threads:[~2007-07-01 9:33 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-05-17 6:35 [Bug tree-optimization/31966] New: Miscompiles valid code with -ftree-vectorize and -march=nocona lloyd at randombit dot net 2007-05-17 6:37 ` [Bug tree-optimization/31966] " lloyd at randombit dot net 2007-06-30 22:11 ` lloyd at randombit dot net 2007-07-01 8:48 ` dorit at gcc dot gnu dot org 2007-07-01 8:52 ` dorit at gcc dot gnu dot org 2007-07-01 9:33 ` ubizjak at gmail dot com [this message] 2007-07-01 14:20 ` [Bug tree-optimization/31966] [4.1/4.2/4.3 Regression] Miscompiles valid code with -ftree-vectorize ubizjak at gmail dot com 2007-07-01 15:46 ` ubizjak at gmail dot com 2007-07-02 14:02 ` ubizjak at gmail dot com 2007-07-02 14:26 ` uros at gcc dot gnu dot org 2007-07-02 14:28 ` [Bug tree-optimization/31966] [4.1/4.2 " ubizjak at gmail dot com 2007-07-04 5:41 ` uros at gcc dot gnu dot org 2007-07-04 5:49 ` uros at gcc dot gnu dot org 2007-07-04 5:54 ` ubizjak at gmail dot com
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=20070701093330.23819.qmail@sourceware.org \ --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).