00001 /* 00002 * cmpsi2.c 00003 * 00004 * Implementation of cmpsi2, a 32-bit signed compare: r0r1 <=> r2r3 00005 * Returns -1, 0, or 1, which might not be correct. 00006 * 00007 * The contents of this file are subject to the Mozilla Public License 00008 * Version 1.0 (the "License"); you may not use this file except in 00009 * compliance with the License. You may obtain a copy of the License at 00010 * http://www.mozilla.org/MPL/ 00011 * 00012 * Software distributed under the License is distributed on an "AS IS" 00013 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 00014 * License for the specific language governing rights and limitations 00015 * under the License. 00016 * 00017 * The Original Code is Librcx code, released February 9, 1999. 00018 * 00019 * The Initial Developer of the Original Code is Kekoa Proudfoot. 00020 * Portions created by Kekoa Proudfoot are Copyright (C) 1999 00021 * Kekoa Proudfoot. All Rights Reserved. 00022 * 00023 * Contributor(s): Kekoa Proudfoot <kekoa@graphics.stanford.edu> 00024 */ 00025 00026 __asm__ ("\n\ 00027 .section .text\n\ 00028 \n\ 00029 .global ___cmpsi2\n\ 00030 \n\ 00031 ___cmpsi2:\n\ 00032 \n\ 00033 sub.w r3,r1\n\ 00034 subx.b r2l,r0l\n\ 00035 subx.b r2h,r0h\n\ 00036 \n\ 00037 blt else_0\n\ 00038 \n\ 00039 beq else_1\n\ 00040 \n\ 00041 ; First operand greater than second operand\n\ 00042 \n\ 00043 mov.w #1,r0\n\ 00044 rts\n\ 00045 \n\ 00046 else_1:\n\ 00047 \n\ 00048 ; First operand equal to second operand\n\ 00049 \n\ 00050 sub.w r0,r0\n\ 00051 rts\n\ 00052 \n\ 00053 endif_1:\n\ 00054 \n\ 00055 else_0:\n\ 00056 \n\ 00057 ; First operand less than second operand\n\ 00058 \n\ 00059 mov.w #-1,r0\n\ 00060 rts\n\ 00061 \n\ 00062 endif_0:\n\ 00063 \n\ 00064 ; Not reached\n\ 00065 ");