diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 1210613b7d9..443019cf32c 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2004-05-28 Bryce McKinlay + + * jcf-write.c (generate_bytecode_conditional): Handle binops UNLT_EXPR, UNLE_EXPR, + UNGT_EXPR, UNGE_EXPR, UNEQ_EXPR, and LTGT_EXPR. + (generate_bytecode_insns): Likewise. + 2004-05-28 Bryce McKinlay * check-init.c (check_init): Handle binops UNLT_EXPR, UNLE_EXPR, diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index c715a2c1ed8..5aa6d5ae4e6 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -1093,6 +1093,8 @@ generate_bytecode_conditional (tree exp, tree exp0, exp1, type; int save_SP = state->code_SP; enum java_opcode op, negop; + bool unordered = 0; + switch (TREE_CODE (exp)) { case INTEGER_CST: @@ -1164,25 +1166,52 @@ generate_bytecode_conditional (tree exp, emit_goto (false_label, state); } break; + + case UNEQ_EXPR: + unordered = 1; case EQ_EXPR: op = OPCODE_if_icmpeq; goto compare; + + case LTGT_EXPR: + unordered = 1; case NE_EXPR: op = OPCODE_if_icmpne; goto compare; + + case UNLT_EXPR: + unordered = 1; case GT_EXPR: op = OPCODE_if_icmpgt; goto compare; + + case UNGT_EXPR: + unordered = 1; case LT_EXPR: op = OPCODE_if_icmplt; goto compare; + + case UNLE_EXPR: + unordered = 1; case GE_EXPR: op = OPCODE_if_icmpge; goto compare; + + case UNGE_EXPR: + unordered = 1; case LE_EXPR: op = OPCODE_if_icmple; goto compare; + compare: + if (unordered) + { + struct jcf_block *tmp = true_label; + true_label = false_label; + false_label = tmp; + true_branch_first = !true_branch_first; + } + exp0 = TREE_OPERAND (exp, 0); exp1 = TREE_OPERAND (exp, 1); type = TREE_TYPE (exp0); @@ -1549,6 +1578,12 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state) case LT_EXPR: case GE_EXPR: case LE_EXPR: + case UNLT_EXPR: + case UNLE_EXPR: + case UNGT_EXPR: + case UNGE_EXPR: + case UNEQ_EXPR: + case LTGT_EXPR: { struct jcf_block *then_label = gen_jcf_label (state); struct jcf_block *else_label = gen_jcf_label (state);