/* Subroutines used for code generation on the DEC Alpha.
- Copyright (C) 1992 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@nyu.edu)
This file is part of GNU CC.
HOST_WIDE_INT tmp1 = c - low;
HOST_WIDE_INT high
= ((tmp1 >> 16) & 0xffff) - 2 * ((tmp1 >> 16) & 0x8000);
- HOST_WIDE_INT tmp2 = c - (high << 16) - low;
HOST_WIDE_INT extra = 0;
- if (tmp2)
+ /* If HIGH will be interpreted as negative but the constant is
+ positive, we must adjust it to do two ldha insns. */
+
+ if ((high & 0x8000) != 0 && c >= 0)
{
extra = 0x4000;
tmp1 -= 0x40000000;
HOST_WIDE_INT tmp1 = blocks - low;
HOST_WIDE_INT high
= ((tmp1 >> 16) & 0xffff) - 2 * ((tmp1 >> 16) & 0x8000);
- HOST_WIDE_INT tmp2 = blocks - (high << 16) - low;
HOST_WIDE_INT extra = 0;
int in_reg = 31;
- if (tmp2)
+ /* If HIGH will be interpreted as negative, we must adjust it to
+ do two ldha insns. Note that we will never be building a negative
+ constant here. */
+
+ if (high & 0x8000)
{
extra = 0x4000;
tmp1 -= 0x40000000;
HOST_WIDE_INT tmp1 = frame_size - low;
HOST_WIDE_INT high
= ((tmp1 >> 16) & 0xffff) - 2 * ((tmp1 >> 16) & 0x8000);
- HOST_WIDE_INT tmp2 = frame_size - (high << 16) - low;
HOST_WIDE_INT extra = 0;
int in_reg = 31;
abort ();
#endif
- if (tmp2)
+ /* If HIGH will be interpreted as negative, we must adjust it to
+ do two ldha insns. Note that we will never be building a negative
+ constant here. */
+
+ if (high & 0x8000)
{
extra = 0x4000;
tmp1 -= 0x40000000;