static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond,

                         TCGReg dest, TCGReg c1, TCGArg c2, int c2const)

{

    int cc;



    switch (cond) {

    case TCG_COND_GTU:

    case TCG_COND_GT:

    do_greater:

        /* The result of a compare has CC=2 for GT and CC=3 unused.

           ADD LOGICAL WITH CARRY considers (CC & 2) the carry bit.  */

        tgen_cmp(s, type, cond, c1, c2, c2const, true);

        tcg_out_movi(s, type, dest, 0);

        tcg_out_insn(s, RRE, ALCGR, dest, dest);

        return;



    case TCG_COND_GEU:

    do_geu:

        /* We need "real" carry semantics, so use SUBTRACT LOGICAL

           instead of COMPARE LOGICAL.  This needs an extra move.  */

        tcg_out_mov(s, type, TCG_TMP0, c1);

        if (c2const) {

            tcg_out_movi(s, TCG_TYPE_I64, dest, 0);

            if (type == TCG_TYPE_I32) {

                tcg_out_insn(s, RIL, SLFI, TCG_TMP0, c2);

            } else {

                tcg_out_insn(s, RIL, SLGFI, TCG_TMP0, c2);

            }

        } else {

            if (type == TCG_TYPE_I32) {

                tcg_out_insn(s, RR, SLR, TCG_TMP0, c2);

            } else {

                tcg_out_insn(s, RRE, SLGR, TCG_TMP0, c2);

            }

            tcg_out_movi(s, TCG_TYPE_I64, dest, 0);

        }

        tcg_out_insn(s, RRE, ALCGR, dest, dest);

        return;



    case TCG_COND_LEU:

    case TCG_COND_LTU:

    case TCG_COND_LT:

        /* Swap operands so that we can use GEU/GTU/GT.  */

        if (c2const) {

            tcg_out_movi(s, type, TCG_TMP0, c2);

            c2 = c1;

            c2const = 0;

            c1 = TCG_TMP0;

        } else {

            TCGReg t = c1;

            c1 = c2;

            c2 = t;

        }

        if (cond == TCG_COND_LEU) {

            goto do_geu;

        }

        cond = tcg_swap_cond(cond);

        goto do_greater;



    case TCG_COND_NE:

        /* X != 0 is X > 0.  */

        if (c2const && c2 == 0) {

            cond = TCG_COND_GTU;

            goto do_greater;

        }

        break;



    case TCG_COND_EQ:

        /* X == 0 is X <= 0 is 0 >= X.  */

        if (c2const && c2 == 0) {

            tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, 0);

            c2 = c1;

            c2const = 0;

            c1 = TCG_TMP0;

            goto do_geu;

        }

        break;



    default:

        break;

    }



    cc = tgen_cmp(s, type, cond, c1, c2, c2const, false);

    if (facilities & FACILITY_LOAD_ON_COND) {

        /* Emit: d = 0, t = 1, d = (cc ? t : d).  */

        tcg_out_movi(s, TCG_TYPE_I64, dest, 0);

        tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, 1);

        tcg_out_insn(s, RRF, LOCGR, dest, TCG_TMP0, cc);

    } else {

        /* Emit: d = 1; if (cc) goto over; d = 0; over:  */

        tcg_out_movi(s, type, dest, 1);

        tcg_out_insn(s, RI, BRC, cc, (4 + 4) >> 1);

        tcg_out_movi(s, type, dest, 0);

    }

}

static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond,

                         TCGReg dest, TCGReg c1, TCGArg c2, int c2const)

