summaryrefslogtreecommitdiffstats
path: root/toolchain/gcc/ext_source/Atmel/avr32/4.2.2-avr32-2.1.5/904-avr32-fix-conditional-insn-which-clobbers-cc_status.patch
blob: 539c666d2b28e9102a6ed754d2f9cb17d694e1c6 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Index: gcc-4.2.2/gcc/config/avr32/avr32.c
===================================================================
--- gcc-4.2.2.orig/gcc/config/avr32/avr32.c	2008-09-19 14:29:20.000000000 +0200
+++ gcc-4.2.2/gcc/config/avr32/avr32.c	2008-09-19 14:30:02.000000000 +0200
@@ -1788,7 +1788,7 @@
     {
       if (TREE_CODE (*node) != FUNCTION_DECL)
 	{
-	  warning ("`%s' attribute only applies to functions",
+	  warning (OPT_Wattributes,"`%s' attribute only applies to functions",
 		   IDENTIFIER_POINTER (name));
 	  *no_add_attrs = true;
 	}
@@ -1802,7 +1802,7 @@
 	{
 	  if (avr32_isr_value (args) == AVR32_FT_UNKNOWN)
 	    {
-	      warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+	      warning (OPT_Wattributes,"`%s' attribute ignored", IDENTIFIER_POINTER (name));
 	      *no_add_attrs = true;
 	    }
 	}
@@ -1829,7 +1829,7 @@
 	    }
 	  else
 	    {
-	      warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+	      warning (OPT_Wattributes,"`%s' attribute ignored", IDENTIFIER_POINTER (name));
 	    }
 	}
     }
@@ -1847,7 +1847,7 @@
 {
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
-      warning ("%qs attribute only applies to functions",
+      warning (OPT_Wattributes,"%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
@@ -1866,13 +1866,13 @@
 {
   if (TREE_CODE (*node) == FUNCTION_TYPE || TREE_CODE (*node) == METHOD_TYPE)
     {
-      warning ("`%s' attribute not yet supported...",
+      warning (OPT_Wattributes,"`%s' attribute not yet supported...",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
       return NULL_TREE;
     }
 
-  warning ("`%s' attribute only applies to functions",
+  warning (OPT_Wattributes,"`%s' attribute only applies to functions",
 	   IDENTIFIER_POINTER (name));
   *no_add_attrs = true;
   return NULL_TREE;
@@ -4215,51 +4215,6 @@
 
 
 void
-avr32_asm_output_ascii (FILE * stream, char *ptr, int len)
-{
-  int i, i_new = 0;
-  char *new_ptr = xmalloc (4 * len);
-  if (new_ptr == NULL)
-    internal_error ("Out of memory.");
-
-  for (i = 0; i < len; i++)
-    {
-      if (ptr[i] == '\n')
-	{
-	  new_ptr[i_new++] = '\\';
-	  new_ptr[i_new++] = '0';
-	  new_ptr[i_new++] = '1';
-	  new_ptr[i_new++] = '2';
-	}
-      else if (ptr[i] == '\"')
-	{
-	  new_ptr[i_new++] = '\\';
-	  new_ptr[i_new++] = '\"';
-	}
-      else if (ptr[i] == '\\')
-	{
-	  new_ptr[i_new++] = '\\';
-	  new_ptr[i_new++] = '\\';
-	}
-      else if (ptr[i] == '\0' && i + 1 < len)
-	{
-	  new_ptr[i_new++] = '\\';
-	  new_ptr[i_new++] = '0';
-	}
-      else
-	{
-	  new_ptr[i_new++] = ptr[i];
-	}
-    }
-
-  /* Terminate new_ptr. */
-  new_ptr[i_new] = '\0';
-  fprintf (stream, "\t.ascii\t\"%s\"\n", new_ptr);
-  free (new_ptr);
-}
-
-
-void
 avr32_asm_output_label (FILE * stream, const char *name)
 {
   name = avr32_strip_name_encoding (name);
@@ -4444,12 +4399,15 @@
         rtx cmp;
         rtx cmp_op0, cmp_op1;
         rtx cond;
+        rtx dest;
+
         if ( GET_CODE (exp) == COND_EXEC )
           {
             cmp_op0 = XEXP (COND_EXEC_TEST (exp), 0);
             cmp_op1 = XEXP (COND_EXEC_TEST (exp), 1);
             cond = COND_EXEC_TEST (exp);
-          } 
+            dest = SET_DEST (COND_EXEC_CODE (exp));
+          }
         else
           {
             /* If then else conditional. compare operands are in operands
@@ -4457,6 +4415,7 @@
             cmp_op0 = recog_data.operand[4];
             cmp_op1 = recog_data.operand[5];
             cond = recog_data.operand[1];
+            dest = SET_DEST (exp);
           }
 
         if ( GET_CODE (cmp_op0) == AND )
@@ -4466,7 +4425,15 @@
                                  cmp_op0,
                                  cmp_op1);
         
-	if (is_compare_redundant (cmp, cond) == NULL_RTX)
+        /* Check if the conditional insns updates a register present
+           in the comparison, if so then we must reset the cc_status. */
+        if (REG_P (dest)
+            && (reg_mentioned_p (dest, cmp_op0)
+                || reg_mentioned_p (dest, cmp_op1)))
+          {
+            CC_STATUS_INIT;
+          }
+	else if (is_compare_redundant (cmp, cond) == NULL_RTX)
 	  {
 	    /* Reset the nonstandard flag */
 	    CC_STATUS_INIT;