This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: conditional traps for MIPS

Greg McGary <> writes:

> In particular, I am displeased by some manipulations of the code.  For
> example, consider this statement:
>     if (x < 10)
>       __builtin_trap ();
> MIPS conditional trap machine instructions don't directly handle
> the conditional operators LE and GT, so the operands must be swapped
> and the operators converted to GE and LT respectively.
> The above statement seems tailor-made for a conditional-trap LT
> with immediate operand 10.  However, the loop-opt pass converts
> constant 10 to 9, swaps the operands and changes the op to GE
> (I'll investigate tomorrow).  Now, stupid mips_gen_conditional_trap
> fixes-up by forcing 9 into a register and we do a register-register
> GE conditional trap rather than the more compact register-immediate
> LT conditional trap.

I understand what's happening: gcc starts out by generating a
conditional branch around an unconditional `trap_if', and the
branch-around condition is (x >= 9).

I guess mips_gen_conditional_trap just needs to be smarter and invert
it back to (x < 10) for embedding into the conditional-trap


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]