[G]CSE of extended asm statements

Alexandre Oliva aoliva@redhat.com
Sun Aug 27 08:27:00 GMT 2000

The testcase in the following patch used to fail with -O2 on at least
sh-elf and mn10300-elf.  The problem was that gcse unified the
asm_operands and ended up emitting an invalid insn such as:

(set (reg:SI n) (reg:QI m))

This patch not only fixes this problem, by recording modes in
ASM_OPERANDS so that they're not considered equivalent if they have
different modes, but also allows for cse and gcse to be applied on
ASM_OPERANDS even if they appear in different lines.

While I was at it, I took the opportunity to replace all accesses to
ASM_OPERANDS I could find that didn't use macros with accesses through
the macros.

I was thinking of factoring out the vector elements that are shared by
all output operands of a single asm statement (i.e., template, input
operands, input constraints, filename and line number, into a separate
rtx, so that we don't have to keep duplicating it, and then arrange
for ASM_OPERANDS to contain a pointer to this new rtx and the
constraints and index of the output operand.  It might still be worth
it to use the current structure if there are only one or maybe two
output operands, though.  Does anybody think this is worth the

A previous revision of this patch introduced no regressions in the
testsuite on i686-pc-linux-gnu, which is probably a good test since
glibc uses so many asm statements.  Ok to install, assuming this
version performs as well?

More information about the Gcc-patches mailing list