Skip to content
Snippets Groups Projects
Commit a14d247f authored by Richard Sandiford's avatar Richard Sandiford
Browse files

Treat "p" in asms as addressing VOIDmode

check_asm_operands was inconsistent about how it handled "p"
after RA compared to before RA.  Before RA it tested the address
with a void (unknown) memory mode:

	    case CT_ADDRESS:
	      /* Every address operand can be reloaded to fit.  */
	      result = result || address_operand (op, VOIDmode);
	      break;

After RA it deferred to constrain_operands, which used the mode
of the operand:

		if ((GET_MODE (op) == VOIDmode
		     || SCALAR_INT_MODE_P (GET_MODE (op)))
		    && (strict <= 0
			|| (strict_memory_address_p
			     (recog_data.operand_mode[opno], op))))
		  win = true;

Using the mode of the operand is necessary for special predicates,
where it is used to give the memory mode.  But for asms, the operand
mode is simply the mode of the address itself (so DImode on 64-bit
targets), which doesn't say anything about the addressed memory.

This patch uses VOIDmode for asms but continues to use the operand
mode for .md insns.  It's needed to avoid a regression in the
testcase with the late-combine pass.

Fixing this made me realise that recog_level2 was doing duplicate
work for asms after RA.

gcc/
	* recog.cc (constrain_operands): Pass VOIDmode to
	strict_memory_address_p for 'p' constraints in asms.
	* rtl-ssa/changes.cc (recog_level2): Skip redundant constrain_operands
	for asms.

gcc/testsuite/
	* gcc.target/aarch64/prfm_imm_offset_2.c: New test.
parent 074c6f15
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment