From patchwork Mon Feb 4 15:28:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 2093661 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id C1327DFE82 for ; Mon, 4 Feb 2013 16:06:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD1EEE5F54 for ; Mon, 4 Feb 2013 08:06:51 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 253E7E5FFE for ; Mon, 4 Feb 2013 07:30:21 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 04 Feb 2013 07:29:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,600,1355126400"; d="scan'208";a="257442401" Received: from unknown (HELO dyon.amr.corp.intel.com) ([10.255.12.132]) by orsmga001.jf.intel.com with ESMTP; 04 Feb 2013 07:30:13 -0800 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Mon, 4 Feb 2013 15:28:07 +0000 Message-Id: <1359991705-5254-73-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 1.7.7.5 In-Reply-To: <1359991705-5254-1-git-send-email-damien.lespiau@intel.com> References: <1359991705-5254-1-git-send-email-damien.lespiau@intel.com> Subject: [Intel-gfx] [PATCH 72/90] assembler: Unify adding options to the header X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Right now we have duplicated code for when the option is the last in the list or not. Put that code in a common function. Interestingly it appears that both sides haven't been kept in sync and that EOT and ACCWRCTRL had limitations on where they had to be in the option list. It's fixed now! Signed-off-by: Damien Lespiau --- assembler/gram.y | 121 ++++++++++++++++++++---------------------------------- 1 files changed, 45 insertions(+), 76 deletions(-) diff --git a/assembler/gram.y b/assembler/gram.y index 23d7cfb..99376a2 100644 --- a/assembler/gram.y +++ b/assembler/gram.y @@ -526,6 +526,49 @@ static void resolve_subnr(struct brw_reg *reg) YYERROR; \ } while(0) +static void add_option(struct brw_program_instruction *insn, int option) +{ + switch (option) { + case ALIGN1: + GEN(insn)->header.access_mode = BRW_ALIGN_1; + break; + case ALIGN16: + GEN(insn)->header.access_mode = BRW_ALIGN_16; + break; + case SECHALF: + GEN(insn)->header.compression_control |= BRW_COMPRESSION_2NDHALF; + break; + case COMPR: + if (!IS_GENp(6)) + GEN(insn)->header.compression_control |= BRW_COMPRESSION_COMPRESSED; + break; + case SWITCH: + GEN(insn)->header.thread_control |= BRW_THREAD_SWITCH; + break; + case ATOMIC: + GEN(insn)->header.thread_control |= BRW_THREAD_ATOMIC; + break; + case NODDCHK: + GEN(insn)->header.dependency_control |= BRW_DEPENDENCY_NOTCHECKED; + break; + case NODDCLR: + GEN(insn)->header.dependency_control |= BRW_DEPENDENCY_NOTCLEARED; + break; + case MASK_DISABLE: + GEN(insn)->header.mask_control = BRW_MASK_DISABLE; + break; + case BREAKPOINT: + GEN(insn)->header.debug_control = BRW_DEBUG_BREAKPOINT; + break; + case ACCWRCTRL: + GEN(insn)->header.acc_wr_control = BRW_ACCUMULATOR_WRITE_ENABLE; + break; + case EOT: + GEN(insn)->bits3.generic.end_of_thread = 1; + break; + } +} + } %% @@ -2723,86 +2766,12 @@ instoptions: /* empty */ instoption_list:instoption_list COMMA instoption { $$ = $1; - switch ($3) { - case ALIGN1: - GEN(&$$)->header.access_mode = BRW_ALIGN_1; - break; - case ALIGN16: - GEN(&$$)->header.access_mode = BRW_ALIGN_16; - break; - case SECHALF: - GEN(&$$)->header.compression_control |= BRW_COMPRESSION_2NDHALF; - break; - case COMPR: - if (!IS_GENp(6)) { - GEN(&$$)->header.compression_control |= - BRW_COMPRESSION_COMPRESSED; - } - break; - case SWITCH: - GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; - break; - case ATOMIC: - GEN(&$$)->header.thread_control |= BRW_THREAD_ATOMIC; - break; - case NODDCHK: - GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCHECKED; - break; - case NODDCLR: - GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCLEARED; - break; - case MASK_DISABLE: - GEN(&$$)->header.mask_control = BRW_MASK_DISABLE; - break; - case BREAKPOINT: - GEN(&$$)->header.debug_control = BRW_DEBUG_BREAKPOINT; - break; - case ACCWRCTRL: - GEN(&$$)->header.acc_wr_control = BRW_ACCUMULATOR_WRITE_ENABLE; - } + add_option(&$$, $3); } | instoption_list instoption { $$ = $1; - switch ($2) { - case ALIGN1: - GEN(&$$)->header.access_mode = BRW_ALIGN_1; - break; - case ALIGN16: - GEN(&$$)->header.access_mode = BRW_ALIGN_16; - break; - case SECHALF: - GEN(&$$)->header.compression_control |= BRW_COMPRESSION_2NDHALF; - break; - case COMPR: - if (!IS_GENp(6)) { - GEN(&$$)->header.compression_control |= - BRW_COMPRESSION_COMPRESSED; - } - break; - case SWITCH: - GEN(&$$)->header.thread_control |= BRW_THREAD_SWITCH; - break; - case ATOMIC: - GEN(&$$)->header.thread_control |= BRW_THREAD_ATOMIC; - break; - case NODDCHK: - GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCHECKED; - break; - case NODDCLR: - GEN(&$$)->header.dependency_control |= BRW_DEPENDENCY_NOTCLEARED; - break; - case MASK_DISABLE: - GEN(&$$)->header.mask_control = BRW_MASK_DISABLE; - break; - case BREAKPOINT: - GEN(&$$)->header.debug_control = BRW_DEBUG_BREAKPOINT; - break; - case EOT: - /* XXX: EOT shouldn't be an instoption, I don't think */ - GEN(&$$)->bits3.generic.end_of_thread = 1; - break; - } + add_option(&$$, $2); } | /* empty, header defaults to zeroes. */ {