Created attachment 36275 [details] wide-shift-64.c.219r.combine The new gcc.dg/wide-shift-64.c testcase FAILs on SPARC for the 64-bit multilib only: FAIL: gcc.dg/wide-shift-64.c scan-rtl-dump-not combine "ior" I'm attaching the dump. Btw. I noticed a nit: both the ChangeLog entry and the commit message mention gcc.dg/wide_shift_64_1.c and gcc.dg/wide_shift_128_1.c, while the actual files are named gcc.dg/wide-shift-64.c and gcc.dg/wide-shift-128.c (similarly for the aarch64 testcase), which makes it harder to find when/by whom the files were committed. Rainer
(In reply to Rainer Orth from comment #0) > Created attachment 36275 [details] > wide-shift-64.c.219r.combine > > The new gcc.dg/wide-shift-64.c testcase FAILs on SPARC for the 64-bit > multilib > only: > > FAIL: gcc.dg/wide-shift-64.c scan-rtl-dump-not combine "ior" > > I'm attaching the dump. Rainer, I am trying to reproduce this on my cross environment while I can't. And searching in your dump file, I haven't found "ior" so the testcase should have passed. Can you please have a quick looks at the compile options used when testing this testcase in your multi-lib environment, then I can reproduce in my local sparc x86 cross env where I only have cc1 configured with --target=sparc-linux. Thanks.
> --- Comment #1 from Jiong Wang <jiwang at gcc dot gnu.org> --- > (In reply to Rainer Orth from comment #0) >> Created attachment 36275 [details] >> wide-shift-64.c.219r.combine >> >> The new gcc.dg/wide-shift-64.c testcase FAILs on SPARC for the 64-bit >> multilib >> only: >> >> FAIL: gcc.dg/wide-shift-64.c scan-rtl-dump-not combine "ior" >> >> I'm attaching the dump. > > Rainer, > > I am trying to reproduce this on my cross environment while I can't. > > And searching in your dump file, I haven't found "ior" so the testcase should > have passed. I just noticed I must have been dreaming when submitting this bug report: it's the *32-bit* case that fails, not the 64-bit one. I'm attaching the correct dump this time. > Can you please have a quick looks at the compile options used when testing > this testcase in your multi-lib environment, then I can reproduce in my local > sparc x86 cross env where I only have cc1 configured with --target=sparc-linux. 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
Created attachment 36290 [details] wide-shift-64.c.219r.combine 32-bit dump
(In reply to ro@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.
Author: jiwang Date: Thu Sep 10 10:37:17 2015 New Revision: 227629 URL: https://gcc.gnu.org/viewcvs?rev=227629&root=gcc&view=rev Log: [Patch/expand] Cost instruction sequences when doing left wide shift Patch background details: https://gcc.gnu.org/ml/gcc-patches/2015-08/msg01147.html gcc/ PR rtl-optimization/67421 * expr.c (expand_expr_real_2): Cost instrcution sequences when doing left wide shift tranformation. Modified: trunk/gcc/ChangeLog trunk/gcc/expr.c
fixed