* stmt.c (emit_case_nodes): Convert modes properly in low+high test.
authorRichard Henderson <rth@redhat.com>
Sun, 8 Jul 2001 16:03:26 +0000 (09:03 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 8 Jul 2001 16:03:26 +0000 (09:03 -0700)
From-SVN: r43847

gcc/ChangeLog
gcc/stmt.c

index 8e500841a66005b5d2936be2631ddb77cd4b2b2d..d0929d8fc97fd865c90d1e05b38562b8b79849b3 100644 (file)
@@ -1,3 +1,7 @@
+2001-07-08  Richard Henderson  <rth@redhat.com>
+
+       * stmt.c (emit_case_nodes): Convert modes properly in low+high test.
+
 2001-07-08  Richard Henderson  <rth@redhat.com>
 
        * config/i386/i386.md: Remove constraints strings from define_split
index ee4523c33c50e19a82a0b991769ff7d4b9b6e12f..48b3a87cc66c42601224ec5b63d23ecd96c0e0f7 100644 (file)
@@ -6321,19 +6321,24 @@ emit_case_nodes (index, node, default_label, index_type)
            }
          else if (!low_bound && !high_bound)
            {
-             /* Instead of doing two branches emit test (index-low) <= (high-low).  */
+             /* Instead of doing two branches, emit
+                (index-low) <= (high-low).  */
              tree new_bound = fold (build (MINUS_EXPR, index_type, node->high,
                                            node->low));
              rtx new_index;
              
              new_index = expand_binop (mode, sub_optab, index,
-                                       expand_expr (node->low, NULL_RTX,
-                                                    VOIDmode, 0),
-                                       NULL_RTX, 0, OPTAB_WIDEN);
+                                       convert_modes (mode, imode,
+                                         expand_expr (node->low, NULL_RTX,
+                                                      mode, 0),
+                                         unsignedp),
+                                       NULL_RTX, unsignedp, OPTAB_WIDEN);
                                
              emit_cmp_and_jump_insns (new_index,
-                                      expand_expr (new_bound, NULL_RTX,
-                                                   VOIDmode, 0),
+                                      convert_modes (mode, imode,
+                                        expand_expr (new_bound, NULL_RTX,
+                                                     mode, 0),
+                                        unsignedp),
                                       GT, NULL_RTX, mode, 1, 0,
                                       default_label);
            }