I'm updating the machine description for a 16-bit microcontroller, and am trying to eliminate some hand-coded SImode and DImode insns because in general gcc generates better code automatically. So far, I've found no case where I seem to need to implement cbranchsi4 or cbranchdi4.
However, gcc does generate a reference to __ucmpsi2 when compiling a switch statement with a default clause and a 32-bit integer as the selection expression. The mailing list archives suggest that cmpsi2 was at one point a library routine, but it is not documented in the internals (at least in the 4.5.x branch where I'm currently working). libgcc2 provides a presumably trusted implementation of __ucmpdi2, though except for a switch statement with a default clause and a 64-bit selection expression I've been unable to find any way to generate test code that actually uses it (gcc.c-torture/execute/cmpdi-1.c doesn't.) I've never been able to get the signed version __cmpdi2 to show up. One past message (http://gcc.gnu.org/ml/gcc/2007-08/msg00225.html) suggests that a similar evocation of __cmpsi2 might be a bug that arose because there are "two different sizes of signed integers both of which are larger than word_mode". Which is the case in the MSP430. GCC seems fully capable of reducing SImode and DImode comparisons to HImode in every other situation. Is generation of this undocumented helper function worth treating as a bug in the compiler, or is the documentation incomplete and back-ends (or libgcc2.c) should be providing an implementation? If the former, I'll spend some time trying to isolate it; if the latter, I won't bother. Peter