aboutsummaryrefslogtreecommitdiffstats
path: root/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106860.patch
blob: 895d6a6cfffd7299ce5f2337bd1db16c8974ffd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
2012-01-12  Ulrich Weigand  <ulrich.weigand@linaro.org>

	LP 879725
	Backport from mainline:

	2012-01-02  Revital Eres  <revital.eres@linaro.org>

	gcc/
	* ddg.c (def_has_ccmode_p): New function.
	(add_cross_iteration_register_deps,
	create_ddg_dep_from_intra_loop_link): Call it.

	gcc/testsuite/
	* gcc.dg/sms-11.c: New file.

=== modified file 'gcc/ddg.c'
--- old/gcc/ddg.c	2011-10-02 06:56:53 +0000
+++ new/gcc/ddg.c	2012-01-10 16:05:14 +0000
@@ -166,6 +166,24 @@
   return false;
 }
 
+/* Return true if one of the definitions in INSN has MODE_CC.  Otherwise
+   return false.  */
+static bool
+def_has_ccmode_p (rtx insn)
+{
+  df_ref *def;
+
+  for (def = DF_INSN_DEFS (insn); *def; def++)
+    {
+      enum machine_mode mode = GET_MODE (DF_REF_REG (*def));
+
+      if (GET_MODE_CLASS (mode) == MODE_CC)
+	return true;
+    }
+
+  return false;
+}
+
 /* Computes the dependence parameters (latency, distance etc.), creates
    a ddg_edge and adds it to the given DDG.  */
 static void
@@ -202,6 +220,7 @@
      whose register has multiple defs in the loop.  */
   if (flag_modulo_sched_allow_regmoves 
       && (t == ANTI_DEP && dt == REG_DEP)
+      && !def_has_ccmode_p (dest_node->insn)
       && !autoinc_var_is_used_p (dest_node->insn, src_node->insn))
     {
       rtx set;
@@ -335,7 +354,8 @@
           if (DF_REF_ID (last_def) != DF_REF_ID (first_def)
               || !flag_modulo_sched_allow_regmoves
 	      || JUMP_P (use_node->insn)
-              || autoinc_var_is_used_p (DF_REF_INSN (last_def), use_insn))
+              || autoinc_var_is_used_p (DF_REF_INSN (last_def), use_insn)
+	      || def_has_ccmode_p (DF_REF_INSN (last_def)))
             create_ddg_dep_no_link (g, use_node, first_def_node, ANTI_DEP,
                                     REG_DEP, 1);
 

=== added file 'gcc/testsuite/gcc.dg/sms-11.c'
--- old/gcc/testsuite/gcc.dg/sms-11.c	1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.dg/sms-11.c	2012-01-10 16:05:14 +0000
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */
+
+extern void abort (void);
+
+float out[4][4] = { 6, 6, 7, 5, 6, 7, 5, 5, 6, 4, 4, 4, 6, 2, 3, 4 };
+
+void
+invert (void)
+{
+  int i, j, k = 0, swap;
+  float tmp[4][4] = { 5, 6, 7, 5, 6, 7, 5, 5, 4, 4, 4, 4, 3, 2, 3, 4 };
+
+  for (i = 0; i < 4; i++)
+    {
+      for (j = i + 1; j < 4; j++)
+	if (tmp[j][i] > tmp[i][i])
+	  swap = j;
+
+      if (swap != i)
+	tmp[i][k] = tmp[swap][k];
+    }
+
+  for (i = 0; i < 4; i++)
+    for (j = 0; j < 4; j++)
+      if (tmp[i][j] != out[i][j])
+	abort ();
+}
+
+int
+main ()
+{
+  invert ();
+  return 0;
+}
+
+/* { dg-final { cleanup-rtl-dump "sms" } } */