Skip to content
Snippets Groups Projects
Commit b159026b authored by Roger Sayle's avatar Roger Sayle
Browse files

[Committed] Update xstormy16's neghi2 pattern to not clobber the carry flag.

When I converted xstormy's neghi2 pattern from a define_expand to a
define_insn, I forgot that define_expand implicitly produces a
sequence of instructions, but a define_insn is an implicit parallel,
thereby messing up the clobber (reg:BI CARRY_REG), which can then cause
an ICE in the auto-generated added_clobbers_hard_reg_p.  Whilst stripping
the superfluous PARALLEL resolves this issue, an even better fix is to
use xstormy16's INC instruction, that (like NOT) doesn't affect the carry
flag, resulting in a neghi2 implementation that can more easily be CSE'd
and scheduled.

Many thanks (again) to Jeff Law for testing/reporting this issue.

2024-04-30  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	* config/stormy16/stormy16.md (neghi2): Rewrite pattern using
	inc to avoid clobbering the carry flag.

gcc/testsuite/ChangeLog
	* gcc.target/xstormy16/neghi2.c: Update expected implementation.
parent d56af02f
No related branches found
No related tags found
Loading
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