From patchwork Fri Oct 13 07:28:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Frager X-Patchwork-Id: 733192 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1330683wrv; Fri, 13 Oct 2023 00:29:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXXkqgjtgP8PJgkq9kya848nkzVrz74FVp3tnlEjNRBenb8GHALdKYhalStzGroOtdhwab X-Received: by 2002:ac8:7e81:0:b0:418:1ce4:72ae with SMTP id w1-20020ac87e81000000b004181ce472aemr31672302qtj.54.1697182154777; Fri, 13 Oct 2023 00:29:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697182154; cv=pass; d=google.com; s=arc-20160816; b=cT3oYezhSfVwbPW9LOxUi00ad/N2r4o4Mw+mH00kMcPoCX4iE0NfETZQ7xgmYC7BkR wTAXwW4UA1TyIGI45fnm2bmhuX3r0ivV82igY0x1vDSKa0LiJSAqd19echjTTOCKjW3y 4EaTvCDGW0VcyCCH/RDGsiu1x2BMyFmm4yUEzfDIXAhEUx8HkcCqpdiB/EjJKoNCUqO4 ijhLCikI3soYoY6kJWsBHx1ISp401jDrA9Xl2dHb5WTL41ug9LwNBA+g7eU42PqiGMgv pQ9cVdL0+Ca4m3NQP8/X6xMTVS4t+yf1MROyBS/tPoqykDMC9X5VG+XOFqbkjoA8geVE Hl6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=7+ttSv467/pr1lrUXF96jJHoz+Mx8Rztme5q4qKGqA8=; fh=VJdOi4UYf8NUzv5HawqGoczQY9wdGPsDGNqBKKba1+k=; b=na57lFiff5fjnGq3z7TxuCcVDd17JjI7NKHIA1uaqwpk+oRsL+vrjEF6DMEVwrAfK8 pXekhTE6igqkVVa34FoYvCixMloqYDHrbh9UUmt9HyTOlPdUwF3jCpPLB0T7y4v/IlNW 0BQO8VU4t95JuvPeOF85zO2bGQvji8WjMn8VFj89CMQfAJRZbDt7ZFClzmK8rUEAt+Pv 2YuuQQl9MpXE04LtebeCgh3AqKbf6tudDSmTHw4qRrE/rRoAdXi38TjPmC4/yngiZM7U 6T85NxQK0m9slYcqds8Hma7Eoyu7WIDv94YfQalTRkE31kB6OI8KWm1WyzIhBACAa76m eKKg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4CxfSZMO; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of binutils-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n7-20020ac85b47000000b0041981f6b2e5si838113qtw.566.2023.10.13.00.29.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 00:29:14 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4CxfSZMO; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of binutils-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6B24A3857722 for ; Fri, 13 Oct 2023 07:29:14 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by sourceware.org (Postfix) with ESMTPS id E4B1D38582B7 for ; Fri, 13 Oct 2023 07:29:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E4B1D38582B7 Authentication-Results: sourceware.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EornI4dxeN8UAswbrzDTlqB0c8VpQd4hm8+oR+XMNx/KQy75c6615CGjBxA7iLF4fWV98AU6m9XK0dPVJhzGnBmrE+mq0/apLI7TzfJ2RulcI5jtVh+zBRiqBCWTuuzNbrm+Z3684HR3wnX92n3vtS8XKAjcynY5mIbeqsvliRoS4pTu4jAEkURQlPrD2oEcobc9h/5SrqseJl6r5bLub0dU26QiTKhvg8vSfoZ1t5REMD8W3e8RI+ZFe87iUZlX02Cn4wrbkLOHLTc/pIrG/PtWqzg5G00MLjiFI6w5oTZHMNSINoHNmYKO4wSvKWG7+zjtNtNZclGZ5qiZk8P2FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7+ttSv467/pr1lrUXF96jJHoz+Mx8Rztme5q4qKGqA8=; b=SSmO8oopn+HqiCHa089QT7LFr0jhLu3YMuqXFR8WinLHABTf2Gp6CkqMM4kUPoKrX4yYTXp9rWlNFii6ag+pSAyTEakwPJStxiI3etCpPqfmZnBfTil0I2Aw3IIz4hYaK8xFcnKzJw1bkjaoIgcGy4A28Xasn7GA1ekrjR+Qpo//3XfcT/cFw7YRURrNMVlYCDS51ZuIjt7gIPnaZg4kuUhPGQH2QQt2o1wgB8hKrghUn0QxuenYwUu9jQhzCMeRdMvVZv7RBezl+eAVVH9NUAeMMcNdYQuVv9uEmmP/UYvf1ZmWOZ930x743ph0RplkdBhcWPI9A7ih8PGCqHqa6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7+ttSv467/pr1lrUXF96jJHoz+Mx8Rztme5q4qKGqA8=; b=4CxfSZMOVW1Nl/HprZb6/tAXYDWu2jIHTVPFS+AJFl4G8tEdSJcv5F1p12Y5KlXuVJBg/+weH0ilJZ+bAC9tjM59KMEWPc/YyxB4MsMDJbvDfW0UdaQl3yL/IjK7JtWBwodSHsHaWcLf7EwIc4+0r0zF7PZ2EBnfLXm5srqJVNk= Received: from CY5P221CA0117.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:1f::11) by MN2PR12MB4455.namprd12.prod.outlook.com (2603:10b6:208:265::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Fri, 13 Oct 2023 07:29:02 +0000 Received: from CY4PEPF0000EE3D.namprd03.prod.outlook.com (2603:10b6:930:1f:cafe::cc) by CY5P221CA0117.outlook.office365.com (2603:10b6:930:1f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend Transport; Fri, 13 Oct 2023 07:29:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE3D.mail.protection.outlook.com (10.167.242.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 07:29:01 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 13 Oct 2023 02:29:01 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 13 Oct 2023 02:29:01 -0500 Received: from xirengwts09.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Fri, 13 Oct 2023 02:28:59 -0500 From: Neal Frager To: CC: , , , , , , , , , , , , Neal Frager Subject: [PATCH v6 1/2] opcodes: microblaze: Add new bit-field instructions Date: Fri, 13 Oct 2023 08:28:55 +0100 Message-ID: <20231013072856.638728-1-neal.frager@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE3D:EE_|MN2PR12MB4455:EE_ X-MS-Office365-Filtering-Correlation-Id: a8823656-47bf-44ff-7ea1-08dbcbbe12a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C79bd3/yceVreJYnCn+/rJD3jOwgDbVZhI9IS7rE8umNiOEXxvnzf7m3hDb2rCPcJsufiM1C19Aj7II0hnjMiPyEhpqib/8TDYtr8CgnkkB7ed1ML25dwupaXwbM+u6krKojbXpOEsePIHr2WnbpWHMtV+El/zn81JVwcEpJBQnBdl7hMgd/LSJBq8aoiMMnw3ry0XVdKcT7NngJj3aAwcj050h2R4xo/Rwfb5QPkiydVMNiUwShoUth99SCD9TJcTJor5Dz5gIPXu2A8iz1QsbPfywsxAwZDi+H9Q85ZUsfZXQHFLpcNdB/+1B8TCS5Ge0BhmV+lNb2y9UKXWcG5gu9Y9WqnE1sig+DDG/aKfITkg69KIHSeRQBtEsTg1g1qn+o93Sd8KQKt0/X8ml/aRjUFbX576op/PHWprqclLgB4GX9vcLOKjuECMKXAcaM3FDAIbWi3gTCp3UtuzPjWSFf94JimK5xhU+Mx1PkvkJpkHeYHAuqC7/7uIhJoqGAyW2vgGfInekchKqRkn0IyIRoIB+iLrmIoamuMsnfvXFRYxT1s2yjaT22XxSim0Ze25TriI/fOxSPwtFaHJiK9HLkxQ2yZjWYP1j4/b/2LpCJqIBGFszrvb67UWFp59CQ2K0mlLUC0zHW+GAtcfWHQMIZtHO/USZ+OfKfcO9xQoui+0GVfwOlpXKwU6IgQqocEyhipWxSIO5ZcO2GONPV5CrzG4TNTvdYuSa6nrybzHONAY43ySyRxxzU/6hD49eQ3BRxLBmQo/v6DTJ5jY0gKw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(39860400002)(346002)(396003)(376002)(136003)(230922051799003)(1800799009)(186009)(64100799003)(82310400011)(451199024)(46966006)(40470700004)(36840700001)(6666004)(966005)(6916009)(478600001)(70206006)(70586007)(54906003)(2616005)(336012)(426003)(316002)(81166007)(4326008)(8936002)(8676002)(41300700001)(5660300002)(44832011)(36756003)(2906002)(86362001)(36860700001)(26005)(47076005)(356005)(83380400001)(82740400003)(1076003)(40460700003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 07:29:01.8696 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8823656-47bf-44ff-7ea1-08dbcbbe12a0 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE3D.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4455 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patch=linaro.org@sourceware.org This patches adds new bsefi and bsifi instructions. BSEFI- The instruction shall extract a bit field from a register and place it right-adjusted in the destination register. The other bits in the destination register shall be set to zero. BSIFI- The instruction shall insert a right-adjusted bit field from a register at another position in the destination register. The rest of the bits in the destination register shall be unchanged. Further documentation of these instructions can be found here: https://docs.xilinx.com/v/u/en-US/ug984-vivado-microblaze-ref With version 6 of the patch, no new relocation types are added as this was unnecessary for adding the bsefi and bsifi instructions. By removing any changes to relocation, there are no longer any regressions to the binutils testsuite. Both before this patch and after lead to the following testsuite results with the following binutils configure command: ./configure --disable-nls --disable-gdb --disable-gdbserver \ --disable-gprofng --disable-libbacktrace \ --disable-libdecnumber --disable-readline \ --disable-sim --enable-obsolete --enable-plugins \ --build=powerpc64le-linux --target=microblaze-xilinx-elf === binutils Summary === # of expected passes 220 # of expected failures 2 # of untested testcases 17 # of unsupported tests 14 === gas Summary === # of expected passes 272 # of unexpected failures 1 # of expected failures 1 # of unsupported tests 8 === ld Summary === # of expected passes 379 # of unexpected failures 4 # of expected failures 13 # of untested testcases 26 # of unsupported tests 217 === libctf Summary === # of expected passes 5 # of unsupported tests 3 === libsframe Summary === # of expected passes 57 Signed-off-by: nagaraju Signed-off-by: Ibai Erkiaga Signed-off-by: Neal Frager --- V1->V2: -corrected relocation values for the linker V2->V3: - fixed build issue for 32-bit hosts - added test cases for bsefi and bsifi instructions V3->V4: - fixed GNU coding standard issues V4->V5: - fixed a remaining line of code > 80 chars V5->V6: - removed unnecessary relocation changes --- gas/config/tc-microblaze.c | 83 +++++++++++++++++++++++++++++++++++++- opcodes/microblaze-dis.c | 23 +++++++++++ opcodes/microblaze-opc.h | 11 ++++- opcodes/microblaze-opcm.h | 6 ++- 4 files changed, 120 insertions(+), 3 deletions(-) diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c index d900a9e1d05..1703e95c452 100644 --- a/gas/config/tc-microblaze.c +++ b/gas/config/tc-microblaze.c @@ -915,7 +915,7 @@ md_assemble (char * str) unsigned reg2; unsigned reg3; unsigned isize; - unsigned int immed = 0, temp; + unsigned int immed = 0, immed2 = 0, temp; expressionS exp; char name[20]; @@ -1177,6 +1177,87 @@ md_assemble (char * str) inst |= (immed << IMM_LOW) & IMM5_MASK; break; + case INST_TYPE_RD_R1_IMMW_IMMS: + if (strcmp (op_end, "")) + op_end = parse_reg (op_end + 1, ®1); /* Get rd. */ + else + { + as_fatal (_("Error in statement syntax")); + reg1 = 0; + } + + if (strcmp (op_end, "")) + op_end = parse_reg (op_end + 1, ®2); /* Get r1. */ + else + { + as_fatal (_("Error in statement syntax")); + reg2 = 0; + } + + /* Check for spl registers. */ + if (check_spl_reg (®1)) + as_fatal (_("Cannot use special register with this instruction")); + if (check_spl_reg (®2)) + as_fatal (_("Cannot use special register with this instruction")); + + /* Width immediate value. */ + if (strcmp (op_end, "")) + op_end = parse_imm (op_end + 1, &exp, MIN_IMM_WIDTH, MAX_IMM_WIDTH); + else + as_fatal (_("Error in statement syntax")); + + if (exp.X_op != O_constant) + { + as_warn (_( + "Symbol used as immediate width value for bit field instruction")); + immed = 1; + } + else + immed = exp.X_add_number; + + if (opcode->instr == bsefi && immed > 31) + as_fatal (_("Width value must be less than 32")); + + /* Shift immediate value. */ + if (strcmp (op_end, "")) + op_end = parse_imm (op_end + 1, &exp, MIN_IMM, MAX_IMM); + else + as_fatal (_("Error in statement syntax")); + + if (exp.X_op != O_constant) + { + as_warn (_( + "Symbol used as immediate shift value for bit field instruction")); + immed2 = 0; + } + else + { + output = frag_more (isize); + immed2 = exp.X_add_number; + } + + if (immed2 != (immed2 % 32)) + { + as_warn (_("Shift value greater than 32. using ")); + immed2 = immed2 % 32; + } + + /* Check combined value. */ + if (immed + immed2 > 32) + as_fatal (_("Width value + shift value must not be greater than 32")); + + inst |= (reg1 << RD_LOW) & RD_MASK; + inst |= (reg2 << RA_LOW) & RA_MASK; + + if (opcode->instr == bsefi) + inst |= (immed & IMM5_MASK) << IMM_WIDTH_LOW; /* bsefi */ + else + inst |= ((immed + immed2 - 1) & IMM5_MASK) + << IMM_WIDTH_LOW; /* bsifi */ + + inst |= (immed2 << IMM_LOW) & IMM5_MASK; + break; + case INST_TYPE_R1_R2: if (strcmp (op_end, "")) op_end = parse_reg (op_end + 1, ®1); /* Get r1. */ diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c index 12981abfea1..b2d3f19337c 100644 --- a/opcodes/microblaze-dis.c +++ b/opcodes/microblaze-dis.c @@ -90,6 +90,21 @@ get_field_imm5_mbar (struct string_buf *buf, long instr) return p; } +static char * +get_field_immw (struct string_buf *buf, long instr) +{ + char *p = strbuf (buf); + + if (instr & 0x00004000) + sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) + >> IMM_WIDTH_LOW))); /* bsefi */ + else + sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> + IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> + IMM_LOW) + 1)); /* bsifi */ + return p; +} + static char * get_field_rfsl (struct string_buf *buf, long instr) { @@ -427,6 +442,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) /* For mbar 16 or sleep insn. */ case INST_TYPE_NONE: break; + /* For bit field insns. */ + case INST_TYPE_RD_R1_IMMW_IMMS: + print_func (stream, "\t%s, %s, %s, %s", + get_field_rd (&buf, inst), + get_field_r1 (&buf, inst), + get_field_immw (&buf, inst), + get_field_imm5 (&buf, inst)); + break; /* For tuqula instruction */ case INST_TYPE_RD: print_func (stream, "\t%s", get_field_rd (&buf, inst)); diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h index 7398e9e246a..19bbbdaf68e 100644 --- a/opcodes/microblaze-opc.h +++ b/opcodes/microblaze-opc.h @@ -59,6 +59,9 @@ /* For mbar. */ #define INST_TYPE_IMM5 20 +/* For bsefi and bsifi */ +#define INST_TYPE_RD_R1_IMMW_IMMS 21 + #define INST_TYPE_NONE 25 @@ -90,6 +93,7 @@ #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */ #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */ #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */ +#define OPCODE_MASK_H32B 0xFC00C000 /* High 6 bits and bit 16, 17. */ #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */ #define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */ #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */ @@ -102,7 +106,7 @@ #define DELAY_SLOT 1 #define NO_DELAY_SLOT 0 -#define MAX_OPCODES 300 +#define MAX_OPCODES 291 const struct op_code_struct { @@ -159,6 +163,8 @@ const struct op_code_struct {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst }, {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst }, {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst }, + {"bsefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst }, + {"bsifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst }, {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst }, {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst }, {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst }, @@ -438,5 +444,8 @@ char pvr_register_prefix[] = "rpvr"; #define MIN_IMM5 ((int) 0x00000000) #define MAX_IMM5 ((int) 0x0000001f) +#define MIN_IMM_WIDTH ((int) 0x00000001) +#define MAX_IMM_WIDTH ((int) 0x00000020) + #endif /* MICROBLAZE_OPC */ diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h index c91b002d951..3c4f8948c76 100644 --- a/opcodes/microblaze-opcm.h +++ b/opcodes/microblaze-opcm.h @@ -29,7 +29,7 @@ enum microblaze_instr addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, mulh, mulhu, mulhsu, swapb, swaph, idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput, - ncget, ncput, muli, bslli, bsrai, bsrli, mului, + ncget, ncput, muli, bslli, bsrai, bsrli, bsefi, bsifi, mului, /* 'or/and/xor' are C++ keywords. */ microblaze_or, microblaze_and, microblaze_xor, andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, @@ -130,6 +130,7 @@ enum microblaze_instr_type #define RB_LOW 11 /* Low bit for RB. */ #define IMM_LOW 0 /* Low bit for immediate. */ #define IMM_MBAR 21 /* low bit for mbar instruction. */ +#define IMM_WIDTH_LOW 6 /* Low bit for immediate width */ #define RD_MASK 0x03E00000 #define RA_MASK 0x001F0000 @@ -142,6 +143,9 @@ enum microblaze_instr_type /* Imm mask for mbar. */ #define IMM5_MBAR_MASK 0x03E00000 +/* Imm mask for extract/insert width. */ +#define IMM5_WIDTH_MASK 0x000007C0 + /* FSL imm mask for get, put instructions. */ #define RFSL_MASK 0x000000F