This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
genrecog fix
- To: rth at cygnus dot com, patches at x86-64 dot org, gcc-patches at gcc dot gnu dot org
- Subject: genrecog fix
- From: Jan Hubicka <jh at suse dot cz>
- Date: Sun, 10 Dec 2000 00:32:36 +0100
Hi
Some time ago I was solving problem in the genrecog's maybe_both_true
that returned 0 for case part of match_operand was matched by hand
in another pattern due to desynchronization of the possitions in
the pattern.
This fix is not 100% right for case I made for x86_64. Here I have generic
movdi pattern like:
(set (match_operand:DI 0) (match_operand:DI 1))
x86_64 also have movabs instruction that is able to store/load to full 64
bit immediate addresses, while normal mov instructions do not. I make
addresses not encodable in the common instruction non-legitimate and use
combine to match alternate pattern as:
(set (match_operand:DI 0) (mem:DI (match_operand:DI 1 "immediate_operand" "i")))
Problem is that maybe_both_true returns 0 for these two patterns, that causes
genrecog to generate insn-attrtab that preffers the second pattern over the
first, even when after simplifying to testcase it don't work.
Problem is that code assumes the patterns to be different when falls past
the end of test sequence for one of them. This is incorrect.
Patch also removes the special case for const_int_operand in the
add_to_sequence, since it is equially well handled by the generic code bellow.
Honza
Sun Dec 10 00:27:50 MET 2000 Jan Hubicka <jh@suse.cz>
* genrecog.c (add_to_sequence): Remove special case for
const_int_operand.
(maybe_both_true): Return 1 when falling out of sequence when
trying to find common possition in the pattern.
Index: gcc/gcc/genrecog.c
===================================================================
RCS file: /home/cvs/Repository/gcc/gcc/genrecog.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 genrecog.c
*** gcc/gcc/genrecog.c 2000/11/27 18:25:42 1.2
--- gcc/gcc/genrecog.c 2000/12/09 23:18:45
*************** add_to_sequence (pattern, last, position
*** 735,748 ****
code = UNKNOWN;
}
! /* We know exactly what const_int_operand matches -- any CONST_INT. */
! if (strcmp ("const_int_operand", pred_name) == 0)
{
- code = CONST_INT;
- mode = VOIDmode;
- }
- else if (pred_name[0] != 0)
- {
test = new_decision_test (DT_pred, &place);
test->u.pred.name = pred_name;
test->u.pred.mode = mode;
--- 735,742 ----
code = UNKNOWN;
}
! if (pred_name[0] != 0)
{
test = new_decision_test (DT_pred, &place);
test->u.pred.name = pred_name;
test->u.pred.mode = mode;
*************** maybe_both_true (d1, d2, toplevel)
*** 1115,1121 ****
p1 = d1, d1 = d2, d2 = p1;
if (d1->success.first == 0)
! return 0;
for (p1 = d1->success.first; p1; p1 = p1->next)
if (maybe_both_true (p1, d2, 0))
return 1;
--- 1109,1115 ----
p1 = d1, d1 = d2, d2 = p1;
if (d1->success.first == 0)
! return 1;
for (p1 = d1->success.first; p1; p1 = p1->next)
if (maybe_both_true (p1, d2, 0))
return 1;