This is the mail archive of the gcc-patches@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]

Re: [PATCH] Generate switch statements in genpreds.c


On Tuesday 27 June 2006 15:09, Roger Sayle wrote:
> Whilst getting up to speed on recog's constraint handling while
> investigating the regression PR21299, I noticed that we were
> generating slightly inefficient code in GCC's new genpreds.c
> generator program.
>
> For example, on x86 the arith_or_logical_operator predicate is
> currently synthesized as:
>
>   return (GET_CODE (op) == PLUS || GET_CODE (op) == MULT
>
>           || GET_CODE (op) == AND || GET_CODE (op) == IOR
>           || GET_CODE (op) == XOR || GET_CODE (op) == SMIN
>           || GET_CODE (op) == SMAX || GET_CODE (op) == UMIN
>           || GET_CODE (op) == UMAX || GET_CODE (op) == COMPARE
>           || GET_CODE (op) == MINUS || GET_CODE (op) == DIV
>           || GET_CODE (op) == MOD || GET_CODE (op) == UDIV
>           || GET_CODE (op) == UMOD || GET_CODE (op) == ASHIFT
>           || GET_CODE (op) == ROTATE || GET_CODE (op) == ASHIFTRT
>           || GET_CODE (op) == LSHIFTRT || GET_CODE (op) == ROTATERT)
>
>          && ((mode == VOIDmode || GET_MODE (op) == mode));
>
> This is effectively a minor compile-time regression as the same
> predicate in gcc-3.4 was hand-written as:
>
>   return ((mode == VOIDmode || GET_MODE (op) == mode)
>           && (GET_RTX_CLASS (GET_CODE (op)) == 'c'
>               || GET_RTX_CLASS (GET_CODE (op)) == '2'));

Now in predicates.md it looks like this:

;; Return true for ARITHMETIC_P.
(define_predicate "arith_or_logical_operator"
  (match_code "plus,mult,and,ior,xor,smin,smax,umin,umax,compare,minus,div,
               mod,udiv,umod,ashift,rotate,ashiftrt,lshiftrt,rotatert"))

Silly naive me wonders why there is no match_code_class...

Gr.
Steven


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