Message ID | 20140204124045.GJ12671@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On 02/04/2014 04:40 AM, Jakub Jelinek wrote: > - tem = expand_shift (LSHIFT_EXPR, mode, lopart, hprec, NULL_RTX, 1); > + tem = gen_rtx_SUBREG (mode, lopart, 0); > + tem = expand_shift (LSHIFT_EXPR, mode, tem, hprec, NULL_RTX, 1); I would be happier with gen_lowpart rather than the explicit gen_rtx_subreg. Ok with that change. r~
On Thu, Feb 06, 2014 at 06:53:55AM -0800, Richard Henderson wrote: > On 02/04/2014 04:40 AM, Jakub Jelinek wrote: > > - tem = expand_shift (LSHIFT_EXPR, mode, lopart, hprec, NULL_RTX, 1); > > + tem = gen_rtx_SUBREG (mode, lopart, 0); > > + tem = expand_shift (LSHIFT_EXPR, mode, tem, hprec, NULL_RTX, 1); > > I would be happier with gen_lowpart rather than the explicit gen_rtx_subreg. I need a paradoxical subreg, gen_lowpart ICEs in that case (for ppc* here lopart is SImode, I need DImode paradoxical subreg of that, so that I can shift it up by 32 bits and thus get a DImode value with the lopart bits in the upper 32 bits and zero in the rest. Jakub
On 02/06/2014 08:02 AM, Jakub Jelinek wrote: > On Thu, Feb 06, 2014 at 06:53:55AM -0800, Richard Henderson wrote: >> On 02/04/2014 04:40 AM, Jakub Jelinek wrote: >>> - tem = expand_shift (LSHIFT_EXPR, mode, lopart, hprec, NULL_RTX, 1); >>> + tem = gen_rtx_SUBREG (mode, lopart, 0); >>> + tem = expand_shift (LSHIFT_EXPR, mode, tem, hprec, NULL_RTX, 1); >> >> I would be happier with gen_lowpart rather than the explicit gen_rtx_subreg. > > I need a paradoxical subreg, gen_lowpart ICEs in that case It does? Since when? I've certainly used it for paradoxicals in the past. Oh, I see, yes, it would ICE for a multi-word paradoxical subreg. But that sort of thing is ... skirting the bounds of validity at best. Surely we should be able to optimize away a zero-extension in all cases? r~
On Thu, Feb 06, 2014 at 08:23:00AM -0800, Richard Henderson wrote: > On 02/06/2014 08:02 AM, Jakub Jelinek wrote: > > On Thu, Feb 06, 2014 at 06:53:55AM -0800, Richard Henderson wrote: > >> On 02/04/2014 04:40 AM, Jakub Jelinek wrote: > >>> - tem = expand_shift (LSHIFT_EXPR, mode, lopart, hprec, NULL_RTX, 1); > >>> + tem = gen_rtx_SUBREG (mode, lopart, 0); > >>> + tem = expand_shift (LSHIFT_EXPR, mode, tem, hprec, NULL_RTX, 1); > >> > >> I would be happier with gen_lowpart rather than the explicit gen_rtx_subreg. > > > > I need a paradoxical subreg, gen_lowpart ICEs in that case > > It does? Since when? I've certainly used it for paradoxicals in the past. > > Oh, I see, yes, it would ICE for a multi-word paradoxical subreg. But that > sort of thing is ... skirting the bounds of validity at best. > > Surely we should be able to optimize away a zero-extension in all cases? All I know is that the generated code with the ZERO_EXTEND has been larger than with the paradoxical subreg. But if you prefer, I can surely emit a ZERO_EXTEND and open a PR for GCC 5.0 that we should investigate why we generate worse code then. Jakub
On 02/06/2014 08:25 AM, Jakub Jelinek wrote: > On Thu, Feb 06, 2014 at 08:23:00AM -0800, Richard Henderson wrote: >> On 02/06/2014 08:02 AM, Jakub Jelinek wrote: >>> On Thu, Feb 06, 2014 at 06:53:55AM -0800, Richard Henderson wrote: >>>> On 02/04/2014 04:40 AM, Jakub Jelinek wrote: >>>>> - tem = expand_shift (LSHIFT_EXPR, mode, lopart, hprec, NULL_RTX, 1); >>>>> + tem = gen_rtx_SUBREG (mode, lopart, 0); >>>>> + tem = expand_shift (LSHIFT_EXPR, mode, tem, hprec, NULL_RTX, 1); >>>> >>>> I would be happier with gen_lowpart rather than the explicit gen_rtx_subreg. >>> >>> I need a paradoxical subreg, gen_lowpart ICEs in that case >> >> It does? Since when? I've certainly used it for paradoxicals in the past. >> >> Oh, I see, yes, it would ICE for a multi-word paradoxical subreg. But that >> sort of thing is ... skirting the bounds of validity at best. >> >> Surely we should be able to optimize away a zero-extension in all cases? > > All I know is that the generated code with the ZERO_EXTEND has been larger > than with the paradoxical subreg. But if you prefer, I can surely emit a > ZERO_EXTEND and open a PR for GCC 5.0 that we should investigate why we > generate worse code then. Yes please. r~
--- gcc/internal-fn.c.jj 2014-01-29 12:43:24.000000000 +0100 +++ gcc/internal-fn.c 2014-02-03 10:40:57.000000000 +0100 @@ -646,7 +646,8 @@ ubsan_expand_si_overflow_mul_check (gimp emit_cmp_and_jump_insns (hipart, const0_rtx, GE, NULL_RTX, hmode, false, after_hipart_neg, PROB_EVEN); - tem = expand_shift (LSHIFT_EXPR, mode, lopart, hprec, NULL_RTX, 1); + tem = gen_rtx_SUBREG (mode, lopart, 0); + tem = expand_shift (LSHIFT_EXPR, mode, tem, hprec, NULL_RTX, 1); tem = expand_simple_binop (mode, MINUS, loxhi, tem, NULL_RTX, 1, OPTAB_DIRECT); emit_move_insn (loxhi, tem);