i386-protos.h (ix86_expand_compare): Add extern decl.

* config/i386/i386-protos.h (ix86_expand_compare): Add extern decl.
	* config/i386/i386.c (ix86_expand_compare): Remove `static'.
	* config/i386/i386.md (trap, conditional_trap): New insn & expand.

From-SVN: r36019
This commit is contained in:
Greg McGary 2000-08-28 21:48:05 +00:00 committed by Greg McGary
parent 58fdec72e2
commit 9e3e266c6c
4 changed files with 57 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2000-08-28 Greg McGary <greg@mcgary.org>
* config/i386/i386-protos.h (ix86_expand_compare): Add extern decl.
* config/i386/i386.c (ix86_expand_compare): Remove `static'.
* config/i386/i386.md (trap, conditional_trap): New insn & expand.
2000-08-27 Greg McGary <greg@mcgary.org>
* cpplex.c (parse_string): Don't look for backslash

View File

@ -100,6 +100,7 @@ extern int ix86_unary_operator_ok PARAMS ((enum rtx_code, enum machine_mode,
rtx[]));
extern int ix86_match_ccmode PARAMS ((rtx, enum machine_mode));
extern rtx ix86_expand_fp_compare PARAMS ((enum rtx_code, rtx, rtx, rtx));
extern rtx ix86_expand_compare PARAMS ((enum rtx_code));
extern int ix86_use_fcomi_compare PARAMS ((enum rtx_code));
extern void ix86_expand_branch PARAMS ((enum rtx_code, rtx));
extern int ix86_expand_setcc PARAMS ((enum rtx_code, rtx));

View File

@ -402,7 +402,6 @@ static rtx ix86_expand_int_compare PARAMS ((enum rtx_code, rtx, rtx));
static enum machine_mode ix86_fp_compare_mode PARAMS ((enum rtx_code));
static enum rtx_code ix86_prepare_fp_compare_args PARAMS ((enum rtx_code,
rtx *, rtx *));
static rtx ix86_expand_compare PARAMS ((enum rtx_code));
static rtx gen_push PARAMS ((rtx));
static int memory_address_length PARAMS ((rtx addr));
static int ix86_flags_dependant PARAMS ((rtx, rtx, enum attr_type));
@ -4897,7 +4896,7 @@ ix86_expand_fp_compare (code, op0, op1, scratch)
const0_rtx);
}
static rtx
rtx
ix86_expand_compare (code)
enum rtx_code code;
{

View File

@ -11129,3 +11129,52 @@
return \"call\\t%*%1\";
}"
[(set_attr "type" "callv")])
(define_insn "trap"
[(trap_if (const_int 1) (const_int 5))]
""
"int\\t$5")
;;; ix86 doesn't have conditional trap instructions, but we fake them
;;; for the sake of bounds checking. By emitting bounds checks as
;;; conditional traps rather than as conditional jumps around
;;; unconditional traps we avoid introducing spurious basic-block
;;; boundaries and facilitate elimination of redundant checks. In
;;; honor of the too-inflexible-for-BPs `bound' instruction, we use
;;; interrupt 5.
;;;
;;; FIXME: Static branch prediction rules for ix86 are such that
;;; forward conditional branches predict as untaken. As implemented
;;; below, pseudo conditional traps violate that rule. We should use
;;; .pushsection/.popsection to place all of the `int 5's in a special
;;; section loaded at the end of the text segment and branch forward
;;; there on bounds-failure, and then jump back immediately (in case
;;; the system chooses to ignore bounds violations, or to report
;;; violations and continue execution).
(define_expand "conditional_trap"
[(trap_if (match_operator 0 "comparison_operator"
[(match_dup 2) (const_int 0)])
(match_operand 1 "const_int_operand" ""))]
""
"
{
emit_insn (gen_rtx_TRAP_IF (VOIDmode,
ix86_expand_compare (GET_CODE (operands[0])),
operands[1]));
DONE;
}")
(define_insn ""
[(trap_if (match_operator 0 "comparison_operator"
[(reg 17) (const_int 0)])
(match_operand 1 "const_int_operand" ""))]
""
"*
{
operands[2] = gen_label_rtx ();
output_asm_insn (\"j%c0\\t%l2\; int\\t%1\", operands);
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
CODE_LABEL_NUMBER (operands[2]));
RET;
}")