* Some backports from mainline to gcc 4.4 branch
@ 2011-05-04 9:27 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2011-05-04 9:27 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 137 bytes --]
Hi!
And here are 3 backports to 4.4 branch, bootstrapped/regtested on
x86_64-linux and i686-linux, committed to gcc-4_4-branch.
Jakub
[-- Attachment #2: r173301 --]
[-- Type: text/plain, Size: 1759 bytes --]
2011-05-04 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2011-05-03 Uros Bizjak <ubizjak@gmail.com>
Jakub Jelinek <jakub@redhat.com>
PR target/48774
* config/i386/i386.c (ix86_match_ccmode): For CC{A,C,O,S}mode
only succeed if req_mode is the same as set_mode.
* gcc.dg/pr48774.c: New test.
--- gcc/config/i386/i386.c (revision 173300)
+++ gcc/config/i386/i386.c (revision 173301)
@@ -17299,11 +17299,15 @@ ix86_match_ccmode (rtx insn, enum machin
if (req_mode == CCZmode)
return 0;
/* FALLTHRU */
+ case CCZmode:
+ break;
+
case CCAmode:
case CCCmode:
case CCOmode:
case CCSmode:
- case CCZmode:
+ if (set_mode != req_mode)
+ return 0;
break;
default:
--- gcc/testsuite/gcc.dg/pr48774.c (revision 0)
+++ gcc/testsuite/gcc.dg/pr48774.c (revision 173301)
@@ -0,0 +1,38 @@
+/* PR target/48774 */
+/* { dg-do run } */
+/* { dg-options "-O2 -funroll-loops" } */
+
+extern void abort (void);
+unsigned long int s[24]
+ = { 12, ~1, 12, ~2, 12, ~4, 12, ~8, 12, ~16, 12, ~32,
+ 12, ~64, 12, ~128, 12, ~256, 12, ~512, 12, ~1024, 12, ~2048 };
+struct { int n; unsigned long *e[12]; } g
+ = { 12, { &s[0], &s[2], &s[4], &s[6], &s[8], &s[10], &s[12], &s[14],
+ &s[16], &s[18], &s[20], &s[22] } };
+int c[12];
+
+__attribute__((noinline)) void
+foo (void)
+{
+ int i, j;
+ for (i = 0; i < g.n; i++)
+ for (j = 0; j < g.n; j++)
+ {
+ if (i == j && j < g.e[0][0] && (g.e[i][1] & (1UL << j)))
+ abort ();
+ if (j < g.e[0][0] && (g.e[i][1] & (1UL << j)))
+ c[i]++;
+ }
+}
+
+int
+main ()
+{
+ int i;
+ asm volatile ("" : "+m" (s), "+m" (g), "+m" (c));
+ foo ();
+ for (i = 0; i < 12; i++)
+ if (c[i] != 11)
+ abort ();
+ return 0;
+}
[-- Attachment #3: r173207 --]
[-- Type: text/plain, Size: 5720 bytes --]
2011-05-04 Jakub Jelinek <jakub@redhat.com>
Backport from mainline
2011-04-30 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/48809
* tree-switch-conversion.c (build_arrays): Compute tidx in unsigned
type.
(gen_inbound_check): Don't compute index_expr - range_min in utype
again, instead reuse SSA_NAME initialized in build_arrays.
Remove two useless gsi_for_stmt calls.
* gcc.c-torture/execute/pr48809.c: New test.
--- gcc/tree-switch-conversion.c (revision 173206)
+++ gcc/tree-switch-conversion.c (revision 173207)
@@ -519,7 +519,7 @@ static void
build_arrays (gimple swtch)
{
tree arr_index_type;
- tree tidx, sub;
+ tree tidx, sub, utype;
gimple stmt;
gimple_stmt_iterator gsi;
int i;
@@ -527,12 +527,20 @@ build_arrays (gimple swtch)
gsi = gsi_for_stmt (swtch);
arr_index_type = build_index_type (info.range_size);
- tidx = make_rename_temp (arr_index_type, "csti");
- sub = fold_build2 (MINUS_EXPR, TREE_TYPE (info.index_expr), info.index_expr,
- fold_convert (TREE_TYPE (info.index_expr),
- info.range_min));
- sub = force_gimple_operand_gsi (&gsi, fold_convert (arr_index_type, sub),
- false, NULL, true, GSI_SAME_STMT);
+
+ /* Make sure we do not generate arithmetics in a subrange. */
+ if (TREE_TYPE (TREE_TYPE (info.index_expr)))
+ utype = lang_hooks.types.type_for_mode
+ (TYPE_MODE (TREE_TYPE (TREE_TYPE (info.index_expr))), 1);
+ else
+ utype = lang_hooks.types.type_for_mode
+ (TYPE_MODE (TREE_TYPE (info.index_expr)), 1);
+
+ tidx = make_rename_temp (utype, "csui");
+ sub = fold_build2 (MINUS_EXPR, utype,
+ fold_convert (utype, info.index_expr),
+ fold_convert (utype, info.range_min));
+ sub = force_gimple_operand_gsi (&gsi, sub, false, NULL, true, GSI_SAME_STMT);
stmt = gimple_build_assign (tidx, sub);
gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
@@ -641,10 +649,7 @@ gen_inbound_check (gimple swtch)
gimple label1, label2, label3;
tree utype;
- tree tmp_u;
- tree cast;
- gimple cast_assign, minus_assign;
- tree ulb, minus;
+ tree tidx;
tree bound;
gimple cond_stmt;
@@ -657,49 +662,27 @@ gen_inbound_check (gimple swtch)
gcc_assert (info.default_values);
bb0 = gimple_bb (swtch);
- /* Make sure we do not generate arithmetics in a subrange. */
- if (TREE_TYPE (TREE_TYPE (info.index_expr)))
- utype = lang_hooks.types.type_for_mode
- (TYPE_MODE (TREE_TYPE (TREE_TYPE (info.index_expr))), 1);
- else
- utype = lang_hooks.types.type_for_mode
- (TYPE_MODE (TREE_TYPE (info.index_expr)), 1);
+ tidx = gimple_assign_lhs (info.arr_ref_first);
+ utype = TREE_TYPE (tidx);
/* (end of) block 0 */
gsi = gsi_for_stmt (info.arr_ref_first);
- tmp_u = make_rename_temp (utype, "csui");
-
- cast = fold_convert (utype, info.index_expr);
- cast_assign = gimple_build_assign (tmp_u, cast);
- find_new_referenced_vars (cast_assign);
- gsi_insert_before (&gsi, cast_assign, GSI_SAME_STMT);
- mark_symbols_for_renaming (cast_assign);
-
- ulb = fold_convert (utype, info.range_min);
- minus = fold_build2 (MINUS_EXPR, utype, tmp_u, ulb);
- minus = force_gimple_operand_gsi (&gsi, minus, false, NULL, true,
- GSI_SAME_STMT);
- minus_assign = gimple_build_assign (tmp_u, minus);
- find_new_referenced_vars (minus_assign);
- gsi_insert_before (&gsi, minus_assign, GSI_SAME_STMT);
- mark_symbols_for_renaming (minus_assign);
+ gsi_next (&gsi);
bound = fold_convert (utype, info.range_size);
- cond_stmt = gimple_build_cond (LE_EXPR, tmp_u, bound, NULL_TREE, NULL_TREE);
+ cond_stmt = gimple_build_cond (LE_EXPR, tidx, bound, NULL_TREE, NULL_TREE);
find_new_referenced_vars (cond_stmt);
gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
mark_symbols_for_renaming (cond_stmt);
/* block 2 */
- gsi = gsi_for_stmt (info.arr_ref_first);
label2 = gimple_build_label (label_decl2);
gsi_insert_before (&gsi, label2, GSI_SAME_STMT);
last_assign = gen_def_assigns (&gsi);
/* block 1 */
- gsi = gsi_for_stmt (info.arr_ref_first);
label1 = gimple_build_label (label_decl1);
gsi_insert_before (&gsi, label1, GSI_SAME_STMT);
--- gcc/testsuite/gcc.c-torture/execute/pr48809.c (revision 0)
+++ gcc/testsuite/gcc.c-torture/execute/pr48809.c (revision 173207)
@@ -0,0 +1,60 @@
+/* PR tree-optimization/48809 */
+
+extern void abort (void);
+
+int
+foo (signed char x)
+{
+ int y = 0;
+ switch (x)
+ {
+ case 0: y = 1; break;
+ case 1: y = 7; break;
+ case 2: y = 2; break;
+ case 3: y = 19; break;
+ case 4: y = 5; break;
+ case 5: y = 17; break;
+ case 6: y = 31; break;
+ case 7: y = 8; break;
+ case 8: y = 28; break;
+ case 9: y = 16; break;
+ case 10: y = 31; break;
+ case 11: y = 12; break;
+ case 12: y = 15; break;
+ case 13: y = 111; break;
+ case 14: y = 17; break;
+ case 15: y = 10; break;
+ case 16: y = 31; break;
+ case 17: y = 7; break;
+ case 18: y = 2; break;
+ case 19: y = 19; break;
+ case 20: y = 5; break;
+ case 21: y = 107; break;
+ case 22: y = 31; break;
+ case 23: y = 8; break;
+ case 24: y = 28; break;
+ case 25: y = 106; break;
+ case 26: y = 31; break;
+ case 27: y = 102; break;
+ case 28: y = 105; break;
+ case 29: y = 111; break;
+ case 30: y = 17; break;
+ case 31: y = 10; break;
+ case 32: y = 31; break;
+ case 98: y = 18; break;
+ case -62: y = 19; break;
+ }
+ return y;
+}
+
+int
+main ()
+{
+ if (foo (98) != 18 || foo (97) != 0 || foo (99) != 0)
+ abort ();
+ if (foo (-62) != 19 || foo (-63) != 0 || foo (-61) != 0)
+ abort ();
+ if (foo (28) != 105 || foo (27) != 102 || foo (29) != 111)
+ abort ();
+ return 0;
+}
[-- Attachment #4: r173120 --]
[-- Type: text/plain, Size: 693 bytes --]
2011-05-04 Jakub Jelinek <jakub@redhat.com>
Backport from mainline
2011-04-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/48597
* final.c (final_scan_insn): Call dwarf2out_frame_debug even for
inline asm.
--- gcc/final.c (revision 173119)
+++ gcc/final.c (revision 173120)
@@ -2313,6 +2313,11 @@ final_scan_insn (rtx insn, FILE *file, i
location_t loc;
expanded_location expanded;
+ /* Make sure we flush any queued register saves in case this
+ clobbers affected registers. */
+ if (dwarf2out_do_frame ())
+ dwarf2out_frame_debug (insn, false);
+
/* There's no telling what that did to the condition codes. */
CC_STATUS_INIT;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-05-04 9:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04 9:27 Some backports from mainline to gcc 4.4 branch Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).