{

    int cc;



    switch (cond) {

    case TCG_COND_GTU:

    case TCG_COND_GT:

    do_greater:

        



        tgen_cmp(s, type, cond, c1, c2, c2const, true);

        tcg_out_movi(s, type, dest, 0);

        tcg_out_insn(s, RRE, ALCGR, dest, dest);

        return;



    case TCG_COND_GEU:

    do_geu:

        



        tcg_out_mov(s, type, TCG_TMP0, c1);

        if (c2const) {

            tcg_out_movi(s, TCG_TYPE_I64, dest, 0);

            if (type == TCG_TYPE_I32) {

                tcg_out_insn(s, RIL, SLFI, TCG_TMP0, c2);

            } else {

                tcg_out_insn(s, RIL, SLGFI, TCG_TMP0, c2);

            }

        } else {

            if (type == TCG_TYPE_I32) {

                tcg_out_insn(s, RR, SLR, TCG_TMP0, c2);

            } else {

                tcg_out_insn(s, RRE, SLGR, TCG_TMP0, c2);

            }

            tcg_out_movi(s, TCG_TYPE_I64, dest, 0);

        }

        tcg_out_insn(s, RRE, ALCGR, dest, dest);

        return;



    case TCG_COND_LEU:

    case TCG_COND_LTU:

    case TCG_COND_LT:

        

        if (c2const) {

            tcg_out_movi(s, type, TCG_TMP0, c2);

            c2 = c1;

            c2const = 0;

            c1 = TCG_TMP0;

        } else {

            TCGReg t = c1;

            c1 = c2;

            c2 = t;

        }

        if (cond == TCG_COND_LEU) {

            goto do_geu;

        }

        cond = tcg_swap_cond(cond);

        goto do_greater;



    case TCG_COND_NE:

        

        if (c2const && c2 == 0) {

            cond = TCG_COND_GTU;

            goto do_greater;

        }

        break;



    case TCG_COND_EQ:

        

        if (c2const && c2 == 0) {

            tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, 0);

            c2 = c1;

            c2const = 0;

            c1 = TCG_TMP0;

            goto do_geu;

        }

        break;



    default:

        break;

    }



    cc = tgen_cmp(s, type, cond, c1, c2, c2const, false);

    if (facilities & FACILITY_LOAD_ON_COND) {

        

        tcg_out_movi(s, TCG_TYPE_I64, dest, 0);

        tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, 1);

        tcg_out_insn(s, RRF, LOCGR, dest, TCG_TMP0, cc);

    } else {

        

        tcg_out_movi(s, type, dest, 1);

        tcg_out_insn(s, RI, BRC, cc, (4 + 4) >> 1);

        tcg_out_movi(s, type, dest, 0);

    }

}

static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGCond VAR_2,

                         TCGReg VAR_3, TCGReg VAR_4, TCGArg VAR_5, int VAR_6)

{

    int VAR_7;



    switch (VAR_2) {

    case TCG_COND_GTU:

    case TCG_COND_GT:

    do_greater:

        



        tgen_cmp(VAR_0, VAR_1, VAR_2, VAR_4, VAR_5, VAR_6, true);

        tcg_out_movi(VAR_0, VAR_1, VAR_3, 0);

        tcg_out_insn(VAR_0, RRE, ALCGR, VAR_3, VAR_3);

        return;



    case TCG_COND_GEU:

    do_geu:

        



        tcg_out_mov(VAR_0, VAR_1, TCG_TMP0, VAR_4);

        if (VAR_6) {

            tcg_out_movi(VAR_0, TCG_TYPE_I64, VAR_3, 0);

            if (VAR_1 == TCG_TYPE_I32) {

                tcg_out_insn(VAR_0, RIL, SLFI, TCG_TMP0, VAR_5);

            } else {

                tcg_out_insn(VAR_0, RIL, SLGFI, TCG_TMP0, VAR_5);

            }

        } else {

            if (VAR_1 == TCG_TYPE_I32) {

                tcg_out_insn(VAR_0, RR, SLR, TCG_TMP0, VAR_5);

            } else {

                tcg_out_insn(VAR_0, RRE, SLGR, TCG_TMP0, VAR_5);

            }

            tcg_out_movi(VAR_0, TCG_TYPE_I64, VAR_3, 0);

        }

        tcg_out_insn(VAR_0, RRE, ALCGR, VAR_3, VAR_3);

        return;



    case TCG_COND_LEU:

    case TCG_COND_LTU:

    case TCG_COND_LT:

        

        if (VAR_6) {

            tcg_out_movi(VAR_0, VAR_1, TCG_TMP0, VAR_5);

            VAR_5 = VAR_4;

            VAR_6 = 0;

            VAR_4 = TCG_TMP0;

        } else {

            TCGReg t = VAR_4;

            VAR_4 = VAR_5;

            VAR_5 = t;

        }

        if (VAR_2 == TCG_COND_LEU) {

            goto do_geu;

        }

        VAR_2 = tcg_swap_cond(VAR_2);

        goto do_greater;



    case TCG_COND_NE:

        

        if (VAR_6 && VAR_5 == 0) {

            VAR_2 = TCG_COND_GTU;

            goto do_greater;

        }

        break;



    case TCG_COND_EQ:

        

        if (VAR_6 && VAR_5 == 0) {

            tcg_out_movi(VAR_0, TCG_TYPE_I64, TCG_TMP0, 0);

            VAR_5 = VAR_4;

            VAR_6 = 0;

            VAR_4 = TCG_TMP0;

            goto do_geu;

        }

        break;



    default:

        break;

    }



    VAR_7 = tgen_cmp(VAR_0, VAR_1, VAR_2, VAR_4, VAR_5, VAR_6, false);

    if (facilities & FACILITY_LOAD_ON_COND) {

        

        tcg_out_movi(VAR_0, TCG_TYPE_I64, VAR_3, 0);

        tcg_out_movi(VAR_0, TCG_TYPE_I64, TCG_TMP0, 1);

        tcg_out_insn(VAR_0, RRF, LOCGR, VAR_3, TCG_TMP0, VAR_7);

    } else {

        

        tcg_out_movi(VAR_0, VAR_1, VAR_3, 1);

        tcg_out_insn(VAR_0, RI, BRC, VAR_7, (4 + 4) >> 1);

        tcg_out_movi(VAR_0, VAR_1, VAR_3, 0);

    }

}

