This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/78117] gcc on tilegx builds faulty strstr() function (from glibc)
- From: "cmetcalf at mellanox dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 05 Dec 2017 16:35:08 +0000
- Subject: [Bug target/78117] gcc on tilegx builds faulty strstr() function (from glibc)
- Auto-submitted: auto-generated
- References: <bug-78117-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78117
Chris Metcalf <cmetcalf at mellanox dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |cmetcalf at mellanox dot com
--- Comment #6 from Chris Metcalf <cmetcalf at mellanox dot com> ---
This is believed to be due to a bug in the architecture-independent code that
optimizes vector (SIMD) ops. A smaller test case:
unsigned long test(unsigned long a, unsigned long b)
{
unsigned long result = __insn_v1cmpeq(a, 0);
result >>= 8;
return result;
}
This will correctly emit the v1cmpeq and a right shift at -O0, but at higher
levels the v1cmpeq is optimized away and replaced with a zero, thus also
causing the right shift to be optimized away, and the function just returns
zero. Without the right shift, the v1cmpeq is preserved at all optimization
levels.