diff options
author | Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> | 2024-09-13 15:05:33 +0200 |
---|---|---|
committer | Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> | 2024-09-13 15:05:33 +0200 |
commit | 1a71ff3b89aadc7fa0af0bca269d74bb23c1a957 (patch) | |
tree | 96bc7b966ac08a5af39fbe19ac1b3dc5da2970ab | |
parent | 5938e0681c3907b2771ce6717988416b0ddd2f54 (diff) | |
download | gcc-1a71ff3b89aadc7fa0af0bca269d74bb23c1a957.zip gcc-1a71ff3b89aadc7fa0af0bca269d74bb23c1a957.tar.gz gcc-1a71ff3b89aadc7fa0af0bca269d74bb23c1a957.tar.bz2 |
s390: Fix AQ and AR constraints
Ensure for AQ and AR constraints that the resulting displacement after
adding any positive offset less than the size of the object being
referenced is still valid.
gcc/ChangeLog:
* config/s390/s390.cc (s390_mem_constraint): Check displacement
for AQ and AR constraints.
-rw-r--r-- | gcc/config/s390/s390.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc index c1649ca..9269871 100644 --- a/gcc/config/s390/s390.cc +++ b/gcc/config/s390/s390.cc @@ -3689,6 +3689,18 @@ s390_mem_constraint (const char *str, rtx op) if ((reload_completed || reload_in_progress) ? !offsettable_memref_p (op) : !offsettable_nonstrict_memref_p (op)) return 0; + /* offsettable_memref_p ensures only that any positive offset added to + the address forms a valid general address. For AQ and AR constraints + we also have to verify that the resulting displacement after adding + any positive offset less than the size of the object being referenced + is still valid. */ + if (str[1] == 'Q' || str[1] == 'R') + { + int o = GET_MODE_SIZE (GET_MODE (op)) - 1; + rtx tmp = adjust_address (op, QImode, o); + if (!s390_check_qrst_address (str[1], XEXP (tmp, 0), true)) + return 0; + } return s390_check_qrst_address (str[1], XEXP (op, 0), true); case 'B': /* Check for non-literal-pool variants of memory constraints. */ |