static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGCond VAR_2,
TCGReg VAR_3, TCGReg VAR_4, TCGArg VAR_5, int VAR_6)
{ int VAR_7; switch (VAR_2) { case TCG_COND_GTU:
case TCG_COND_GT:
do_greater:
tgen_cmp(VAR_0, VAR_1, VAR_2, VAR_4, VAR_5, VAR_6, true); tcg_out_movi(VAR_0, VAR_1, VAR_3, 0); tcg_out_insn(VAR_0, RRE, ALCGR, VAR_3, VAR_3); return; case TCG_COND_GEU:
do_geu:
tcg_out_mov(VAR_0, VAR_1, TCG_TMP0, VAR_4); if (VAR_6) { tcg_out_movi(VAR_0, TCG_TYPE_I64, VAR_3, 0); if (VAR_1 == TCG_TYPE_I32) { tcg_out_insn(VAR_0, RIL, SLFI, TCG_TMP0, VAR_5); } else { tcg_out_insn(VAR_0, RIL, SLGFI, TCG_TMP0, VAR_5); } } else { if (VAR_1 == TCG_TYPE_I32) { tcg_out_insn(VAR_0, RR, SLR, TCG_TMP0, VAR_5); } else { tcg_out_insn(VAR_0, RRE, SLGR, TCG_TMP0, VAR_5); } tcg_out_movi(VAR_0, TCG_TYPE_I64, VAR_3, 0); } tcg_out_insn(VAR_0, RRE, ALCGR, VAR_3, VAR_3); return; case TCG_COND_LEU:
case TCG_COND_LTU:
case TCG_COND_LT:
if (VAR_6) { tcg_out_movi(VAR_0, VAR_1, TCG_TMP0, VAR_5); VAR_5 = VAR_4; VAR_6 = 0; VAR_4 = TCG_TMP0; } else { TCGReg t = VAR_4; VAR_4 = VAR_5; VAR_5 = t; } if (VAR_2 == TCG_COND_LEU) { goto do_geu; } VAR_2 = tcg_swap_cond(VAR_2); goto do_greater; case TCG_COND_NE:
if (VAR_6 && VAR_5 == 0) { VAR_2 = TCG_COND_GTU; goto do_greater; } break; case TCG_COND_EQ:
if (VAR_6 && VAR_5 == 0) { tcg_out_movi(VAR_0, TCG_TYPE_I64, TCG_TMP0, 0); VAR_5 = VAR_4; VAR_6 = 0; VAR_4 = TCG_TMP0; goto do_geu; } break; default:
break; } VAR_7 = tgen_cmp(VAR_0, VAR_1, VAR_2, VAR_4, VAR_5, VAR_6, false); if (facilities & FACILITY_LOAD_ON_COND) { tcg_out_movi(VAR_0, TCG_TYPE_I64, VAR_3, 0); tcg_out_movi(VAR_0, TCG_TYPE_I64, TCG_TMP0, 1); tcg_out_insn(VAR_0, RRF, LOCGR, VAR_3, TCG_TMP0, VAR_7); } else { tcg_out_movi(VAR_0, VAR_1, VAR_3, 1); tcg_out_insn(VAR_0, RI, BRC, VAR_7, (4 + 4) >> 1); tcg_out_movi(VAR_0, VAR_1, VAR_3, 0); } }