David Fernandez wrote:
        Can anyone explain why has been chosen that -march=i686 makes the
compiler change the normal behaviour, and zero-expand unsigned short
parameters into 32-bit registers by all means?

You failed to mention the gcc version, and your testcase doesn't actually use any unsigned short parameters unless you forgot to mention something important, like a macro, or an uncommon command line option. So I can't actually reproduce your problem with the testcase that you gave unless I modify it.

Anyways, I've seen a similar problem reported before, so I am guessing this is related to this patch:
    http://gcc.gnu.org/ml/gcc-patches/2000-02/msg00890.html

So, yes, this was done for a good reason, because it results in faster PentiumPro code on average. Though it does result in some unnecessary extra instructions in some unfortunate cases, like this one. If you don't have a PentiumPro processor, then you may not want to use this option. Pentium 2 through 4 do not have this problem.

See also PR 15184 in our bugzilla database on our web site.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com

Reply via email to