public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110182] [11/12/13/14 Regression] Vector(2) cast from double to float and subtraction seems to produce incorrect results at -O2 and above Date: Thu, 08 Jun 2023 21:17:45 +0000 [thread overview] Message-ID: <bug-110182-4-R7I7sgvl31@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110182-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110182 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|target |tree-optimization Last reconfirmed| |2023-06-08 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Reduced testcase: ``` typedef float vec2float __attribute__((vector_size(2*sizeof(float)))); typedef double vec2double __attribute__((vector_size(2*sizeof(double)))); vec2double f(vec2double a) { auto t0 = a[0]; auto t1 = a[1]; float b0 = t0; float b1 = t1; double c0 = b0; double c1 = b1; auto r0 = t0 - c0; auto r1 = t1 - c1; return (vec2double){r0, r1}; } double f1(double a) { auto t0 = a; float b0 = t0; double c0 = b0; auto r0 = t0 - c0; return r0; } ``` f should produce a similar results as f1 but does not. The problem is not SLP directly, it is doing an ok job. It produces: _12 = a_1(D); vect_b0_4.4_13 = (vector(2) float) _12; vect_c0_6.5_14 = (vector(2) double) vect_b0_4.4_13; vect_r0_8.6_15 = _12 - vect_c0_6.5_14; Which is correct. But then FRE comes along and does: vect_r0_8.6_15 = a_1(D) - a_1(D); Because the code in match.pd that handles /* Handle cases of two conversions in a row. */ Messes up and uses TYPE_PRECISION for vector types but that stores the number of elements in the vector .....
next prev parent reply other threads:[~2023-06-08 21:17 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-08 20:48 [Bug c++/110182] New: GCC generates incorrect results for simple Eigen Casts / Subtractions at -O2 or above for a 3 dimensional vector lakin at vividtheory dot com 2023-06-08 21:00 ` [Bug target/110182] Vector(2) cast from double to float and subtraction seems to produce incorrect results at -O2 and above pinskia at gcc dot gnu.org 2023-06-08 21:01 ` pinskia at gcc dot gnu.org 2023-06-08 21:03 ` [Bug target/110182] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org 2023-06-08 21:17 ` pinskia at gcc dot gnu.org [this message] 2023-06-09 7:16 ` [Bug tree-optimization/110182] [11/12/13/14 Regression] Vector(2) cast from double to float and back and subtraction seems to produce incorrect results rguenth at gcc dot gnu.org 2023-06-09 9:08 ` rguenth at gcc dot gnu.org 2023-06-09 10:10 ` [Bug tree-optimization/110182] [11/12 " rguenth at gcc dot gnu.org 2023-06-23 11:30 ` cvs-commit at gcc dot gnu.org 2023-12-15 12:22 ` [Bug tree-optimization/110182] [11 " 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-110182-4-R7I7sgvl31@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).