aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorJens Remus <jremus@linux.ibm.com>2024-03-01 12:45:14 +0100
committerJens Remus <jremus@linux.ibm.com>2024-03-01 12:45:14 +0100
commitaacf780bca2940a9feb4e9d1b1d9e2033f1ce4ac (patch)
tree9160ab4eb204eed0690844a0371b6dd3024c7f84 /gas/config
parent75a28d1a97ace81c8481fd1c85d21e6f22e68924 (diff)
downloadbinutils-aacf780bca2940a9feb4e9d1b1d9e2033f1ce4ac.zip
binutils-aacf780bca2940a9feb4e9d1b1d9e2033f1ce4ac.tar.gz
binutils-aacf780bca2940a9feb4e9d1b1d9e2033f1ce4ac.tar.bz2
s390: Allow to explicitly omit base register operand in assembly
The base register operand B may be omitted in D(B) by coding D and in D(L,B) by coding D(L). The index register operand X may be omitted in D(X,B) by coding D(B) or explicitly omitted by coding D(,B). In both cases the omitted base register operand value defaults to zero. Allow to explicitly omit the base register operand B in D(X,B) and D(L,B) by coding D(X,) and D(L,). Default the omitted base register operand value to zero. gas/ * config/tc-s390.c: Allow to explicitly omit the base register operand in assembly. * NEWS: Mention that the base register now may be omitted on s390. * gas/testsuite/gas/s390/zarch-base-index-0.s: Update test cases for change to allow to explicitly omit the base register operand in assembly. * gas/testsuite/gas/s390/zarch-base-index-0.d: Likewise. * gas/testsuite/gas/s390/zarch-base-index-0-err.s: Likewise. * gas/testsuite/gas/s390/zarch-base-index-0-err.l: Likewise. * gas/testsuite/gas/s390/zarch-omitted-base-index.s: Likewise. * gas/testsuite/gas/s390/zarch-omitted-base-index.d: Likewise. * gas/testsuite/gas/s390/zarch-omitted-base-index-err.s: Likewise. * gas/testsuite/gas/s390/zarch-omitted-base-index-err.l: Likewise. Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-s390.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 9659875..edf8883 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -1683,13 +1683,17 @@ md_gather_operands (char *str,
else
{
/* We can find an 'early' closing parentheses in e.g. D(L) instead
- of D(L,B). In this case the base register has to be skipped. */
- if (*str == ')')
+ of D(L,B). In this case the base register has to be skipped.
+ Same if the base register has been explicilty omitted in e.g.
+ D(X,) or D(L,). */
+ if (*str == ')' || (str[0] == ',' && str[1] == ')'))
{
operand = s390_operands + *(++opindex_ptr);
if (!(operand->flags & S390_OPERAND_BASE))
- as_bad (_("syntax error; ')' not allowed here"));
+ as_bad (_("syntax error; '%c' not allowed here"), *str);
+ if (*str == ',')
+ str++;
str++;
}