From patchwork Tue Jun 15 21:16:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 55799 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]) by ozlabs.org (Postfix) with SMTP id D3F471007D2 for ; Wed, 16 Jun 2010 07:17:02 +1000 (EST) Received: (qmail 26812 invoked by alias); 15 Jun 2010 21:17:00 -0000 Received: (qmail 26797 invoked by uid 22791); 15 Jun 2010 21:16:57 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, TW_ZJ, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-fx0-f47.google.com (HELO mail-fx0-f47.google.com) (209.85.161.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Jun 2010 21:16:53 +0000 Received: by fxm18 with SMTP id 18so268176fxm.20 for ; Tue, 15 Jun 2010 14:16:50 -0700 (PDT) Received: by 10.102.197.36 with SMTP id u36mr2695162muf.105.1276636610465; Tue, 15 Jun 2010 14:16:50 -0700 (PDT) Received: from [93.103.18.160] (93-103-18-160.static.t-2.net [93.103.18.160]) by mx.google.com with ESMTPS id b9sm9016879mug.37.2010.06.15.14.16.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 15 Jun 2010 14:16:49 -0700 (PDT) Subject: [PATCH, i386]: Macroize prefetch patterns From: Uros Bizjak To: gcc-patches@gcc.gnu.org Date: Tue, 15 Jun 2010 23:16:48 +0200 Message-ID: <1276636608.3406.2.camel@localhost> Mime-Version: 1.0 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 Hello! 2010-06-15 Uros Bizjak * config/i386/i386.c (*prefetch_sse_): Macroize insn from *prefetch_sse and *prefetch_sse_rex using P mode iterator. (*prefetch_3dnow_): Ditto from *prefetch_3dnow and *prefetch_3dnow_rex. Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline. Uros. Index: config/i386/i386.md =================================================================== --- config/i386/i386.md (revision 160811) +++ config/i386/i386.md (working copy) @@ -18194,11 +18194,11 @@ operands[1] = const0_rtx; }) -(define_insn "*prefetch_sse" - [(prefetch (match_operand:SI 0 "address_operand" "p") +(define_insn "*prefetch_sse_" + [(prefetch (match_operand:P 0 "address_operand" "p") (const_int 0) (match_operand:SI 1 "const_int_operand" ""))] - "TARGET_PREFETCH_SSE && !TARGET_64BIT" + "TARGET_PREFETCH_SSE" { static const char * const patterns[4] = { "prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0" @@ -18211,34 +18211,15 @@ } [(set_attr "type" "sse") (set_attr "atom_sse_attr" "prefetch") - (set (attr "length_address") (symbol_ref "memory_address_length (operands[0])")) + (set (attr "length_address") + (symbol_ref "memory_address_length (operands[0])")) (set_attr "memory" "none")]) -(define_insn "*prefetch_sse_rex" - [(prefetch (match_operand:DI 0 "address_operand" "p") - (const_int 0) - (match_operand:SI 1 "const_int_operand" ""))] - "TARGET_PREFETCH_SSE && TARGET_64BIT" -{ - static const char * const patterns[4] = { - "prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0" - }; - - int locality = INTVAL (operands[1]); - gcc_assert (locality >= 0 && locality <= 3); - - return patterns[locality]; -} - [(set_attr "type" "sse") - (set_attr "atom_sse_attr" "prefetch") - (set (attr "length_address") (symbol_ref "memory_address_length (operands[0])")) - (set_attr "memory" "none")]) - -(define_insn "*prefetch_3dnow" - [(prefetch (match_operand:SI 0 "address_operand" "p") +(define_insn "*prefetch_3dnow_" + [(prefetch (match_operand:P 0 "address_operand" "p") (match_operand:SI 1 "const_int_operand" "n") (const_int 3))] - "TARGET_3DNOW && !TARGET_64BIT" + "TARGET_3DNOW" { if (INTVAL (operands[1]) == 0) return "prefetch\t%a0"; @@ -18246,24 +18227,10 @@ return "prefetchw\t%a0"; } [(set_attr "type" "mmx") - (set (attr "length_address") (symbol_ref "memory_address_length (operands[0])")) + (set (attr "length_address") + (symbol_ref "memory_address_length (operands[0])")) (set_attr "memory" "none")]) -(define_insn "*prefetch_3dnow_rex" - [(prefetch (match_operand:DI 0 "address_operand" "p") - (match_operand:SI 1 "const_int_operand" "n") - (const_int 3))] - "TARGET_3DNOW && TARGET_64BIT" -{ - if (INTVAL (operands[1]) == 0) - return "prefetch\t%a0"; - else - return "prefetchw\t%a0"; -} - [(set_attr "type" "mmx") - (set (attr "length_address") (symbol_ref "memory_address_length (operands[0])")) - (set_attr "memory" "none")]) - (define_expand "stack_protect_set" [(match_operand 0 "memory_operand" "") (match_operand 1 "memory_operand" "")]