https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67421

--- Comment #4 from Jiong Wang <jiwang at gcc dot gnu.org> ---
(In reply to r...@cebitec.uni-bielefeld.de from comment #2)
> cc1 is invoked like this for a 32-bit-default configuration:
> 
> $ cc1 -quiet wide-shift-64.c -mcpu=v9 -O2 -fdump-rtl-combine -o
> wide-shift-64.s
> 
>       Rainer

Thanks, I basically understand where is the problem. By some option combination
sparc will enable target private wide shift pattern to override the middle-end
generic optimization, as the generic optimization honor target private
mechanism by the follow checking at expr.c:

             && ! have_insn_for (ASHIFT, mode)  

although the target private wide shift generate worse code.

I can't reproduce this issue by the following configure on trunk

../gcc-git-official/configure --enable-tls --target=sparc-linux
--enable-languages=c,c++

While after search sparc source code, I found sparc defined target private wide
shift, but it's only enabled when "TARGET_ARCH64 || TARGET_V8PLUS", then only
used when "! TARGET_ARCH64"

(define_expand "ashldi3"
  "TARGET_ARCH64 || TARGET_V8PLUS"
{
  if (! TARGET_ARCH64)

So, the testcase failed when I pass -mv8plus and -mcpu=v9 at the same time
which enable sparc target wide shift under 32bit.

[FAIL]./cc1 -quiet wide-shift-64.c -O2 -fdump-rtl-combine -nostdinc -mv8plus
-mcpu=v9

Jeff was suggesting we add cost check in generic code to make better decision
whether generic code should honor target private pattern.

Currently, I think we can just skip sparc for this testcase as I haven't found
good way in dejagnu to just skip when "-mv8plus" specified.

Reply via email to