This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/30778] [4.3 Regression] invalid code generation for memset() with -mtune=k8



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]