904-avr32-fix-conditional-insn-which-clobbers-cc_status.patch 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. Index: gcc-4.2.2/gcc/config/avr32/avr32.c
  2. ===================================================================
  3. --- gcc-4.2.2.orig/gcc/config/avr32/avr32.c 2008-09-19 14:29:20.000000000 +0200
  4. +++ gcc-4.2.2/gcc/config/avr32/avr32.c 2008-09-19 14:30:02.000000000 +0200
  5. @@ -1788,7 +1788,7 @@
  6. {
  7. if (TREE_CODE (*node) != FUNCTION_DECL)
  8. {
  9. - warning ("`%s' attribute only applies to functions",
  10. + warning (OPT_Wattributes,"`%s' attribute only applies to functions",
  11. IDENTIFIER_POINTER (name));
  12. *no_add_attrs = true;
  13. }
  14. @@ -1802,7 +1802,7 @@
  15. {
  16. if (avr32_isr_value (args) == AVR32_FT_UNKNOWN)
  17. {
  18. - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
  19. + warning (OPT_Wattributes,"`%s' attribute ignored", IDENTIFIER_POINTER (name));
  20. *no_add_attrs = true;
  21. }
  22. }
  23. @@ -1829,7 +1829,7 @@
  24. }
  25. else
  26. {
  27. - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
  28. + warning (OPT_Wattributes,"`%s' attribute ignored", IDENTIFIER_POINTER (name));
  29. }
  30. }
  31. }
  32. @@ -1847,7 +1847,7 @@
  33. {
  34. if (TREE_CODE (*node) != FUNCTION_DECL)
  35. {
  36. - warning ("%qs attribute only applies to functions",
  37. + warning (OPT_Wattributes,"%qs attribute only applies to functions",
  38. IDENTIFIER_POINTER (name));
  39. *no_add_attrs = true;
  40. }
  41. @@ -1866,13 +1866,13 @@
  42. {
  43. if (TREE_CODE (*node) == FUNCTION_TYPE || TREE_CODE (*node) == METHOD_TYPE)
  44. {
  45. - warning ("`%s' attribute not yet supported...",
  46. + warning (OPT_Wattributes,"`%s' attribute not yet supported...",
  47. IDENTIFIER_POINTER (name));
  48. *no_add_attrs = true;
  49. return NULL_TREE;
  50. }
  51. - warning ("`%s' attribute only applies to functions",
  52. + warning (OPT_Wattributes,"`%s' attribute only applies to functions",
  53. IDENTIFIER_POINTER (name));
  54. *no_add_attrs = true;
  55. return NULL_TREE;
  56. @@ -4215,51 +4215,6 @@
  57. void
  58. -avr32_asm_output_ascii (FILE * stream, char *ptr, int len)
  59. -{
  60. - int i, i_new = 0;
  61. - char *new_ptr = xmalloc (4 * len);
  62. - if (new_ptr == NULL)
  63. - internal_error ("Out of memory.");
  64. -
  65. - for (i = 0; i < len; i++)
  66. - {
  67. - if (ptr[i] == '\n')
  68. - {
  69. - new_ptr[i_new++] = '\\';
  70. - new_ptr[i_new++] = '0';
  71. - new_ptr[i_new++] = '1';
  72. - new_ptr[i_new++] = '2';
  73. - }
  74. - else if (ptr[i] == '\"')
  75. - {
  76. - new_ptr[i_new++] = '\\';
  77. - new_ptr[i_new++] = '\"';
  78. - }
  79. - else if (ptr[i] == '\\')
  80. - {
  81. - new_ptr[i_new++] = '\\';
  82. - new_ptr[i_new++] = '\\';
  83. - }
  84. - else if (ptr[i] == '\0' && i + 1 < len)
  85. - {
  86. - new_ptr[i_new++] = '\\';
  87. - new_ptr[i_new++] = '0';
  88. - }
  89. - else
  90. - {
  91. - new_ptr[i_new++] = ptr[i];
  92. - }
  93. - }
  94. -
  95. - /* Terminate new_ptr. */
  96. - new_ptr[i_new] = '\0';
  97. - fprintf (stream, "\t.ascii\t\"%s\"\n", new_ptr);
  98. - free (new_ptr);
  99. -}
  100. -
  101. -
  102. -void
  103. avr32_asm_output_label (FILE * stream, const char *name)
  104. {
  105. name = avr32_strip_name_encoding (name);
  106. @@ -4444,12 +4399,15 @@
  107. rtx cmp;
  108. rtx cmp_op0, cmp_op1;
  109. rtx cond;
  110. + rtx dest;
  111. +
  112. if ( GET_CODE (exp) == COND_EXEC )
  113. {
  114. cmp_op0 = XEXP (COND_EXEC_TEST (exp), 0);
  115. cmp_op1 = XEXP (COND_EXEC_TEST (exp), 1);
  116. cond = COND_EXEC_TEST (exp);
  117. - }
  118. + dest = SET_DEST (COND_EXEC_CODE (exp));
  119. + }
  120. else
  121. {
  122. /* If then else conditional. compare operands are in operands
  123. @@ -4457,6 +4415,7 @@
  124. cmp_op0 = recog_data.operand[4];
  125. cmp_op1 = recog_data.operand[5];
  126. cond = recog_data.operand[1];
  127. + dest = SET_DEST (exp);
  128. }
  129. if ( GET_CODE (cmp_op0) == AND )
  130. @@ -4466,7 +4425,15 @@
  131. cmp_op0,
  132. cmp_op1);
  133. - if (is_compare_redundant (cmp, cond) == NULL_RTX)
  134. + /* Check if the conditional insns updates a register present
  135. + in the comparison, if so then we must reset the cc_status. */
  136. + if (REG_P (dest)
  137. + && (reg_mentioned_p (dest, cmp_op0)
  138. + || reg_mentioned_p (dest, cmp_op1)))
  139. + {
  140. + CC_STATUS_INIT;
  141. + }
  142. + else if (is_compare_redundant (cmp, cond) == NULL_RTX)
  143. {
  144. /* Reset the nonstandard flag */
  145. CC_STATUS_INIT;