- /* Find a predecrement of exactly the previous adjustment and
- turn it into a direct store. Obviously we can't do this if
- there were any intervening uses of the stack pointer. */
- if (memlist == NULL
- && MEM_P (dest)
- && ((GET_CODE (XEXP (dest, 0)) == PRE_DEC
- && (last_sp_adjust
- == (HOST_WIDE_INT) GET_MODE_SIZE (GET_MODE (dest))))
- || (GET_CODE (XEXP (dest, 0)) == PRE_MODIFY
+ /* Find a store with pre-(dec|inc)rement or pre-modify of exactly
+ the previous adjustment and turn it into a simple store. This
+ is equivalent to anticipating the stack adjustment so this must
+ be an allocation. */
+ if (MEM_P (dest)
+ && ((STACK_GROWS_DOWNWARD
+ ? (GET_CODE (XEXP (dest, 0)) == PRE_DEC
+ && last_sp_adjust
+ == (HOST_WIDE_INT) GET_MODE_SIZE (GET_MODE (dest)))
+ : (GET_CODE (XEXP (dest, 0)) == PRE_INC
+ && last_sp_adjust
+ == -(HOST_WIDE_INT) GET_MODE_SIZE (GET_MODE (dest))))
+ || ((STACK_GROWS_DOWNWARD
+ ? last_sp_adjust >= 0 : last_sp_adjust <= 0)
+ && GET_CODE (XEXP (dest, 0)) == PRE_MODIFY