• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂07cd3a81e201316fb4419c24660ee0a0ffa5b729 (tree)
時間2016-08-23 17:41:02
作者Richard Sandiford <richard.sandiford@arm....>
CommiterRichard Sandiford

Log Message

[AArch64][SVE 13/32] Add an F_STRICT flag

SVE predicate operands can appear in three forms:

1. unsuffixed: "Pn"
2. with a predication type: "Pn/[ZM]"
3. with a size suffix: "Pn.[BHSD]"

No variation is allowed: unsuffixed operands cannot have a (redundant)
suffix, and the suffixes can never be dropped. Unsuffixed Pn are used
in LDR and STR, but they are also used for Pg operands in cases where
the result is scalar and where there is therefore no choice to be made
between "merging" and "zeroing". This means that some Pg operands have
suffixes and others don't.

It would be possible to use context-sensitive parsing to handle
this difference. The tc-aarch64.c code would then raise an error
if the wrong kind of suffix is used for a particular instruction.

However, we get much more user-friendly error messages if we parse
all three forms for all SVE instructions and record the suffix as a
qualifier. The normal qualifier matching code can then report cases
where the wrong kind of suffix is used. This is a slight extension
of existing usage, which really only checks for the wrong choice of
suffix within a particular kind of suffix.

The only catch is a that a "NIL" entry in the qualifier list
specifically means "no suffix should be present" (case 1 above).
NIL isn't a wildcard here. It also means that an instruction that
requires all-NIL qualifiers can fail to match (because a suffix was
supplied when it shouldn't have been); this requires a slight change
to find_best_match.

This patch adds an F_STRICT flag to select this behaviour.
The flag will be set for all SVE instructions. The behaviour
for other instructions doesn't change.

include/opcode/
* aarch64.h (F_STRICT): New flag.

opcodes/
* aarch64-opc.c (match_operands_qualifier): Handle F_STRICT.

gas/
* config/tc-aarch64.c (find_best_match): Simplify, allowing an
instruction with all-NIL qualifiers to fail to match.

Change-Id: I4af1ba954da0478de1a124bce66d034eb949412f

Change Summary

差異

--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -4182,7 +4182,7 @@ find_best_match (const aarch64_inst *instr,
41824182 }
41834183
41844184 max_num_matched = 0;
4185- idx = -1;
4185+ idx = 0;
41864186
41874187 /* For each pattern. */
41884188 for (i = 0; i < AARCH64_MAX_QLF_SEQ_NUM; ++i, ++qualifiers_list)
@@ -4194,9 +4194,6 @@ find_best_match (const aarch64_inst *instr,
41944194 if (empty_qualifier_sequence_p (qualifiers) == TRUE)
41954195 {
41964196 DEBUG_TRACE_IF (i == 0, "empty list of qualifier sequence");
4197- if (i != 0 && idx == -1)
4198- /* If nothing has been matched, return the 1st sequence. */
4199- idx = 0;
42004197 break;
42014198 }
42024199
--- a/include/opcode/aarch64.h
+++ b/include/opcode/aarch64.h
@@ -598,7 +598,9 @@ extern aarch64_opcode aarch64_opcode_table[];
598598 #define F_OD(X) (((X) & 0x7) << 24)
599599 /* Instruction has the field of 'sz'. */
600600 #define F_LSE_SZ (1 << 27)
601-/* Next bit is 28. */
601+/* Require an exact qualifier match, even for NIL qualifiers. */
602+#define F_STRICT (1ULL << 28)
603+/* Next bit is 29. */
602604
603605 static inline bfd_boolean
604606 alias_opcode_p (const aarch64_opcode *opcode)
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -854,7 +854,7 @@ aarch64_find_best_match (const aarch64_inst *inst,
854854 static int
855855 match_operands_qualifier (aarch64_inst *inst, bfd_boolean update_p)
856856 {
857- int i;
857+ int i, nops;
858858 aarch64_opnd_qualifier_seq_t qualifiers;
859859
860860 if (!aarch64_find_best_match (inst, inst->opcode->qualifiers_list, -1,
@@ -864,6 +864,15 @@ match_operands_qualifier (aarch64_inst *inst, bfd_boolean update_p)
864864 return 0;
865865 }
866866
867+ if (inst->opcode->flags & F_STRICT)
868+ {
869+ /* Require an exact qualifier match, even for NIL qualifiers. */
870+ nops = aarch64_num_of_operands (inst->opcode);
871+ for (i = 0; i < nops; ++i)
872+ if (inst->operands[i].qualifier != qualifiers[i])
873+ return FALSE;
874+ }
875+
867876 /* Update the qualifiers. */
868877 if (update_p == TRUE)
869878 for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i)