diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lra-constraints.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr55150-1.c (renamed from gcc/testsuite/gcc.dg/pr55150.c) | 0 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr55150-2.c | 53 |
5 files changed, 79 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 156d372..6782cad 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-11-01 Vladimir Makarov <vmakarov@redhat.com> + + PR middle-end/55150 + * lra-constraints.c (lra_constraints): Check only pseudos with + equivalences. Add insns with equivalence pseudos. + 2012-11-01 Sharad Singhai <singhai@google.com> PR other/55164 diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index cd0325b..afc49d7 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -3244,9 +3244,11 @@ lra_constraints (bool first_p) { bool changed_p; int i, hard_regno, new_insns_num; - unsigned int min_len, new_min_len; - rtx set, x, dest_reg; + unsigned int min_len, new_min_len, uid; + rtx set, x, reg, dest_reg; basic_block last_bb; + bitmap_head equiv_insn_bitmap; + bitmap_iterator bi; lra_constraint_iter++; if (lra_dump_file != NULL) @@ -3261,10 +3263,12 @@ lra_constraints (bool first_p) lra_risky_transformations_p = false; new_insn_uid_start = get_max_uid (); new_regno_start = first_p ? lra_constraint_new_regno_start : max_reg_num (); + bitmap_initialize (&equiv_insn_bitmap, ®_obstack); for (i = FIRST_PSEUDO_REGISTER; i < new_regno_start; i++) if (lra_reg_info[i].nrefs != 0) { ira_reg_equiv[i].profitable_p = true; + reg = regno_reg_rtx[i]; if ((hard_regno = lra_get_regno_hard_regno (i)) >= 0) { int j, nregs = hard_regno_nregs[hard_regno][PSEUDO_REGNO_MODE (i)]; @@ -3272,7 +3276,7 @@ lra_constraints (bool first_p) for (j = 0; j < nregs; j++) df_set_regs_ever_live (hard_regno + j, true); } - else if ((x = get_equiv_substitution (regno_reg_rtx[i])) != NULL_RTX) + else if ((x = get_equiv_substitution (reg)) != reg) { bool pseudo_p = contains_reg_p (x, false, false); rtx set, insn; @@ -3310,8 +3314,15 @@ lra_constraints (bool first_p) ira_reg_equiv[i].defined_p = false; if (contains_reg_p (x, false, true)) ira_reg_equiv[i].profitable_p = false; + if (get_equiv_substitution (reg) != reg) + bitmap_ior_into (&equiv_insn_bitmap, &lra_reg_info[i].insn_bitmap); } } + /* We should add all insns containing pseudos which should be + substituted by their equivalences. */ + EXECUTE_IF_SET_IN_BITMAP (&equiv_insn_bitmap, 0, uid, bi) + lra_push_insn_by_uid (uid); + bitmap_clear (&equiv_insn_bitmap); lra_eliminate (false); min_len = lra_insn_stack_length (); new_insns_num = 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 04a768c..2f63b8e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-11-01 Vladimir Makarov <vmakarov@redhat.com> + + PR middle-end/55150 + * gcc.dg/pr55150.c: Rename to gcc.dg/pr55150-1.c. + * gcc.dg/pr55150-2.c: New test. + 2012-11-01 Sharad Singhai <singhai@google.com> * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. diff --git a/gcc/testsuite/gcc.dg/pr55150.c b/gcc/testsuite/gcc.dg/pr55150-1.c index b2bf357..b2bf357 100644 --- a/gcc/testsuite/gcc.dg/pr55150.c +++ b/gcc/testsuite/gcc.dg/pr55150-1.c diff --git a/gcc/testsuite/gcc.dg/pr55150-2.c b/gcc/testsuite/gcc.dg/pr55150-2.c new file mode 100644 index 0000000..48dbb53 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr55150-2.c @@ -0,0 +1,53 @@ +/* PR middle-end/55150 */ +/* { dg-do compile } */ +/* { dg-options "-Os -g -fPIC" } */ + +typedef unsigned char DES_cblock[8]; + typedef struct DES_ks { + } + DES_key_schedule; + void DES_ede3_cbcm_encrypt (const unsigned char *in, unsigned char *out, long length, DES_key_schedule * ks1, DES_key_schedule * ks2, DES_key_schedule * ks3, DES_cblock * ivec1, DES_cblock * ivec2, int enc) { + register unsigned long tout0, tout1, xor0, xor1, m0, m1; + register long l = length; + unsigned long tin[2]; + unsigned char *iv1, *iv2; + iv1 = &(*ivec1)[0]; + iv2 = &(*ivec2)[0]; + if (enc) { + (m0 = ((unsigned long) (*((iv1)++))), m0 |= ((unsigned long) (*((iv1)++))) << 8L, m0 |= ((unsigned long) (*((iv1)++))) << 16L, m0 |= ((unsigned long) (*((iv1)++))) << 24L); + (m1 = ((unsigned long) (*((iv1)++))), m1 |= ((unsigned long) (*((iv1)++))) << 8L, m1 |= ((unsigned long) (*((iv1)++))) << 16L, m1 |= ((unsigned long) (*((iv1)++))) << 24L); + (tout0 = ((unsigned long) (*((iv2)++))), tout0 |= ((unsigned long) (*((iv2)++))) << 8L, tout0 |= ((unsigned long) (*((iv2)++))) << 16L, tout0 |= ((unsigned long) (*((iv2)++))) << 24L); + for (l -= 8; + l >= -7; + l -= 8) { + DES_encrypt1 (tin, ks3, 1); + DES_encrypt1 (tin, ks1, 1); + } + (*((iv1)++) = (unsigned char) (((m0)) & 0xff), *((iv1)++) = (unsigned char) (((m0) >> 8L) & 0xff), *((iv1)++) = (unsigned char) (((m0) >> 16L) & 0xff), *((iv1)++) = (unsigned char) (((m0) >> 24L) & 0xff)); + (*((iv1)++) = (unsigned char) (((m1)) & 0xff), *((iv1)++) = (unsigned char) (((m1) >> 8L) & 0xff), *((iv1)++) = (unsigned char) (((m1) >> 16L) & 0xff), *((iv1)++) = (unsigned char) (((m1) >> 24L) & 0xff)); + (*((iv2)++) = (unsigned char) (((tout0)) & 0xff), *((iv2)++) = (unsigned char) (((tout0) >> 8L) & 0xff), *((iv2)++) = (unsigned char) (((tout0) >> 16L) & 0xff), *((iv2)++) = (unsigned char) (((tout0) >> 24L) & 0xff)); + } + else { + (m0 = ((unsigned long) (*((iv1)++))), m0 |= ((unsigned long) (*((iv1)++))) << 8L, m0 |= ((unsigned long) (*((iv1)++))) << 16L, m0 |= ((unsigned long) (*((iv1)++))) << 24L); + (xor1 = ((unsigned long) (*((iv2)++))), xor1 |= ((unsigned long) (*((iv2)++))) << 8L, xor1 |= ((unsigned long) (*((iv2)++))) << 16L, xor1 |= ((unsigned long) (*((iv2)++))) << 24L); + for (l -= 8; + l >= -7; + l -= 8) { + DES_encrypt1 (tin, ks3, 1); + if (l < 0) { + { + switch (l + 8) { + case 7: *(--(out)) = (unsigned char) (((tout1) >> 16L) & 0xff); + case 6: *(--(out)) = (unsigned char) (((tout1) >> 8L) & 0xff); + case 5: *(--(out)) = (unsigned char) (((tout1)) & 0xff); + case 4: *(--(out)) = (unsigned char) (((tout0) >> 24L) & 0xff); + case 1: *(--(out)) = (unsigned char) (((tout0)) & 0xff); + } + }; + } + } + (*((iv1)++) = (unsigned char) (((m0)) & 0xff), *((iv1)++) = (unsigned char) (((m0) >> 8L) & 0xff), *((iv1)++) = (unsigned char) (((m0) >> 16L) & 0xff), *((iv1)++) = (unsigned char) (((m0) >> 24L) & 0xff)); + (*((iv2)++) = (unsigned char) (((xor0)) & 0xff), *((iv2)++) = (unsigned char) (((xor0) >> 8L) & 0xff), *((iv2)++) = (unsigned char) (((xor0) >> 16L) & 0xff), *((iv2)++) = (unsigned char) (((xor0) >> 24L) & 0xff)); + (*((iv2)++) = (unsigned char) (((xor1)) & 0xff), *((iv2)++) = (unsigned char) (((xor1) >> 8L) & 0xff), *((iv2)++) = (unsigned char) (((xor1) >> 16L) & 0xff), *((iv2)++) = (unsigned char) (((xor1) >> 24L) & 0xff)); + } + } |