See <URL:http://gcc.gnu.org/ml/gcc-patches/2005-04/msg02223.html> #4.
See also PR 20413 comment #9.
Only CONST_INT should have VOIDmode, and it's not generated by gengenrtl,
so a patch for this enhancement seems simple.
Note a list of exceptions is needed, for example
The list of exceptions, in addition to those mentioned in the e-mail above, also
needs to include compare, if_then_else and all binary comparison operators; eq,
ne, lt, gt, le, ge.
I'm not opposed to adding checks where appropriate, but clearly the sweeping
statement that the only place we need VOIDmode is const_int, is perhaps an over
In response to comment #2:
Any and all SET_SRC/SET_DEST mode-exceptions must be considered to be added
to genpreds and genrecog as well, for possible omission of the automatically
added mode checks. The sweeping statement humorousely referred to, seems to
be a common delusion, shared with at least those programs. Things don't break
until there's a (match_operand:P "predicate" x) where x is one of those
exceptions (without genpreds/genrecog modified as per const_int).
That then causes the predicate to return false.