This is the mail archive of the
mailing list for the GCC project.
Re: PATCH: conditional traps for MIPS
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: PATCH: conditional traps for MIPS
- From: Greg McGary <greg at mcgary dot org>
- Date: 05 Sep 2000 03:16:42 -0700
- Cc: geoffk at cygnus dot com
- References: <200009051005.DAA02732@kayak.mcgary.org>
Greg McGary <email@example.com> 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