http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50762

--- Comment #20 from Uros Bizjak <ubizjak at gmail dot com> 2011-11-10 18:10:33 
UTC ---
(In reply to comment #17)
> > However, it is rejected by the lea_address_operand predicate check
> > due to its mode (VOIDmode != SImode).  This is a bit odd because most
> > standard predicates accept a CONST_INT no matter what mode is requested.
> 
> This isn't only odd, this goes against the documentation:
> 
> "Predicates written with `define_predicate' automatically include a
> test that MODE is `VOIDmode', or OP has the same mode as MODE, or OP is
> a `CONST_INT' or `CONST_DOUBLE'.  They do _not_ check specifically for
> integer `CONST_DOUBLE', nor do they test that the value of either kind
> of constant fits in the requested mode."
> 
> > Maybe one way to fix this would be to define lea_address_operand
> > using define_special_predicate and then implement an appropriate
> > mode check that handles CONST_INT by hand ...
> 
> Clearly the oddity you pointed out above is counter-intuitive.  It is present
> in the original patch: http://gcc.gnu.org/ml/gcc-patches/2004-08/msg00663.html
> 
> Maybe worth discussing on the main list in order to decide what needs to be
> changed, the documentation or the implementation.

The documentation is wrong, so following patch removes all the blurb about
handling of constants.

Index: doc/md.texi
===================================================================
--- doc/md.texi    (revision 181258)
+++ doc/md.texi    (working copy)
@@ -1001,16 +1001,7 @@

 Predicates written with @code{define_predicate} automatically include
 a test that @var{mode} is @code{VOIDmode}, or @var{op} has the same
-mode as @var{mode}, or @var{op} is a @code{CONST_INT} or
-@code{CONST_DOUBLE}.  They do @emph{not} check specifically for
-integer @code{CONST_DOUBLE}, nor do they test that the value of either
-kind of constant fits in the requested mode.  This is because
-target-specific predicates that take constants usually have to do more
-stringent value checks anyway.  If you need the exact same treatment
-of @code{CONST_INT} or @code{CONST_DOUBLE} that the generic predicates
-provide, use a @code{MATCH_OPERAND} subexpression to call
-@code{const_int_operand}, @code{const_double_operand}, or
-@code{immediate_operand}.
+mode as @var{mode}.

Reply via email to