------- Comment #5 from wilson at gcc dot gnu dot org 2010-05-25 06:30 ------- Richard Guenther suggested using DOT_PROD_EXPR. I ran into several problems with that.
DOT_PROD_EXPR expands to the sdot_prodM pattern. The mips port is using maddMN. We essentially have two named patterns that are doing the exact same thing, except that one is only used with vector types and one is only used with integer types. The name DOT_PROD_EXPR makes sense for the vector type case, but not so much for the integer type case. sdot_prodM gets installed into the optabs table with mode M. maddMN gets installed into the optabs table with mode N, where N is twice the size of mode M. This complicates lookup, since we need to use different modes for the different operators. All widening integer operations use mode N here, so it seems wrong to change one. sdot_prodM is available in two flavors, signed/unsigned. maddMN is available in 8 flavors, signed/unsigned saturating/non-saturating multiply add/subtract. The subtract part is the hard one, since I can't see any way to get a subtract from a dot product operator. Dot product very strongly implies that you are doing addition, and I know of no equivalent that uses subtraction. dot_prodM patterns are used in 3 md files (i386, ia64, rs6000). maddMN patterns are used in 1 md file (mips). Rather than mess with this, I ended up just adding some new tree operators, WIDEN_MULT_PLUS_EXPR and WIDEN_MULT_MINUS_EXPR. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43902