jcf-write.c (generate_bytecode_conditional): Handle binops UNLT_EXPR, UNLE_EXPR,...
authorBryce McKinlay <mckinlay@redhat.com>
Fri, 28 May 2004 23:59:49 +0000 (23:59 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Fri, 28 May 2004 23:59:49 +0000 (00:59 +0100)
* 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.

From-SVN: r82402

gcc/java/ChangeLog
gcc/java/jcf-write.c

index 1210613b7d93d3082ffe74f1f0c4a8d04d0ef7b2..443019cf32cf4a45ddaca8e7cdb9435e8d90a6c0 100644 (file)
@@ -1,3 +1,9 @@
+2004-05-28  Bryce McKinlay  <mckinlay@redhat.com>
+
+       * 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  <mckinlay@redhat.com>
 
        * check-init.c (check_init): Handle binops UNLT_EXPR, UNLE_EXPR,
index c715a2c1ed827bb248ce308af6873c8ab7ab2001..5aa6d5ae4e6cbf0a0196509d7a6fbf46e88dd5e3 100644 (file)
@@ -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);