AArch64: Fix cfinv disassembly issues

This fixes the preferred disassembly for cfinv.  The Armv8.4-a instruction
overlaps with the possible encoding space for msr.  This because msr allows you
to use unallocated encoding space using the general sA_B_cC_cD_E form.

However when an encoding does become allocated then we need to ensure that it's
used as the preferred disassembly.  The problem with cfinv is that its mask has
all bits sets because it has no arguments.

This causes issues for the Alias resolver in gas as it uses the mask to build
alias graph.  In this case it can't do it since it thinks almost everything
would alias with cfinv.  So instead we can only fix this by moving cfinv before
msr.

gas/ChangeLog:

	PR 25403
	* testsuite/gas/aarch64/armv8_4-a.d: Add cfinv.
	* testsuite/gas/aarch64/armv8_4-a.s: Likewise.

opcodes/ChangeLog:

	PR 25403
	* aarch64-tbl.h (struct aarch64_opcode): Re-order cfinv.
	* aarch64-asm-2.c: Regenerate
	* aarch64-dis-2.c: Likewise.
	* aarch64-opc-2.c: Likewise.
This commit is contained in:
Tamar Christina 2020-01-27 10:40:02 +00:00
parent 168f8c6ba0
commit 7568c93bf9
8 changed files with 1304 additions and 1279 deletions

View File

@ -1,3 +1,9 @@
2020-01-27 Tamar Christina <tamar.christina@arm.com>
PR 25403
* testsuite/gas/aarch64/armv8_4-a.d: Add cfinv.
* testsuite/gas/aarch64/armv8_4-a.s: Likewise.
2020-01-22 Maxim Blinov <maxim.blinov@embecosm.com>
* testsuite/gas/riscv/march-ok-s.d: sx is no longer valid and

View File

