[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-patches
Subject: HP-UX IA64 ILP32 patch
From: Steve Ellcey <sje () cup ! hp ! com>
Date: 2002-02-28 23:50:38
[Download RAW message or body]
Now that 3.1 has branched I would like to try and finish getting my
HP-UX IA64 changes into the mainline GCC. The HP-UX IA64 code in 3.1
isn't complete so there is no urgency to get these changes in that
branch.
Here is a patch to fix a problem in ILP32 bit mode due to HP-UX not
using zero or sign extension of pointers (it uses an instruction called
addp4 instead).
I earlier changed POINTERS_EXTEND_UNSIGNED to allow a value less then
zero to reflect this but I didn't change SUBREGS to store this new value
instead of just a 1 or 0 for zero or sign extension. This causes us to
do the wrong type of pointer extension in some cases. Unfortunately,
since I couldn't find a clever way to store 3 values in a 1 bit field I
had to create a new macro called SUBREG_PROMOTED_UNSIGNED_SET to set two
fields. SUBREG_PROMOTED_UNSIGNED_P still returns the value (based on the
two fields).
I have a copyright assignment on file but I do not have write permission
so I am looking for both an approval and a checkin of these changes.
Steve Ellcey
sje@cup.hp.com
2002-02-28 Steve Ellcey <sje@cup.hp.com>
* doc/rtl.texi (SUBREG_PROMOTED_UNSIGNED_P): Change definition
to take ptr_extend into account as third type of extension.
(SUBREG_PROMOTED_UNSIGNED_SET): Definition of new macro to set bit
fields used by SUBREG_PROMOTED_UNSIGNED_P.
* rtl.h (SUBREG_PROMOTED_UNSIGNED_SET): New macro.
(SUBREG_PROMOTED_UNSIGNED_P): Change to return -1 as well as 0 or 1.
* calls.c (precompute_arguments): Use new macro.
(expand_call): Ditto.
* combine.c (nonzero_bits): Ditto.
(record_promoted_value): Ditto.
* expr.c (store_expr): Ditto.
(expand_expr): Ditto.
* function.c (assign_parms): Ditto.
*** gcc.orig/gcc/doc/rtl.texi Thu Feb 28 14:56:10 2002
--- gcc/gcc/doc/rtl.texi Thu Feb 28 15:29:07 2002
*************** string constant pool.
*** 631,643 ****
Stored in the @code{frame_related} field and printed as @samp{/f}.
@findex SUBREG_PROMOTED_UNSIGNED_P
! @cindex @code{subreg} and @samp{/u}
@cindex @code{unchanging}, in @code{subreg}
@item SUBREG_PROMOTED_UNSIGNED_P (@var{x})
! Nonzero in a @code{subreg} that has @code{SUBREG_PROMOTED_VAR_P} nonzero
! if the object being referenced is kept zero-extended and zero if it
! is kept sign-extended. Stored in the @code{unchanging} field and
! printed as @samp{/u}.
@findex SUBREG_PROMOTED_VAR_P
@cindex @code{subreg} and @samp{/s}
--- 631,659 ----
Stored in the @code{frame_related} field and printed as @samp{/f}.
@findex SUBREG_PROMOTED_UNSIGNED_P
! @cindex @code{subreg} and @samp{/u} and @samp{/v}
@cindex @code{unchanging}, in @code{subreg}
+ @cindex @code{volatil}, in @code{subreg}
@item SUBREG_PROMOTED_UNSIGNED_P (@var{x})
! Returns a value greater then zero for a @code{subreg} that has
! @code{SUBREG_PROMOTED_VAR_P} nonzero if the object being referenced is kept
! zero-extended, zero if it is kept sign-extended, and less then zero if it is
! extended some other way via the @code{ptr_extend} instruction.
! Stored in the @code{unchanging}
! field and @code{volatil} field, printed as @samp{/u} and @samp{/v}.
! This macro may only be used to get the value it may not be used to change
! the value. Use @code{SUBREG_PROMOTED_UNSIGNED_SET} to change the value.
!
! @findex SUBREG_PROMOTED_UNSIGNED_SET
! @cindex @code{subreg} and @samp{/u}
! @cindex @code{unchanging}, in @code{subreg}
! @cindex @code{volatil}, in @code{subreg}
! @item SUBREG_PROMOTED_UNSIGNED_SET (@var{x})
! Set the @code{unchanging} and @code{volatil} fields in a @code{subreg}
! to reflect zero, sign, or other extension. If @code{volatil} is
! zero, then @code{unchanging} as nonzero means zero extension and as
! zero means sign extension. If @code{volatil} is nonzero then some
! other type of extension was done via the @code{ptr_extend} instruction.
@findex SUBREG_PROMOTED_VAR_P
@cindex @code{subreg} and @samp{/s}
*** gcc.orig/gcc/rtl.h Thu Feb 28 14:14:32 2002
--- gcc/gcc/rtl.h Thu Feb 28 14:52:12 2002
*************** extern unsigned int subreg_regno PARAMS
*** 853,859 ****
when assigning to SUBREG_REG. */
#define SUBREG_PROMOTED_VAR_P(RTX) ((RTX)->in_struct)
! #define SUBREG_PROMOTED_UNSIGNED_P(RTX) ((RTX)->unchanging)
/* Access various components of an ASM_OPERANDS rtx. */
--- 853,868 ----
when assigning to SUBREG_REG. */
#define SUBREG_PROMOTED_VAR_P(RTX) ((RTX)->in_struct)
! #define SUBREG_PROMOTED_UNSIGNED_SET(RTX, VAL) \
! do { \
! if ((VAL) < 0) \
! (RTX)->volatil = 1; \
! else { \
! (RTX)->volatil = 0; \
! (RTX)->unchanging = (VAL); \
! } \
! } while (0)
! #define SUBREG_PROMOTED_UNSIGNED_P(RTX) ((RTX)->volatil ? -1 : (RTX)->unchanging)
/* Access various components of an ASM_OPERANDS rtx. */
*** gcc.orig/gcc/calls.c Thu Feb 28 14:14:32 2002
--- gcc/gcc/calls.c Thu Feb 28 14:28:09 2002
*************** precompute_arguments (flags, num_actuals
*** 1542,1549 ****
args[i].initial_value
= gen_lowpart_SUBREG (mode, args[i].value);
SUBREG_PROMOTED_VAR_P (args[i].initial_value) = 1;
! SUBREG_PROMOTED_UNSIGNED_P (args[i].initial_value)
! = args[i].unsignedp;
}
#endif
}
--- 1542,1549 ----
args[i].initial_value
= gen_lowpart_SUBREG (mode, args[i].value);
SUBREG_PROMOTED_VAR_P (args[i].initial_value) = 1;
! SUBREG_PROMOTED_UNSIGNED_SET (args[i].initial_value,
! args[i].unsignedp);
}
#endif
}
*************** expand_call (exp, target, ignore)
*** 3279,3285 ****
}
target = gen_rtx_SUBREG (TYPE_MODE (type), target, offset);
SUBREG_PROMOTED_VAR_P (target) = 1;
! SUBREG_PROMOTED_UNSIGNED_P (target) = unsignedp;
}
#endif
--- 3279,3285 ----
}
target = gen_rtx_SUBREG (TYPE_MODE (type), target, offset);
SUBREG_PROMOTED_VAR_P (target) = 1;
! SUBREG_PROMOTED_UNSIGNED_SET (target, unsignedp);
}
#endif
*** gcc.orig/gcc/combine.c Thu Feb 28 14:14:32 2002
--- gcc/gcc/combine.c Thu Feb 28 14:27:32 2002
*************** nonzero_bits (x, mode)
*** 8270,8276 ****
been zero-extended, we know that at least the high-order bits
are zero, though others might be too. */
! if (SUBREG_PROMOTED_VAR_P (x) && SUBREG_PROMOTED_UNSIGNED_P (x))
nonzero = (GET_MODE_MASK (GET_MODE (x))
& nonzero_bits (SUBREG_REG (x), GET_MODE (x)));
--- 8270,8276 ----
been zero-extended, we know that at least the high-order bits
are zero, though others might be too. */
! if (SUBREG_PROMOTED_VAR_P (x) && SUBREG_PROMOTED_UNSIGNED_P (x) > 0)
nonzero = (GET_MODE_MASK (GET_MODE (x))
& nonzero_bits (SUBREG_REG (x), GET_MODE (x)));
*************** record_promoted_value (insn, subreg)
*** 11325,11331 ****
if (reg_last_set[regno] == insn)
{
! if (SUBREG_PROMOTED_UNSIGNED_P (subreg))
reg_last_set_nonzero_bits[regno] &= GET_MODE_MASK (mode);
}
--- 11325,11331 ----
if (reg_last_set[regno] == insn)
{
! if (SUBREG_PROMOTED_UNSIGNED_P (subreg) > 0)
reg_last_set_nonzero_bits[regno] &= GET_MODE_MASK (mode);
}
*** gcc.orig/gcc/expr.c Thu Feb 28 14:14:32 2002
--- gcc/gcc/expr.c Thu Feb 28 14:25:43 2002
*************** store_expr (exp, target, want_value)
*** 4049,4056 ****
{
temp = gen_lowpart_SUBREG (GET_MODE (target), temp);
SUBREG_PROMOTED_VAR_P (temp) = 1;
! SUBREG_PROMOTED_UNSIGNED_P (temp)
! = SUBREG_PROMOTED_UNSIGNED_P (target);
}
else
temp = convert_modes (GET_MODE (target),
--- 4049,4056 ----
{
temp = gen_lowpart_SUBREG (GET_MODE (target), temp);
SUBREG_PROMOTED_VAR_P (temp) = 1;
! SUBREG_PROMOTED_UNSIGNED_SET (temp,
! SUBREG_PROMOTED_UNSIGNED_P (target));
}
else
temp = convert_modes (GET_MODE (target),
*************** expand_expr (exp, target, tmode, modifie
*** 6289,6295 ****
temp = gen_lowpart_SUBREG (mode, DECL_RTL (exp));
SUBREG_PROMOTED_VAR_P (temp) = 1;
! SUBREG_PROMOTED_UNSIGNED_P (temp) = unsignedp;
return temp;
}
--- 6289,6295 ----
temp = gen_lowpart_SUBREG (mode, DECL_RTL (exp));
SUBREG_PROMOTED_VAR_P (temp) = 1;
! SUBREG_PROMOTED_UNSIGNED_SET (temp, unsignedp);
return temp;
}
*************** expand_expr (exp, target, tmode, modifie
*** 6409,6415 ****
{
temp = gen_lowpart_SUBREG (mode, SAVE_EXPR_RTL (exp));
SUBREG_PROMOTED_VAR_P (temp) = 1;
! SUBREG_PROMOTED_UNSIGNED_P (temp) = unsignedp;
}
if (temp == const0_rtx)
--- 6409,6415 ----
{
temp = gen_lowpart_SUBREG (mode, SAVE_EXPR_RTL (exp));
SUBREG_PROMOTED_VAR_P (temp) = 1;
! SUBREG_PROMOTED_UNSIGNED_SET (temp, unsignedp);
}
if (temp == const0_rtx)
*************** expand_expr (exp, target, tmode, modifie
*** 6431,6437 ****
promote_mode (type, mode, &unsignedp, 0);
temp = gen_lowpart_SUBREG (mode, SAVE_EXPR_RTL (exp));
SUBREG_PROMOTED_VAR_P (temp) = 1;
! SUBREG_PROMOTED_UNSIGNED_P (temp) = unsignedp;
return temp;
}
--- 6431,6437 ----
promote_mode (type, mode, &unsignedp, 0);
temp = gen_lowpart_SUBREG (mode, SAVE_EXPR_RTL (exp));
SUBREG_PROMOTED_VAR_P (temp) = 1;
! SUBREG_PROMOTED_UNSIGNED_SET (temp, unsignedp);
return temp;
}
*** gcc.orig/gcc/function.c Thu Feb 28 14:14:32 2002
--- gcc/gcc/function.c Thu Feb 28 14:22:06 2002
*************** assign_parms (fndecl)
*** 4733,4739 ****
/* The argument is already sign/zero extended, so note it
into the subreg. */
SUBREG_PROMOTED_VAR_P (tempreg) = 1;
! SUBREG_PROMOTED_UNSIGNED_P (tempreg) = unsignedp;
}
/* TREE_USED gets set erroneously during expand_assignment. */
--- 4733,4739 ----
/* The argument is already sign/zero extended, so note it
into the subreg. */
SUBREG_PROMOTED_VAR_P (tempreg) = 1;
! SUBREG_PROMOTED_UNSIGNED_SET (tempreg, unsignedp);
}
/* TREE_USED gets set erroneously during expand_assignment. */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic