public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "liuhongt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/114396] [13/14 Regression] Vector: Runtime mismatch at -O2 with -fwrapv since r13-7988-g82919cf4cb2321
Date: Wed, 20 Mar 2024 12:36:15 +0000	[thread overview]
Message-ID: <bug-114396-4-qbWQwY3H1l@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114396-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114396

--- Comment #15 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #9)
> (In reply to Robin Dapp from comment #8)
> > No fallout on x86 or aarch64.
> > 
> > Of course using false instead of TYPE_SIGN (utype) is also possible and
> > maybe clearer?
> 
> Well, wi::from_mpz doesn't take a sign argument.  It's comment says
> 
> /* Returns X converted to TYPE.  If WRAP is true, then out-of-range
>    values of VAL will be wrapped; otherwise, they will be set to the
>    appropriate minimum or maximum TYPE bound.  */
> wide_int
> wi::from_mpz (const_tree type, mpz_t x, bool wrap)
> 
> I'm not sure if we really want saturating behavior here, so 'true' is
> more correct?  Note if we want an unsigned result we should pass utype here,
> that might be the bug?  So
> 
>         begin = wi::from_mpz (utype, res, true);
> 
> ?
Yes, it should be.
> 
> The to_mpz args look like they could be mixing signs as well:
> 
>     case vect_step_op_mul:
>       {
>         tree utype = unsigned_type_for (type);
>         init_expr = gimple_convert (stmts, utype, init_expr);
>         wide_int skipn = wi::to_wide (skip_niters);
>         wide_int begin = wi::to_wide (step_expr);
>         auto_mpz base, exp, mod, res;
>         wi::to_mpz (begin, base, TYPE_SIGN (type));
> 
> TYPE_SIGN (step_expr)?
step_expr should have same type as init_expr.
> 
>         wi::to_mpz (skipn, exp, UNSIGNED);
> 
> TYPE_SIGN (skip_niters) (which should be UNSIGNED I guess)?
skipn must be a postive value, so I assume UNSIGNED/SIGNED doesn't make any
difference here.

  parent reply	other threads:[~2024-03-20 12:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19 15:37 [Bug target/114396] New: [14] RISC-V rv64gcv vector: Runtime mismatch at -O3 with -fwrapv patrick at rivosinc dot com
2024-03-19 15:40 ` [Bug target/114396] " patrick at rivosinc dot com
2024-03-19 16:58 ` rdapp at gcc dot gnu.org
2024-03-19 17:01 ` rdapp at gcc dot gnu.org
2024-03-19 17:07 ` redi at gcc dot gnu.org
2024-03-19 17:08 ` [Bug target/114396] [14 Regression] Vector: Runtime mismatch at -O2 " patrick at rivosinc dot com
2024-03-19 17:59 ` [Bug tree-optimization/114396] " pinskia at gcc dot gnu.org
2024-03-19 20:48 ` rdapp at gcc dot gnu.org
2024-03-20  6:12 ` rdapp at gcc dot gnu.org
2024-03-20  8:01 ` rguenth at gcc dot gnu.org
2024-03-20 11:10 ` [Bug tree-optimization/114396] [13/14 " sjames at gcc dot gnu.org
2024-03-20 11:12 ` sjames at gcc dot gnu.org
2024-03-20 11:41 ` sjames at gcc dot gnu.org
2024-03-20 11:42 ` [Bug tree-optimization/114396] [13/14 Regression] Vector: Runtime mismatch at -O2 with -fwrapv since r13-7988-g82919cf4cb2321 sjames at gcc dot gnu.org
2024-03-20 11:56 ` rguenth at gcc dot gnu.org
2024-03-20 12:36 ` liuhongt at gcc dot gnu.org [this message]
2024-03-20 12:40 ` liuhongt at gcc dot gnu.org
2024-03-21  3:25 ` liuhongt at gcc dot gnu.org
2024-03-21 10:01 ` cvs-commit at gcc dot gnu.org
2024-03-21 10:05 ` juzhe.zhong at rivai dot ai
2024-03-21 10:08 ` liuhongt at gcc dot gnu.org
2024-03-21 10:10 ` pinskia at gcc dot gnu.org
2024-03-21 11:17 ` cvs-commit at gcc dot gnu.org
2024-03-22  2:16 ` cvs-commit at gcc dot gnu.org
2024-03-22  2:18 ` cvs-commit at gcc dot gnu.org
2024-03-22  2:19 ` liuhongt 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-114396-4-qbWQwY3H1l@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: link
Be 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).