[PATCH, ARM] Further improve stack usage in sha512, part 2 (PR 77308)

Wilco Dijkstra Wilco.Dijkstra@arm.com
Wed Dec 21 15:20:00 GMT 2016


Bernd Edlinger wrote:
On 12/20/16 16:09, Wilco Dijkstra wrote:
> > As a result of your patches a few patterns are unused now. All the Thumb-2 iordi_notdi*
> > patterns cannot be used anymore. Also I think arm_cmpdi_zero never gets used - a DI
>> mode compare with zero is always split into ORR during expand.
>
> I did not change anything for -mthumb -mfpu=neon for instance.
> Do you think that iordi_notdi* is never used also for that
> configuration?

With -mfpu=vfp or -msoft-float, these patterns cannot be used as logical operations are expanded before combine. Interestingly with -mfpu=neon ARM uses the orndi3_neon patterns (which are inefficient for ARM and probably should be disabled) but Thumb-2 uses the iordi_notdi patterns... So removing these reduces the number of patterns while we will still generate orn for Thumb-2.

> And if the arm_cmpdi_zero is never expanded, isn't it already
> unused before my patch?

It appears to be, so we don't need to fix it now. However when improving the expansion of comparisons it does trigger. For example x == 3 expands currently into 3 instructions:

	cmp	r1, #0
	itt	eq
	cmpeq	r0, #3

Tweaking arm_select_cc_mode uses arm_cmpdi_zero, and when expanded early we generate this:

	eor	r0, r0, #3
	orrs	r0, r0, r1

Using sub rather than eor would be even better of course.

Wilco
    


More information about the Gcc-patches mailing list