diff --git a/mach/mips/libem/compareul.s b/mach/mips/libem/compareul.s new file mode 100644 index 000000000..dccd92234 --- /dev/null +++ b/mach/mips/libem/compareul.s @@ -0,0 +1,39 @@ +# +.sect .text; .sect .rom; .sect .data; .sect .bss + +/* + * 64-big unsigned tristate comparison. + * Inputs: + * r2r3: left + * r4r5: right + * Outputs; + * r2: result + */ + +.sect .text +.define .compareul +.compareul: + /* Compare high words. */ + + sltu at, r3, r5 ! if r3r5, then 1 + bne at, zero, exit + nop + + /* High words are equal --- compare low words. */ + + sltu at, r2, r4 ! if r2r4, then 1 +exit: + mov r2, at + jr ra + nop + diff --git a/mach/mips/mcg/table b/mach/mips/mcg/table index 321eaea5d..955e09ace 100644 --- a/mach/mips/mcg/table +++ b/mach/mips/mcg/table @@ -35,7 +35,7 @@ REGISTERS r22 named("r22") int; r23 named("r23") int; - r4r5 named("r4", "r5") aliases(r4, r5) long volatile; + r4r5 named("r4", "r5") aliases(r4, r5) long volatilei lret1; r6r7 named("r6", "r7") aliases(r6, r7) long volatile; r8r9 named("r8", "r9") aliases(r8, r9) long volatile; r10r11 named("r10", "r11") aliases(r10, r11) long volatile; @@ -490,6 +490,11 @@ PATTERNS emit "1:" cost 20; + out:(iret)reg = COMPAREUL.I(left:(lret)reg, right:(lret1)reg) + emit "jal .compareul" + emit "nop" + cost 30; + out:(int)reg = COMPAREF.I(left:(float)reg, right:(float)reg) with preserved(%left), preserved(%right) emit "c.lt.s 0, %left, %right"