http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48348
Summary: incorrect loongson builtin pcmpgtb_u Product: gcc Version: 4.6.1 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: h...@gcc.gnu.org Target: mips64el-unknown-linux-gnu There's no such instruction. The GCC intrinsic pcmpgtb_u maps to a *signed* compare insn, the same as pcmpgtb_s. To wit: #include <loongson.h> #include <stdio.h> static void vdump(const char *s, void *v) { unsigned char *r = v; int i; printf("%04s:", s); for (i = 0; i < sizeof (uint8x8_t); i++) printf (" %02x", r[i]); printf("\n"); } int main(void) { uint8x8_t v1 = {2, 3, 0, 0xff, 1, 0x80, 0x40, 0xfe}; uint8x8_t v2 = {3, 2, 0xff, 0, 0xff, 0x81, 0xc0, 0xff}; uint8x8_t res; res = pcmpgtb_u (v1, v2); vdump("v1", &v1); vdump("v2", &v2); vdump("res", &res); } gcc51% ./xgcc -O2 -B./ -march=loongson2f ~/pcmpgtu.c -o a gcc51% ./a v1: 02 03 00 ff 01 80 40 fe v2: 03 02 ff 00 ff 81 c0 ff res: 00 ff ff 00 ff 00 ff 00 I suggest the builtin either removed or changed to emit multiple instructions (you'd need only a pmaxub and a pcmpeqb) to implement the correct comparison operator. gcc version 4.6.0 20110309 (experimental) [trunk revision 170836] (GCC)