@ -2202,3 +2202,4 @@ Disassembly of section \.text:
[^:]+:\s+998033fe ldapursw x30, \[sp, #3\]
[^:]+:\s+998523fe ldapursw x30, \[sp, #82\]
[^:]+:\s+9980d3fe ldapursw x30, \[sp, #13\]
[^:]+:\s+d500401f cfinv

View File

@ -144,3 +144,6 @@ func:
gen1reg_iter ldapursw x,", [sp]"
gen3reg_iter ldapursw x,, [x,,,]
gen2reg_iter_offset ldapursw x,,sp
cfinv

View File

@ -1,3 +1,11 @@
2020-01-27 Tamar Christina <tamar.christina@arm.com>
PR 25403
* aarch64-tbl.h (struct aarch64_opcode): Re-order cfinv.
* aarch64-asm-2.c: Regenerate
* aarch64-dis-2.c: Likewise.
* aarch64-opc-2.c: Likewise.
2020-01-21 Jan Beulich <jbeulich@suse.com>
* i386-opc.tbl (sysret): Drop DefaultSize.

View File

@ -426,14 +426,14 @@ aarch64_find_real_opcode (const aarch64_opcode *opcode)
case 1183: /* movz */
value = 1183; /* --> movz. */
break;
case 1234: /* autibsp */
case 1233: /* autibz */
case 1232: /* autiasp */
case 1231: /* autiaz */
case 1230: /* pacibsp */
case 1229: /* pacibz */
case 1228: /* paciasp */
case 1227: /* paciaz */
case 1235: /* autibsp */
case 1234: /* autibz */
case 1233: /* autiasp */
case 1232: /* autiaz */
case 1231: /* pacibsp */
case 1230: /* pacibz */
case 1229: /* paciasp */
case 1228: /* paciaz */
case 1208: /* psb */
case 1207: /* esb */
case 1206: /* autib1716 */
@ -467,125 +467,125 @@ aarch64_find_real_opcode (const aarch64_opcode *opcode)
case 1216: /* sys */
value = 1216; /* --> sys. */
break;
case 2032: /* bic */
case 1282: /* and */
value = 1282; /* --> and. */
case 2033: /* bic */
case 1283: /* and */
value = 1283; /* --> and. */
break;
case 1265: /* mov */
case 1284: /* and */
value = 1284; /* --> and. */
case 1266: /* mov */
case 1285: /* and */
value = 1285; /* --> and. */
break;
case 1269: /* movs */
case 1285: /* ands */
value = 1285; /* --> ands. */
case 1270: /* movs */
case 1286: /* ands */
value = 1286; /* --> ands. */
break;
case 2033: /* cmple */
case 1320: /* cmpge */
value = 1320; /* --> cmpge. */
case 2034: /* cmple */
case 1321: /* cmpge */
value = 1321; /* --> cmpge. */
break;
case 2036: /* cmplt */
case 1323: /* cmpgt */
value = 1323; /* --> cmpgt. */
case 2037: /* cmplt */
case 1324: /* cmpgt */
value = 1324; /* --> cmpgt. */
break;
case 2034: /* cmplo */
case 1325: /* cmphi */
value = 1325; /* --> cmphi. */
case 2035: /* cmplo */
case 1326: /* cmphi */
value = 1326; /* --> cmphi. */
break;
case 2035: /* cmpls */
case 1328: /* cmphs */
value = 1328; /* --> cmphs. */
case 2036: /* cmpls */
case 1329: /* cmphs */
value = 1329; /* --> cmphs. */
break;
case 1262: /* mov */
case 1350: /* cpy */
value = 1350; /* --> cpy. */
break;
case 1264: /* mov */
case 1263: /* mov */
case 1351: /* cpy */
value = 1351; /* --> cpy. */
break;
case 2043: /* fmov */
case 1267: /* mov */
case 1265: /* mov */
case 1352: /* cpy */
value = 1352; /* --> cpy. */
break;
case 1257: /* mov */
case 1364: /* dup */
value = 1364; /* --> dup. */
case 2044: /* fmov */
case 1268: /* mov */
case 1353: /* cpy */
value = 1353; /* --> cpy. */
break;
case 1259: /* mov */
case 1256: /* mov */
case 1258: /* mov */
case 1365: /* dup */
value = 1365; /* --> dup. */
break;
case 2042: /* fmov */
case 1261: /* mov */
case 1260: /* mov */
case 1257: /* mov */
case 1366: /* dup */
value = 1366; /* --> dup. */
break;
case 1260: /* mov */
case 1367: /* dupm */
value = 1367; /* --> dupm. */
case 2043: /* fmov */
case 1262: /* mov */
case 1367: /* dup */
value = 1367; /* --> dup. */
break;
case 2037: /* eon */
case 1369: /* eor */
value = 1369; /* --> eor. */
case 1261: /* mov */
case 1368: /* dupm */
value = 1368; /* --> dupm. */
break;
case 1270: /* not */
case 1371: /* eor */
value = 1371; /* --> eor. */
case 2038: /* eon */
case 1370: /* eor */
value = 1370; /* --> eor. */
break;
case 1271: /* nots */
case 1372: /* eors */
value = 1372; /* --> eors. */
case 1271: /* not */
case 1372: /* eor */
value = 1372; /* --> eor. */
break;
case 2038: /* facle */
case 1377: /* facge */
value = 1377; /* --> facge. */
case 1272: /* nots */
case 1373: /* eors */
value = 1373; /* --> eors. */
break;
case 2039: /* faclt */
case 1378: /* facgt */
value = 1378; /* --> facgt. */
case 2039: /* facle */
case 1378: /* facge */
value = 1378; /* --> facge. */
break;
case 2040: /* fcmle */
case 1391: /* fcmge */
value = 1391; /* --> fcmge. */
case 2040: /* faclt */
case 1379: /* facgt */
value = 1379; /* --> facgt. */
break;
case 2041: /* fcmlt */
case 1393: /* fcmgt */
value = 1393; /* --> fcmgt. */
case 2041: /* fcmle */
case 1392: /* fcmge */
value = 1392; /* --> fcmge. */
break;
case 2042: /* fcmlt */
case 1394: /* fcmgt */
value = 1394; /* --> fcmgt. */
break;
case 1255: /* fmov */
case 1400: /* fcpy */
value = 1400; /* --> fcpy. */
break;
case 1254: /* fmov */
case 1399: /* fcpy */
value = 1399; /* --> fcpy. */
case 1423: /* fdup */
value = 1423; /* --> fdup. */
break;
case 1253: /* fmov */
case 1422: /* fdup */
value = 1422; /* --> fdup. */
break;
case 1255: /* mov */
case 1753: /* orr */
value = 1753; /* --> orr. */
break;
case 2044: /* orn */
case 1256: /* mov */
case 1754: /* orr */
value = 1754; /* --> orr. */
break;
case 1258: /* mov */
case 1756: /* orr */
value = 1756; /* --> orr. */
case 2045: /* orn */
case 1755: /* orr */
value = 1755; /* --> orr. */
break;
case 1268: /* movs */
case 1757: /* orrs */
value = 1757; /* --> orrs. */
case 1259: /* mov */
case 1757: /* orr */
value = 1757; /* --> orr. */
break;
case 1263: /* mov */
case 1819: /* sel */
value = 1819; /* --> sel. */
case 1269: /* movs */
case 1758: /* orrs */
value = 1758; /* --> orrs. */
break;
case 1266: /* mov */
case 1264: /* mov */
case 1820: /* sel */
value = 1820; /* --> sel. */
break;
case 1267: /* mov */
case 1821: /* sel */
value = 1821; /* --> sel. */
break;
default: return NULL;
}

File diff suppressed because it is too large Load Diff

View File

@ -309,17 +309,17 @@ static const unsigned op_enum_table [] =
391,
413,
415,
1258,
1263,
1256,
1255,
1259,
1266,
1268,
1264,
1257,
1256,
1260,
1267,
1269,
1265,
1271,
1270,
1266,
1272,
1271,
131,
};

View File

@ -3866,6 +3866,14 @@ struct aarch64_opcode aarch64_opcode_table[] =
PREDRES_INSN ("cfp", 0xd50b7380, 0xffffffe0, ic_system, OP2 (SYSREG_SR, Rt), QL_SRC_X, F_ALIAS),
PREDRES_INSN ("dvp", 0xd50b73a0, 0xffffffe0, ic_system, OP2 (SYSREG_SR, Rt), QL_SRC_X, F_ALIAS),
PREDRES_INSN ("cpp", 0xd50b73e0, 0xffffffe0, ic_system, OP2 (SYSREG_SR, Rt), QL_SRC_X, F_ALIAS),
/* Armv8.4-a flag setting instruction, However this encoding has an encoding clash with the msr
below it. Usually we can resolve this by setting an alias condition on the flags, however that
depends on the disassembly masks to be able to quickly find the alias. The problem is the
cfinv instruction has no arguments, so all bits are set in the mask. Which means it will
potentially alias with too many instructions and so the tree can't be constructed. As a work
around we just place cfinv before msr. This means the order between these two shouldn't be
changed. */
V8_4_INSN ("cfinv", 0xd500401f, 0xffffffff, ic_system, OP0 (), {}, 0),
CORE_INSN ("msr", 0xd5000000, 0xffe00000, ic_system, 0, OP2 (SYSREG, Rt), QL_SRC_X, F_SYS_WRITE),
CORE_INSN ("sysl",0xd5280000, 0xfff80000, ic_system, 0, OP5 (Rt, UIMM3_OP1, CRn, CRm, UIMM3_OP2), QL_SYSL, 0),
CORE_INSN ("mrs", 0xd5200000, 0xffe00000, ic_system, 0, OP2 (Rt, SYSREG), QL_DST_X, F_SYS_READ),
@ -5043,7 +5051,6 @@ struct aarch64_opcode aarch64_opcode_table[] =
FP16_V8_2_INSN ("fmlal2", 0x6f808000, 0xffc0f400, asimdelem, OP3 (Vd, Vn, Em16), QL_V2FML4S, 0),
FP16_V8_2_INSN ("fmlsl2", 0x6f80c000, 0xffc0f400, asimdelem, OP3 (Vd, Vn, Em16), QL_V2FML4S, 0),
/* System extensions ARMv8.4-a. */
V8_4_INSN ("cfinv", 0xd500401f, 0xffffffff, ic_system, OP0 (), {}, 0),
V8_4_INSN ("rmif", 0xba000400, 0xffe07c10, ic_system, OP3 (Rn, IMM_2, MASK), QL_RMIF, 0),
V8_4_INSN ("setf8", 0x3a00080d, 0xfffffc1f, ic_system, OP1 (Rn), QL_SETF, 0),
V8_4_INSN ("setf16", 0x3a00480d, 0xfffffc1f, ic_system, OP1 (Rn), QL_SETF, 0),