From patchwork Mon Jun 29 17:18:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 489358 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9706C140782 for ; Tue, 30 Jun 2015 03:18:35 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=lGWbUGDu; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=X41hEnz0GsAZi7iGCgykdiG9MtpCVHGwrUWgvbU9f6T Os9uCErWA/knT1brDWLUqzGXwg51XpLFFC+lU88ag8DqLP4x8PiXjB4zwHy3t1G9 b+6+7/qb2e7AlCN71q0DAopTy1vtFBRRq39L3S5wlmRW4C0Q9C0cewjf1yeEnb/M = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=NVdq7b2S0gADIrE5kb5KqeMw8VI=; b=lGWbUGDuT6VMoQjvn nW66LXWE39j2FXnL6leQPz+sHvo90EbxN87Nc2iKIP+/NWf+LMiNxlt0cLic5Y0S UMJUdB45MrTO5trjLo8meev6bWBXBmu/ij0z1BoBW/TD9tJ3kxAOcwvyH1D9HsnR TmL14fjTLT9HaBR+BXZowMRv7k= Received: (qmail 48744 invoked by alias); 29 Jun 2015 17:18:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 48734 invoked by uid 89); 29 Jun 2015 17:18:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_20, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oi0-f46.google.com Received: from mail-oi0-f46.google.com (HELO mail-oi0-f46.google.com) (209.85.218.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 29 Jun 2015 17:18:25 +0000 Received: by oigb199 with SMTP id b199so122934457oig.3 for ; Mon, 29 Jun 2015 10:18:23 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.202.203.143 with SMTP id b137mr14246754oig.43.1435598303315; Mon, 29 Jun 2015 10:18:23 -0700 (PDT) Received: by 10.60.147.170 with HTTP; Mon, 29 Jun 2015 10:18:23 -0700 (PDT) Date: Mon, 29 Jun 2015 19:18:23 +0200 Message-ID: Subject: [PATCH, i386] Remove MPX jump insn patterns From: Uros Bizjak To: "gcc-patches@gcc.gnu.org" Cc: =?UTF-8?B?0JjQu9GM0Y8g0K3QvdC60L7QstC40Yc=?= Hello! Attached patch removes special MPX jump insn patterns and extends generic jump insn patterns to handle bnd prefix using existing MPX infrastructure. 2015-06-29 Uros Bizjak * config/i386/i386.md (*jcc_1): Use %! in asm template. Set attribute "length_nobnd" instead of "length". (*jcc_2): Ditto. (jump): Ditto. (*jcc_1_bnd, *jcc_2_bnd, jump_bnd): Remove insn patterns. Patch was tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN. Uros. Index: config/i386/i386.md =================================================================== --- config/i386/i386.md (revision 225123) +++ config/i386/i386.md (working copy) @@ -10948,24 +10948,6 @@ ;; Basic conditional jump instructions. ;; We ignore the overflow flag for signed branch instructions. -(define_insn "*jcc_1_bnd" - [(set (pc) - (if_then_else (match_operator 1 "ix86_comparison_operator" - [(reg FLAGS_REG) (const_int 0)]) - (label_ref (match_operand 0)) - (pc)))] - "TARGET_MPX && ix86_bnd_prefixed_insn_p (insn)" - "bnd %+j%C1\t%l0" - [(set_attr "type" "ibr") - (set_attr "modrm" "0") - (set (attr "length") - (if_then_else (and (ge (minus (match_dup 0) (pc)) - (const_int -126)) - (lt (minus (match_dup 0) (pc)) - (const_int 128))) - (const_int 3) - (const_int 7)))]) - (define_insn "*jcc_1" [(set (pc) (if_then_else (match_operator 1 "ix86_comparison_operator" @@ -10973,35 +10955,18 @@ (label_ref (match_operand 0)) (pc)))] "" - "%+j%C1\t%l0" + "%!%+j%C1\t%l0" [(set_attr "type" "ibr") (set_attr "modrm" "0") - (set (attr "length") - (if_then_else (and (ge (minus (match_dup 0) (pc)) - (const_int -126)) - (lt (minus (match_dup 0) (pc)) - (const_int 128))) - (const_int 2) - (const_int 6)))]) + (set (attr "length_nobnd") + (if_then_else + (and (ge (minus (match_dup 0) (pc)) + (const_int -126)) + (lt (minus (match_dup 0) (pc)) + (const_int 128))) + (const_int 2) + (const_int 6)))]) -(define_insn "*jcc_2_bnd" - [(set (pc) - (if_then_else (match_operator 1 "ix86_comparison_operator" - [(reg FLAGS_REG) (const_int 0)]) - (pc) - (label_ref (match_operand 0))))] - "TARGET_MPX && ix86_bnd_prefixed_insn_p (insn)" - "bnd %+j%c1\t%l0" - [(set_attr "type" "ibr") - (set_attr "modrm" "0") - (set (attr "length") - (if_then_else (and (ge (minus (match_dup 0) (pc)) - (const_int -126)) - (lt (minus (match_dup 0) (pc)) - (const_int 128))) - (const_int 3) - (const_int 7)))]) - (define_insn "*jcc_2" [(set (pc) (if_then_else (match_operator 1 "ix86_comparison_operator" @@ -11009,16 +10974,17 @@ (pc) (label_ref (match_operand 0))))] "" - "%+j%c1\t%l0" + "%!%+j%c1\t%l0" [(set_attr "type" "ibr") (set_attr "modrm" "0") - (set (attr "length") - (if_then_else (and (ge (minus (match_dup 0) (pc)) - (const_int -126)) - (lt (minus (match_dup 0) (pc)) - (const_int 128))) - (const_int 2) - (const_int 6)))]) + (set (attr "length_nobnd") + (if_then_else + (and (ge (minus (match_dup 0) (pc)) + (const_int -126)) + (lt (minus (match_dup 0) (pc)) + (const_int 128))) + (const_int 2) + (const_int 6)))]) ;; In general it is not safe to assume too much about CCmode registers, ;; so simplify-rtx stops when it sees a second one. Under certain @@ -11452,35 +11418,21 @@ ;; Unconditional and other jump instructions -(define_insn "jump_bnd" - [(set (pc) - (label_ref (match_operand 0)))] - "TARGET_MPX && ix86_bnd_prefixed_insn_p (insn)" - "bnd jmp\t%l0" - [(set_attr "type" "ibr") - (set (attr "length") - (if_then_else (and (ge (minus (match_dup 0) (pc)) - (const_int -126)) - (lt (minus (match_dup 0) (pc)) - (const_int 128))) - (const_int 3) - (const_int 6))) - (set_attr "modrm" "0")]) - (define_insn "jump" [(set (pc) (label_ref (match_operand 0)))] "" - "jmp\t%l0" + "%!jmp\t%l0" [(set_attr "type" "ibr") - (set (attr "length") - (if_then_else (and (ge (minus (match_dup 0) (pc)) - (const_int -126)) - (lt (minus (match_dup 0) (pc)) - (const_int 128))) - (const_int 2) - (const_int 5))) - (set_attr "modrm" "0")]) + (set_attr "modrm" "0") + (set (attr "length_nobnd") + (if_then_else + (and (ge (minus (match_dup 0) (pc)) + (const_int -126)) + (lt (minus (match_dup 0) (pc)) + (const_int 128))) + (const_int 2) + (const_int 5)))]) (define_expand "indirect_jump" [(set (pc) (match_operand 0 "indirect_branch_operand"))]