Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 349113
Collapse All | Expand All

(-)branches/gcc-4_5-branch/gcc/config/pa/pa.c (-33 / +73 lines)
Lines 6097-6131 Link Here
6097
}
6097
}
6098
6098
6099
/* Return TRUE if INSN, a jump insn, has an unfilled delay slot and
6099
/* Return TRUE if INSN, a jump insn, has an unfilled delay slot and
6100
   it branches to the next real instruction.  Otherwise, return FALSE.  */
6100
   it branches into the delay slot.  Otherwise, return FALSE.  */
6101
6101
6102
static bool
6102
static bool
6103
branch_to_delay_slot_p (rtx insn)
6103
branch_to_delay_slot_p (rtx insn)
6104
{
6104
{
6105
  rtx jump_insn;
6106
6105
  if (dbr_sequence_length ())
6107
  if (dbr_sequence_length ())
6106
    return FALSE;
6108
    return FALSE;
6107
6109
6108
  return next_real_insn (JUMP_LABEL (insn)) == next_real_insn (insn);
6110
  jump_insn = next_active_insn (JUMP_LABEL (insn));
6111
  while (insn)
6112
    {
6113
      insn = next_active_insn (insn);
6114
      if (jump_insn == insn)
6115
	return TRUE;
6116
6117
      /* We can't rely on the length of asms.  So, we return FALSE when
6118
	 the branch is followed by an asm.  */
6119
      if (!insn
6120
	  || GET_CODE (PATTERN (insn)) == ASM_INPUT
6121
	  || extract_asm_operands (PATTERN (insn)) != NULL_RTX
6122
	  || get_attr_length (insn) > 0)
6123
	break;
6124
    }
6125
6126
  return FALSE;
6109
}
6127
}
6110
6128
6111
/* Return TRUE if INSN, a jump insn, needs a nop in its delay slot.
6129
/* Return TRUE if INSN, a forward jump insn, needs a nop in its delay slot.
6112
6130
6113
   This occurs when INSN has an unfilled delay slot and is followed
6131
   This occurs when INSN has an unfilled delay slot and is followed
6114
   by an ASM_INPUT.  Disaster can occur if the ASM_INPUT is empty and
6132
   by an asm.  Disaster can occur if the asm is empty and the jump
6115
   the jump branches into the delay slot.  So, we add a nop in the delay
6133
   branches into the delay slot.  So, we add a nop in the delay slot
6116
   slot just to be safe.  This messes up our instruction count, but we
6134
   when this occurs.  */
6117
   don't know how big the ASM_INPUT insn is anyway.  */
6118
6135
6119
static bool
6136
static bool
6120
branch_needs_nop_p (rtx insn)
6137
branch_needs_nop_p (rtx insn)
6121
{
6138
{
6122
  rtx next_insn;
6139
  rtx jump_insn;
6123
6140
6124
  if (dbr_sequence_length ())
6141
  if (dbr_sequence_length ())
6125
    return FALSE;
6142
    return FALSE;
6126
6143
6127
  next_insn = next_real_insn (insn);
6144
  jump_insn = next_active_insn (JUMP_LABEL (insn));
6128
  return GET_CODE (PATTERN (next_insn)) == ASM_INPUT;
6145
  while (insn)
6146
    {
6147
      insn = next_active_insn (insn);
6148
      if (!insn || jump_insn == insn)
6149
	return TRUE;
6150
6151
      if (!(GET_CODE (PATTERN (insn)) == ASM_INPUT
6152
	   || extract_asm_operands (PATTERN (insn)) != NULL_RTX)
6153
	  && get_attr_length (insn) > 0)
6154
	break;
6155
    }
6156
6157
  return FALSE;
6158
}
6159
6160
/* Return TRUE if INSN, a forward jump insn, can use nullification
6161
   to skip the following instruction.  This avoids an extra cycle due
6162
   to a mis-predicted branch when we fall through.  */
6163
6164
static bool
6165
use_skip_p (rtx insn)
6166
{
6167
  rtx jump_insn = next_active_insn (JUMP_LABEL (insn));
6168
6169
  while (insn)
6170
    {
6171
      insn = next_active_insn (insn);
6172
6173
      /* We can't rely on the length of asms, so we can't skip asms.  */
6174
      if (!insn
6175
	  || GET_CODE (PATTERN (insn)) == ASM_INPUT
6176
	  || extract_asm_operands (PATTERN (insn)) != NULL_RTX)
6177
	break;
6178
      if (get_attr_length (insn) == 4
6179
	  && jump_insn == next_active_insn (insn))
6180
	return TRUE;
6181
      if (get_attr_length (insn) > 0)
6182
	break;
6183
    }
6184
6185
  return FALSE;
6129
}
6186
}
6130
6187
6131
/* This routine handles all the normal conditional branch sequences we
6188
/* This routine handles all the normal conditional branch sequences we
Lines 6139-6145 Link Here
6139
output_cbranch (rtx *operands, int negated, rtx insn)
6196
output_cbranch (rtx *operands, int negated, rtx insn)
6140
{
6197
{
6141
  static char buf[100];
6198
  static char buf[100];
6142
  int useskip = 0;
6199
  bool useskip;
6143
  int nullify = INSN_ANNULLED_BRANCH_P (insn);
6200
  int nullify = INSN_ANNULLED_BRANCH_P (insn);
6144
  int length = get_attr_length (insn);
6201
  int length = get_attr_length (insn);
6145
  int xdelay;
6202
  int xdelay;
Lines 6177-6188 Link Here
6177
  /* A forward branch over a single nullified insn can be done with a
6234
  /* A forward branch over a single nullified insn can be done with a
6178
     comclr instruction.  This avoids a single cycle penalty due to
6235
     comclr instruction.  This avoids a single cycle penalty due to
6179
     mis-predicted branch if we fall through (branch not taken).  */
