This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/30778] [4.3 Regression] invalid code generation for memset() with -mtune=k8
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Feb 2007 08:53:41 -0000
- Subject: [Bug target/30778] [4.3 Regression] invalid code generation for memset() with -mtune=k8
- References: <bug-30778-7958@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from ubizjak at gmail dot com 2007-02-24 08:53 -------
The problem here is in ix86_expand_set_or_movmem_via_loop().
In mtune=k8 case, we choose unrolled_loop as the algorithm, where main loop is
expanded as
expand_set_or_movmem_via_loop (dst, NULL, destreg, NULL, promoted_val,
count_exp, Pmode, 4, expected_size);
However, the value of "expected_size" equals 31 in the above testcase! This is
smaller that the smallest chunk size (SIZEOF (Pmode) * 4), requested by caller.
For some reason, expand_set_or_movmem_via_loop() doesn't detect this anomaly
and generates loop for requested chunk size.
The fix is obvious and straightforward. Bail out of
expand_set_or_movmem_via_loop() early if expected_size < piece_size.
I'll fix this in the evening (CET) if Jan won't beat me to it ;)
, where some kind of guard is missing before entering "Main loop" section.
--
ubizjak at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30778