FictionTools/z88dk/src/sccz80/codegen.c
/* Test for greater than (signed/unsigned) */
Test for greater than (signed/unsigned)
Test for greater than ( signed / unsigned )
void zgt(LVALUE* lval)
{
    lval->oldval_kind = lval->val_type;
    lval->ptr_type = KIND_NONE;
    switch (lval->val_type) {
    case KIND_LONG:
    case KIND_CPTR:
        if (ulvalue(lval))
            callrts("l_long_ugt");
        else
            callrts("l_long_gt");
        set_int(lval);            
        Zsp += 4;
        break;
    case KIND_DOUBLE:
        callrts("fgt");
        Zsp += c_fp_size;
        set_int(lval);
        break;
    case KIND_CHAR:
        if (c_speed_optimisation & OPT_INT_COMPARE ) {
            if (ulvalue(lval)) {
                ol("ld\ta,e");
                ol("sub\tl");
            } else {
                ol("ld\ta,e");
                ol("sub\tl");
                ol("rra");
                ol("xor\te");
                ol("xor\tl");
                ol("rlca");
                ol("ccf");
            }
            set_carry(lval);
            break;
        }
    default:
        if (ulvalue(lval)) {
            if ( IS_8080() || IS_GBZ80() ) {
                outfmt("\tld\ta,e\n");
                ol("ld\ta,l");
                ol("sub\te");
                ol("ld\ta,h");
                ol("sbc\td");
                set_carry(lval);
            } else {
                ol("and\ta");
                ol("sbc\thl,de");
                set_carry(lval);
            }
        } else {
            callrts("l_gt");
            set_int(lval);
        }
    }
}
void zgt ( LVALUE * lval ) { lval -> oldval_kind = lval -> val_type ; lval -> ptr_type = KIND_NONE ; switch ( lval -> val_type ) { case KIND_LONG : case KIND_CPTR : if ( ulvalue ( lval ) ) callrts ( " " ) ; else callrts ( " " ) ; set_int ( lval ) ; Zsp += 4 ; break ; case KIND_DOUBLE : callrts ( " " ) ; Zsp += c_fp_size ; set_int ( lval ) ; break ; case KIND_CHAR : if ( c_speed_optimisation & OPT_INT_COMPARE ) { if ( ulvalue ( lval ) ) { ol ( " \t " ) ; ol ( " \t " ) ; } else { ol ( " \t " ) ; ol ( " \t " ) ; ol ( " " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " " ) ; ol ( " " ) ; } set_carry ( lval ) ; break ; } default : if ( ulvalue ( lval ) ) { if ( IS_8080 ( ) || IS_GBZ80 ( ) ) { outfmt ( " \t \t \n " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; set_carry ( lval ) ; } else { ol ( " \t " ) ; ol ( " \t " ) ; set_carry ( lval ) ; } } else { callrts ( " " ) ; set_int ( lval ) ; } } }
Test for greater than (signed/unsigned)
Test for greater than ( signed / unsigned )
//            callrts("l_ugt");