6236
     mis-predicted branch if we fall through (branch not taken).  */
6180
  if (length == 4
6237
  useskip = (length == 4 && nullify) ? use_skip_p (insn) : FALSE;
6181
      && next_real_insn (insn) != 0
6182
      && get_attr_length (next_real_insn (insn)) == 4
6183
      && JUMP_LABEL (insn) == next_nonnote_insn (next_real_insn (insn))
6184
      && nullify)
6185
    useskip = 1;
6186
6238
6187
  switch (length)
6239
  switch (length)
6188
    {
6240
    {
Lines 6470-6476 Link Here
6470
output_bb (rtx *operands ATTRIBUTE_UNUSED, int negated, rtx insn, int which)
6522
output_bb (rtx *operands ATTRIBUTE_UNUSED, int negated, rtx insn, int which)
6471
{
6523
{
6472
  static char buf[100];
6524
  static char buf[100];
6473
  int useskip = 0;
6525
  bool useskip;
6474
  int nullify = INSN_ANNULLED_BRANCH_P (insn);
6526
  int nullify = INSN_ANNULLED_BRANCH_P (insn);
6475
  int length = get_attr_length (insn);
6527
  int length = get_attr_length (insn);
6476
  int xdelay;
6528
  int xdelay;
Lines 6496-6508 Link Here
6496
  /* A forward branch over a single nullified insn can be done with a
6548
  /* A forward branch over a single nullified insn can be done with a
6497
     extrs instruction.  This avoids a single cycle penalty due to
6549
     extrs instruction.  This avoids a single cycle penalty due to
6498
     mis-predicted branch if we fall through (branch not taken).  */
6550
     mis-predicted branch if we fall through (branch not taken).  */
6499
6551
  useskip = (length == 4 && nullify) ? use_skip_p (insn) : FALSE;
6500
  if (length == 4
6501
      && next_real_insn (insn) != 0
6502
      && get_attr_length (next_real_insn (insn)) == 4
6503
      && JUMP_LABEL (insn) == next_nonnote_insn (next_real_insn (insn))
6504
      && nullify)
6505
    useskip = 1;
6506
6552
6507
  switch (length)
6553
  switch (length)
6508
    {
6554
    {
Lines 6661-6667 Link Here
6661
output_bvb (rtx *operands ATTRIBUTE_UNUSED, int negated, rtx insn, int which)
6707
output_bvb (rtx *operands ATTRIBUTE_UNUSED, int negated, rtx insn, int which)
6662
{
6708
{
6663
  static char buf[100];
6709
  static char buf[100];
6664
  int useskip = 0;
6710
  bool useskip;
6665
  int nullify = INSN_ANNULLED_BRANCH_P (insn);
6711
  int nullify = INSN_ANNULLED_BRANCH_P (insn);
6666
  int length = get_attr_length (insn);
6712
  int length = get_attr_length (insn);
6667
  int xdelay;
6713
  int xdelay;
Lines 6687-6699 Link Here
6687
  /* A forward branch over a single nullified insn can be done with a
6733
  /* A forward branch over a single nullified insn can be done with a
6688
     extrs instruction.  This avoids a single cycle penalty due to
6734
     extrs instruction.  This avoids a single cycle penalty due to
6689
     mis-predicted branch if we fall through (branch not taken).  */
6735
     mis-predicted branch if we fall through (branch not taken).  */
6690
6736
  useskip = (length == 4 && nullify) ? use_skip_p (insn) : FALSE;
6691
  if (length == 4
6692
      && next_real_insn (insn) != 0
6693
      && get_attr_length (next_real_insn (insn)) == 4
6694
      && JUMP_LABEL (insn) == next_nonnote_insn (next_real_insn (insn))
6695
      && nullify)
6696
    useskip = 1;
6697
6737
6698
  switch (length)
6738
  switch (length)
6699
    {
6739
    {

Return to bug 349113