diff options
author | Dominik Vogt <vogt@linux.vnet.ibm.com> | 2016-12-02 08:26:19 +0000 |
---|---|---|
committer | Andreas Krebbel <krebbel@gcc.gnu.org> | 2016-12-02 08:26:19 +0000 |
commit | 8f61415f1f776d35f0d616bd662019a659a6e536 (patch) | |
tree | 05837f8d404bbfc6a3056defa244950336cb02ad /gcc | |
parent | 7f5fc63362a675a216f1475bb08fd42d8274f8cf (diff) | |
download | gcc-8f61415f1f776d35f0d616bd662019a659a6e536.zip gcc-8f61415f1f776d35f0d616bd662019a659a6e536.tar.gz gcc-8f61415f1f776d35f0d616bd662019a659a6e536.tar.bz2 |
PR target/77822: Add helper macro EXTRACT_ARGS_IN_RANGE to system.h.
The macro can be used to validate the arguments of zero_extract and
sign_extract to fix this problem:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77822
gcc/ChangeLog:
2016-12-02 Dominik Vogt <vogt@linux.vnet.ibm.com>
PR target/77822
* rtl.h (EXTRACT_ARGS_IN_RANGE): New.
From-SVN: r243159
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/rtl.h | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5f8345..8c71c21 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-12-02 Dominik Vogt <vogt@linux.vnet.ibm.com> + + PR target/77822 + * rtl.h (EXTRACT_ARGS_IN_RANGE): New. + 2016-12-02 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * gcc/config/s390/s390.c (s390_builtin_vectorization_cost): New @@ -2694,6 +2694,16 @@ get_full_set_src_cost (rtx x, machine_mode mode, struct full_rtx_costs *c) } #endif +/* A convenience macro to validate the arguments of a zero_extract + expression. It determines whether SIZE lies inclusively within + [1, RANGE], POS lies inclusively within between [0, RANGE - 1] + and the sum lies inclusively within [1, RANGE]. RANGE must be + >= 1, but SIZE and POS may be negative. */ +#define EXTRACT_ARGS_IN_RANGE(SIZE, POS, RANGE) \ + (IN_RANGE ((POS), 0, (unsigned HOST_WIDE_INT) (RANGE) - 1) \ + && IN_RANGE ((SIZE), 1, (unsigned HOST_WIDE_INT) (RANGE) \ + - (unsigned HOST_WIDE_INT)(POS))) + /* In explow.c */ extern HOST_WIDE_INT trunc_int_for_mode (HOST_WIDE_INT, machine_mode); extern rtx plus_constant (machine_mode, rtx, HOST_WIDE_INT, bool = false); |