From d3b536811f6ea780e5029d9b03ada717dd2ba51d Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Mon, 29 May 2023 01:04:57 +0300 Subject: [PATCH] ppc: support minmax aliases --- gas/testsuite/gas/ppc/minmax.d | 56 +++++++++++++++++++++++++++++----- gas/testsuite/gas/ppc/minmax.s | 52 +++++++++++++++++++++++++++++-- opcodes/ppc-opc.c | 24 +++++++++++++++ 3 files changed, 122 insertions(+), 10 deletions(-) diff --git a/gas/testsuite/gas/ppc/minmax.d b/gas/testsuite/gas/ppc/minmax.d index 24146d2eea0..90e3381cda0 100644 --- a/gas/testsuite/gas/ppc/minmax.d +++ b/gas/testsuite/gas/ppc/minmax.d @@ -6,11 +6,51 @@ Disassembly of section \.text: 0+ <\.text>: -.*:\s+(4f e0 00 06|06 00 e0 4f)\s+minmax\s+r31,r0,r0,0 -.*:\s+(4c 1f 00 06|06 00 1f 4c)\s+minmax\s+r0,r31,r0,0 -.*:\s+(4c 00 f8 06|06 f8 00 4c)\s+minmax\s+r0,r0,r31,0 -.*:\s+(4c 00 07 06|06 07 00 4c)\s+minmax\s+r0,r0,r0,7 -.*:\s+(4f e0 00 07|07 00 e0 4f)\s+minmax.\s+r31,r0,r0,0 -.*:\s+(4c 1f 00 07|07 00 1f 4c)\s+minmax.\s+r0,r31,r0,0 -.*:\s+(4c 00 f8 07|07 f8 00 4c)\s+minmax.\s+r0,r0,r31,0 -.*:\s+(4c 00 07 07|07 07 00 4c)\s+minmax.\s+r0,r0,r0,7 +.*:\s+(4f e0 00 06|06 00 e0 4f)\s+minu\s+r31,r0,r0 +.*:\s+(4c 1f 00 06|06 00 1f 4c)\s+minu\s+r0,r31,r0 +.*:\s+(4c 00 f8 06|06 f8 00 4c)\s+minu\s+r0,r0,r31 +.*:\s+(4f e0 00 07|07 00 e0 4f)\s+minu.\s+r31,r0,r0 +.*:\s+(4c 1f 00 07|07 00 1f 4c)\s+minu.\s+r0,r31,r0 +.*:\s+(4c 00 f8 07|07 f8 00 4c)\s+minu.\s+r0,r0,r31 +.*:\s+(4f e0 01 06|06 01 e0 4f)\s+maxu\s+r31,r0,r0 +.*:\s+(4c 1f 01 06|06 01 1f 4c)\s+maxu\s+r0,r31,r0 +.*:\s+(4c 00 f9 06|06 f9 00 4c)\s+maxu\s+r0,r0,r31 +.*:\s+(4f e0 01 07|07 01 e0 4f)\s+maxu.\s+r31,r0,r0 +.*:\s+(4c 1f 01 07|07 01 1f 4c)\s+maxu.\s+r0,r31,r0 +.*:\s+(4c 00 f9 07|07 f9 00 4c)\s+maxu.\s+r0,r0,r31 +.*:\s+(4f e0 02 06|06 02 e0 4f)\s+mins\s+r31,r0,r0 +.*:\s+(4c 1f 02 06|06 02 1f 4c)\s+mins\s+r0,r31,r0 +.*:\s+(4c 00 fa 06|06 fa 00 4c)\s+mins\s+r0,r0,r31 +.*:\s+(4f e0 02 07|07 02 e0 4f)\s+mins.\s+r31,r0,r0 +.*:\s+(4c 1f 02 07|07 02 1f 4c)\s+mins.\s+r0,r31,r0 +.*:\s+(4c 00 fa 07|07 fa 00 4c)\s+mins.\s+r0,r0,r31 +.*:\s+(4f e0 03 06|06 03 e0 4f)\s+maxs\s+r31,r0,r0 +.*:\s+(4c 1f 03 06|06 03 1f 4c)\s+maxs\s+r0,r31,r0 +.*:\s+(4c 00 fb 06|06 fb 00 4c)\s+maxs\s+r0,r0,r31 +.*:\s+(4f e0 03 07|07 03 e0 4f)\s+maxs.\s+r31,r0,r0 +.*:\s+(4c 1f 03 07|07 03 1f 4c)\s+maxs.\s+r0,r31,r0 +.*:\s+(4c 00 fb 07|07 fb 00 4c)\s+maxs.\s+r0,r0,r31 +.*:\s+(4f e0 04 06|06 04 e0 4f)\s+minuw\s+r31,r0,r0 +.*:\s+(4c 1f 04 06|06 04 1f 4c)\s+minuw\s+r0,r31,r0 +.*:\s+(4c 00 fc 06|06 fc 00 4c)\s+minuw\s+r0,r0,r31 +.*:\s+(4f e0 04 07|07 04 e0 4f)\s+minuw.\s+r31,r0,r0 +.*:\s+(4c 1f 04 07|07 04 1f 4c)\s+minuw.\s+r0,r31,r0 +.*:\s+(4c 00 fc 07|07 fc 00 4c)\s+minuw.\s+r0,r0,r31 +.*:\s+(4f e0 05 06|06 05 e0 4f)\s+maxuw\s+r31,r0,r0 +.*:\s+(4c 1f 05 06|06 05 1f 4c)\s+maxuw\s+r0,r31,r0 +.*:\s+(4c 00 fd 06|06 fd 00 4c)\s+maxuw\s+r0,r0,r31 +.*:\s+(4f e0 05 07|07 05 e0 4f)\s+maxuw.\s+r31,r0,r0 +.*:\s+(4c 1f 05 07|07 05 1f 4c)\s+maxuw.\s+r0,r31,r0 +.*:\s+(4c 00 fd 07|07 fd 00 4c)\s+maxuw.\s+r0,r0,r31 +.*:\s+(4f e0 06 06|06 06 e0 4f)\s+minsw\s+r31,r0,r0 +.*:\s+(4c 1f 06 06|06 06 1f 4c)\s+minsw\s+r0,r31,r0 +.*:\s+(4c 00 fe 06|06 fe 00 4c)\s+minsw\s+r0,r0,r31 +.*:\s+(4f e0 06 07|07 06 e0 4f)\s+minsw.\s+r31,r0,r0 +.*:\s+(4c 1f 06 07|07 06 1f 4c)\s+minsw.\s+r0,r31,r0 +.*:\s+(4c 00 fe 07|07 fe 00 4c)\s+minsw.\s+r0,r0,r31 +.*:\s+(4f e0 07 06|06 07 e0 4f)\s+maxsw\s+r31,r0,r0 +.*:\s+(4c 1f 07 06|06 07 1f 4c)\s+maxsw\s+r0,r31,r0 +.*:\s+(4c 00 ff 06|06 ff 00 4c)\s+maxsw\s+r0,r0,r31 +.*:\s+(4f e0 07 07|07 07 e0 4f)\s+maxsw.\s+r31,r0,r0 +.*:\s+(4c 1f 07 07|07 07 1f 4c)\s+maxsw.\s+r0,r31,r0 +.*:\s+(4c 00 ff 07|07 ff 00 4c)\s+maxsw.\s+r0,r0,r31 diff --git a/gas/testsuite/gas/ppc/minmax.s b/gas/testsuite/gas/ppc/minmax.s index 211a317e3d4..3ccc9a1f177 100644 --- a/gas/testsuite/gas/ppc/minmax.s +++ b/gas/testsuite/gas/ppc/minmax.s @@ -1,8 +1,56 @@ +# minu minmax 31,0,0,0 minmax 0,31,0,0 minmax 0,0,31,0 -minmax 0,0,0,7 minmax. 31,0,0,0 minmax. 0,31,0,0 minmax. 0,0,31,0 -minmax. 0,0,0,7 +# maxu +minmax 31,0,0,1 +minmax 0,31,0,1 +minmax 0,0,31,1 +minmax. 31,0,0,1 +minmax. 0,31,0,1 +minmax. 0,0,31,1 +# mins +minmax 31,0,0,2 +minmax 0,31,0,2 +minmax 0,0,31,2 +minmax. 31,0,0,2 +minmax. 0,31,0,2 +minmax. 0,0,31,2 +# maxs +minmax 31,0,0,3 +minmax 0,31,0,3 +minmax 0,0,31,3 +minmax. 31,0,0,3 +minmax. 0,31,0,3 +minmax. 0,0,31,3 +# minuw +minmax 31,0,0,4 +minmax 0,31,0,4 +minmax 0,0,31,4 +minmax. 31,0,0,4 +minmax. 0,31,0,4 +minmax. 0,0,31,4 +# maxuw +minmax 31,0,0,5 +minmax 0,31,0,5 +minmax 0,0,31,5 +minmax. 31,0,0,5 +minmax. 0,31,0,5 +minmax. 0,0,31,5 +# minsw +minmax 31,0,0,6 +minmax 0,31,0,6 +minmax 0,0,31,6 +minmax. 31,0,0,6 +minmax. 0,31,0,6 +minmax. 0,0,31,6 +# maxsw +minmax 31,0,0,7 +minmax 0,31,0,7 +minmax 0,0,31,7 +minmax. 31,0,0,7 +minmax. 0,31,0,7 +minmax. 0,0,31,7 diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c index aa7fe549357..63d44ed56f2 100644 --- a/opcodes/ppc-opc.c +++ b/opcodes/ppc-opc.c @@ -4977,6 +4977,14 @@ const unsigned int num_powerpc_operands = ARRAY_SIZE (powerpc_operands); | (((uint64_t)(rc)) & 1)) #define MM_MASK MM (0x3f, 0x3f, 0x1) +/* An MM form instruction with explicit . */ +#define MMXMMM(op, xop, mmm, rc) \ + (OP (op) \ + | ((((uint64_t)(mmm)) & 0x7) << 8) \ + | ((((uint64_t)(xop)) & 0x3f) << 1) \ + | (((uint64_t)(rc)) & 1)) +#define MMXMMM_MASK MMXMMM (0x3f, 0x3f, 0x7, 0x1) + /* The BO encodings used in extended conditional branch mnemonics. */ #define BODNZF (0x0) #define BODNZFP (0x1) @@ -6469,6 +6477,22 @@ const struct powerpc_opcode powerpc_opcodes[] = { {"addpcis", DX(19,2), DX_MASK, POWER9, PPCVLE, {RT, DXD}}, {"subpcis", DX(19,2), DX_MASK, POWER9, PPCVLE|EXT, {RT, NDXD}}, +{"minu", MMXMMM(19,3,0,0), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"minu.", MMXMMM(19,3,0,1), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"maxu", MMXMMM(19,3,1,0), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"maxu.", MMXMMM(19,3,1,1), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"mins", MMXMMM(19,3,2,0), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"mins.", MMXMMM(19,3,2,1), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"maxs", MMXMMM(19,3,3,0), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"maxs.", MMXMMM(19,3,3,1), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"minuw", MMXMMM(19,3,4,0), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"minuw.", MMXMMM(19,3,4,1), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"maxuw", MMXMMM(19,3,5,0), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"maxuw.", MMXMMM(19,3,5,1), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"minsw", MMXMMM(19,3,6,0), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"minsw.", MMXMMM(19,3,6,1), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"maxsw", MMXMMM(19,3,7,0), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, +{"maxsw.", MMXMMM(19,3,7,1), MMXMMM_MASK, SFFS, PPCVLE, {RT, RA, RB}}, {"minmax", MM(19,3,0), MM_MASK, SFFS, PPCVLE, {RT, RA, RB, MMM}}, {"minmax.", MM(19,3,1), MM_MASK, SFFS, PPCVLE, {RT, RA, RB, MMM}}, -- 2.30.2