This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix two testsuite failures on k6-pc-linux-gnu


Hello,

The two following tests fail on k6-pc-linux-gnu:
FAIL: gcc.c-torture/execute/dbra-1.c execution,  -O3 -fomit-frame-pointer
FAIL: gcc.c-torture/execute/dbra-1.c execution,  -O3 -g

See for example:
http://gcc.gnu.org/ml/gcc-testresults/2002-06/msg00771.html

However, the two failures have nothing to do with the 'dbra' transformation
of the loop optimizer: they are triggered by the mishandling of short
branches on i386. Namely, gcc produces a short branch instruction ('loop')
to a label which is out of the range of the instruction.

The problem originates in the following patch:


Tue Jun  6 16:57:30 CEST 2000  Jan Hubicka  <jh@suse.cz>

 * genattrtab.c (write_attr_value): Do not abort for CONST_INT operands.
 * i386.c (ix86_attr_length_default): Kill.
 (ix86_attr_length_immediate_default, ix86_attr_length_address_default):
 New.
 * i386-protos.h (ix86_attr_length_default): Kill
 (ix86_attr_length_immediate_default, ix86_attr_length_address_default):
 Add prototype
 * i386.md (attribute type): Add "test".
 (attribute length_prefix): Kill.
 (attribute length_opcode): Kill.
 (attribute i387, mode, length_immediate, length_address, prefix_data16,
 prefix_rep, prefix_0f, modrm): New.
 (attribute length): Compute using the new attributes.
 (attribute pent_prefix): New.
 (attribute pent_pair): Compute using pent_prefix.
 (all insn patterns): Set mode,modrm and immediate_length attributes where
 needed.
 (cmpsi patterns): Compute sizes propertly for test instruction.
 (movsi, movhi patterns): Compute sizes propertly for eax shortcuts.
 (movstricthi_xor, movstrictqi_xor): New patterns.
 (andsi/andhi): Use splitters to generate xor instructions.
 (xorqi_ext_1): New pattern.
 (movstricthi->movstricthi_xor peep2): New


This patch conditionally sets the type of the 'loop' instruction, which doesn't work
(presumably order of evaluation issues). Simply reverting to the old code for this
instruction fixes the two failures.

However the patch contains some other problems:
- a typo for the "length_immediate" attribute: the "ibr" type is handled at two
locations, the first one shadowing the second one (verified in insn-attrtab.c).
Now the first one is wrong, thus making all immediate branches 2-byte long,
- the typo compensates an oversight: the "modrm" attribute is set to 1 for
immediate branches instead of 0,
- another typo for the "length_address" attribute: operand 1 is used instead of
operand 0 for the "call" type,
- another oversight: the "modrm" attribute is set to 1 for immediate "call"
and "callv" instructions.
- two other typos: the "modrm" attribute is set twice at two locations.


Bootstrapped/regtested (C/C++) on k6-pc-linux-gnu (gcc-3_1-branch), the two
aforementioned failures being fixed.


2002-06-27  Eric Botcazou  <ebotcazou@multimania.com>

 * config/i386/i386.md (length_immediate attribute): Fix typo.
 (length_address attribute): Likewise.
 (modrm attribute): Set it to 0 for immediate call instructions.
 (jcc_1 pattern): Set modrm attribute to 0.
 (jcc_2 pattern ): Likewise.
 (jump pattern): Likewise.
 (doloop_end_internal pattern): Revert 2000-06-06 patch.
 (leave pattern): Fix typo.
 (leave_rex64 pattern): Likewise.


--
Eric Botcazou
ebotcazou@multimania.com

Attachment: i386_md.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]