aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorDmitry Selyutin <ghostmansd@gmail.com>2022-07-25 16:10:15 +0300
committerAlan Modra <amodra@gmail.com>2022-08-11 18:38:29 +0930
commit59f08271dda07502f53575538efcd19d247c70e1 (patch)
tree08d89f7eeff1e07cf6b7563acad373b90c5b2f49 /gas
parent33ae8a3ae31d8ea787d79d2a677d960721ffe682 (diff)
downloadbinutils-59f08271dda07502f53575538efcd19d247c70e1.zip
binutils-59f08271dda07502f53575538efcd19d247c70e1.tar.gz
binutils-59f08271dda07502f53575538efcd19d247c70e1.tar.bz2
ppc/svp64: introduce non-zero operand flag
svstep and svshape instructions subtract 1 before encoding some of the operands. Obviously zero is not supported for these operands. Whilst PPC_OPERAND_PLUS1 fits perfectly to mark that maximal value should be incremented, there is no flag which marks the fact that zero values are not allowed. This patch adds a new flag, PPC_OPERAND_NONZERO, for this purpose.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-ppc.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index ffc9985..b5aad4b 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1657,9 +1657,14 @@ ppc_setup_opcodes (void)
for (i = 0; i < num_powerpc_operands; ++i)
{
uint64_t mask = powerpc_operands[i].bitm;
+ unsigned long flags = powerpc_operands[i].flags;
uint64_t right_bit;
unsigned int j;
+ if ((flags & PPC_OPERAND_PLUS1) != 0
+ && (flags & PPC_OPERAND_NONZERO) != 0)
+ as_bad ("mutually exclusive operand flags");
+
right_bit = mask & -mask;
mask += right_bit;
right_bit = mask & -mask;
@@ -1992,6 +1997,11 @@ ppc_insert_operand (uint64_t insn,
max = (max >> 1) & -right;
min = ~max & -right;
}
+ else if ((operand->flags & PPC_OPERAND_NONZERO) != 0)
+ {
+ ++min;
+ ++max;
+ }
if ((operand->flags & PPC_OPERAND_PLUS1) != 0)
max++;
@@ -2042,10 +2052,15 @@ ppc_insert_operand (uint64_t insn,
if (errmsg != (const char *) NULL)
as_bad_where (file, line, "%s", errmsg);
}
- else if (operand->shift >= 0)
- insn |= (val & operand->bitm) << operand->shift;
else
- insn |= (val & operand->bitm) >> -operand->shift;
+ {
+ if ((operand->flags & PPC_OPERAND_NONZERO) != 0)
+ --val;
+ if (operand->shift >= 0)
+ insn |= (val & operand->bitm) << operand->shift;
+ else
+ insn |= (val & operand->bitm) >> -operand->shift;
+ }
return insn;
}