https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94595
Bug ID: 94595 Summary: gcc.target/arm/thumb2-cond-cmp-*.c fail for cortex-m Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: clyon at gcc dot gnu.org Target Milestone: --- I've noticed that gcc.target/arm/thumb2-cond-cmp-*.c fail when targeting cortex-M CPUs. For thumb2-cond-cmp-1.c, the code generated at svn r196196 for cortex-m3 was: f: cmp r1, #45 it ne cmpne r0, #43 ite ne movne r0, #0 moveq r0, #1 bx lr Since r204778, we generate: f: cmp r0, #43 @ 8 [c=4 l=2] *arm_cmpsi_insn/0 ittte ne subne r0, r1, #45 @ 66 [c=8 l=6] *p *arm_subsi3_insn/5 clzne r0, r0 @ 67 [c=8 l=6] *p clzsi2 lsrne r0, r0, #5 @ 68 [c=8 l=6] *p *arm_shiftsi3/1 moveq r0, #1 @ 5 [c=8 l=6] *p *thumb2_movsi_insn/1 bx lr @ 61 [c=8 l=4] *thumb2_return but using -mcpu=cortex-a9 generates: f: cmp r1, #45 @ 26 [c=20 l=6] *cmp_ior/0 it ne cmpne r0, #43 ite eq moveq r0, #1 @ 29 [c=8 l=6] *p *thumb2_movsi_insn/1 movne r0, #0 @ 30 [c=8 l=6] *p *thumb2_movsi_insn/1 bx lr @ 33 [c=8 l=4] *thumb2_return I'm not quite sure about the intent of the test (the comment says "Use conditional compare"): strictly speaking, the cortex-m3 version does not use conditional compares, but I'm wondering whether subne can be considered as a conditional compare? If so, then only the testcases need an update in the scan-assembler directive. Or do we want to enforce the use of conditional compare instructions? FWIW, these tests were introducted in 2011 (r178102) and started failing for cortex-m in 2013 (r204778), does anyone remember the context?