From patchwork Mon Feb 4 15:28:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 2093701 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 4C3E5DFE82 for ; Mon, 4 Feb 2013 16:08:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 397C2E5CE4 for ; Mon, 4 Feb 2013 08:08:28 -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 97C3CE60CE for ; Mon, 4 Feb 2013 07:30:23 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 04 Feb 2013 07:29:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,600,1355126400"; d="scan'208";a="257442434" 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:21 -0800 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Mon, 4 Feb 2013 15:28:11 +0000 Message-Id: <1359991705-5254-77-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 76/90] assembler: Introduce set_instruction_saturate() 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 Also simplify the logic that was setting the saturate bit in the math instruction. Signed-off-by: Damien Lespiau --- assembler/gram.y | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-) diff --git a/assembler/gram.y b/assembler/gram.y index 917bccf..43c34f6 100644 --- a/assembler/gram.y +++ b/assembler/gram.y @@ -100,6 +100,8 @@ static int set_instruction_src1_three_src(struct brw_program_instruction *instr, struct src_operand *src); static int set_instruction_src2_three_src(struct brw_program_instruction *instr, struct src_operand *src); +static void set_instruction_saturate(struct brw_program_instruction *instr, + int saturate); static void set_instruction_options(struct brw_program_instruction *instr, struct options options); static void set_instruction_predicate(struct brw_program_instruction *instr, @@ -996,7 +998,7 @@ unaryinstruction: { memset(&$$, 0, sizeof($$)); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.saturate = $4; + set_instruction_saturate(&$$, $4); $6.width = $5; set_instruction_options(&$$, $8); set_instruction_pred_cond(&$$, &$1, &$3, &@3); @@ -1022,7 +1024,7 @@ binaryinstruction: { memset(&$$, 0, sizeof($$)); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.saturate = $4; + set_instruction_saturate(&$$, $4); set_instruction_options(&$$, $9); set_instruction_pred_cond(&$$, &$1, &$3, &@3); $6.width = $5; @@ -1050,7 +1052,7 @@ binaryaccinstruction: { memset(&$$, 0, sizeof($$)); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.saturate = $4; + set_instruction_saturate(&$$, $4); $6.width = $5; set_instruction_options(&$$, $9); set_instruction_pred_cond(&$$, &$1, &$3, &@3); @@ -1083,7 +1085,7 @@ trinaryinstruction: set_instruction_pred_cond(&$$, &$1, &$3, &@3); set_instruction_opcode(&$$, $2); - GEN(&$$)->header.saturate = $4; + set_instruction_saturate(&$$, $4); GEN(&$$)->header.execution_size = $5; if (set_instruction_dest_three_src(&$$, &$6)) @@ -1485,20 +1487,14 @@ msgtarget: NULL_TOKEN GEN(&$$)->bits2.send_gen5.sfid = BRW_SFID_MATH; GEN(&$$)->bits3.generic_gen5.header_present = 0; GEN(&$$)->bits3.math_gen5.function = $2; - if ($3 == BRW_INSTRUCTION_SATURATE) - GEN(&$$)->bits3.math_gen5.saturate = 1; - else - GEN(&$$)->bits3.math_gen5.saturate = 0; + set_instruction_saturate(&$$, $3); GEN(&$$)->bits3.math_gen5.int_type = $4; GEN(&$$)->bits3.math_gen5.precision = BRW_MATH_PRECISION_FULL; GEN(&$$)->bits3.math_gen5.data_type = $5; } else { GEN(&$$)->bits3.generic.msg_target = BRW_SFID_MATH; GEN(&$$)->bits3.math.function = $2; - if ($3 == BRW_INSTRUCTION_SATURATE) - GEN(&$$)->bits3.math.saturate = 1; - else - GEN(&$$)->bits3.math.saturate = 0; + set_instruction_saturate(&$$, $3); GEN(&$$)->bits3.math.int_type = $4; GEN(&$$)->bits3.math.precision = BRW_MATH_PRECISION_FULL; GEN(&$$)->bits3.math.data_type = $5; @@ -2990,6 +2986,12 @@ static int set_instruction_src2_three_src(struct brw_program_instruction *instr, return 0; } +static void set_instruction_saturate(struct brw_program_instruction *instr, + int saturate) +{ + GEN(instr)->header.saturate = saturate; +} + static void set_instruction_options(struct brw_program_instruction *instr, struct options options) {