From patchwork Sun May 29 21:36:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 97853 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 A6E30B6F83 for ; Mon, 30 May 2011 07:36:44 +1000 (EST) Received: (qmail 14749 invoked by alias); 29 May 2011 21:36:43 -0000 Received: (qmail 14730 invoked by uid 22791); 29 May 2011 21:36:42 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, TW_ZJ, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-pw0-f47.google.com (HELO mail-pw0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 29 May 2011 21:36:28 +0000 Received: by pwj9 with SMTP id 9so1497382pwj.20 for ; Sun, 29 May 2011 14:36:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.1.4 with SMTP id 4mr666777wfa.210.1306704987590; Sun, 29 May 2011 14:36:27 -0700 (PDT) Received: by 10.142.69.13 with HTTP; Sun, 29 May 2011 14:36:27 -0700 (PDT) Date: Sun, 29 May 2011 23:36:27 +0200 Message-ID: Subject: [PATCH, i386]: Use standard_sse_constant_opcode some more From: Uros Bizjak To: gcc-patches@gcc.gnu.org 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! Attached patch uses standard_sse_constant_opcode in some more places. The patch also adds a couple of missing move patterns to *movdi_internal pattern. 2011-05-29 Uros Bizjak * config/i386/i386.md (*movoi_internal_avx): Use standard_sse_constant_opcode for alternative 0. (*movti_internal_sse): Ditto. (*movti_internal_rex64): Use standard_sse_constant_opcode for alternative 2. (*movdi_internal_rex64): Use standard_sse_constant_opcode for sselog1 type moves. (*movsi_internal): Ditto. (*movdi_internal): Ditto. Add ssecvt type moves. Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu, committed to mainline SVN. Uros. Index: i386.md =================================================================== --- i386.md (revision 174411) +++ i386.md (working copy) @@ -1855,7 +1855,7 @@ switch (which_alternative) { case 0: - return "vxorps\t%0, %0, %0"; + return standard_sse_constant_opcode (insn, operands[1]); case 1: case 2: if (misaligned_operand (operands[0], OImode) @@ -1882,10 +1882,7 @@ case 1: return "#"; case 2: - if (get_attr_mode (insn) == MODE_V4SF) - return "%vxorps\t%0, %d0"; - else - return "%vpxor\t%0, %d0"; + return standard_sse_constant_opcode (insn, operands[1]); case 3: case 4: /* TDmode values are passed as TImode on the stack. Moving them @@ -1945,10 +1942,7 @@ switch (which_alternative) { case 0: - if (get_attr_mode (insn) == MODE_V4SF) - return "%vxorps\t%0, %d0"; - else - return "%vpxor\t%0, %d0"; + return standard_sse_constant_opcode (insn, operands[1]); case 1: case 2: /* TDmode values are passed as TImode on the stack. Moving them @@ -2017,7 +2011,7 @@ return "movq\t{%1, %0|%0, %1}"; case TYPE_SSELOG1: - return "%vpxor\t%0, %d0"; + return standard_sse_constant_opcode (insn, operands[1]); case TYPE_MMX: return "pxor\t%0, %0"; @@ -2065,8 +2059,14 @@ (and (eq_attr "alternative" "2") (eq_attr "type" "imov")) (const_string "8") (const_string "*"))) - (set_attr "prefix_rex" "*,*,*,*,*,*,*,1,*,1,*,*,*,*,*,*,*,*,*") - (set_attr "prefix_data16" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,1,*,*,*") + (set (attr "prefix_rex") + (if_then_else (eq_attr "alternative" "7,9") + (const_string "1") + (const_string "*"))) + (set (attr "prefix_data16") + (if_then_else (eq_attr "alternative" "15") + (const_string "1") + (const_string "*"))) (set (attr "prefix") (if_then_else (eq_attr "alternative" "11,12,13,14,15,16") (const_string "maybe_vex") @@ -2110,34 +2110,72 @@ (define_insn "*movdi_internal" [(set (match_operand:DI 0 "nonimmediate_operand" - "=r ,o ,*y,m*y,*y,*Y2,m ,*Y2,*Y2,*x,m ,*x,*x") + "=r ,o ,*y,m*y,*y,*Y2,m ,*Y2,*Y2,*x,m ,*x,*x,?*Y2,?*Ym") (match_operand:DI 1 "general_operand" - "riFo,riF,C ,*y ,m ,C ,*Y2,*Y2,m ,C ,*x,*x,m "))] + "riFo,riF,C ,*y ,m ,C ,*Y2,*Y2,m ,C ,*x,*x,m ,*Ym ,*Y2"))] "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))" - "@ - # - # - pxor\t%0, %0 - movq\t{%1, %0|%0, %1} - movq\t{%1, %0|%0, %1} - %vpxor\t%0, %d0 - %vmovq\t{%1, %0|%0, %1} - %vmovdqa\t{%1, %0|%0, %1} - %vmovq\t{%1, %0|%0, %1} - xorps\t%0, %0 - movlps\t{%1, %0|%0, %1} - movaps\t{%1, %0|%0, %1} - movlps\t{%1, %0|%0, %1}" +{ + switch (get_attr_type (insn)) + { + case TYPE_SSECVT: + if (SSE_REG_P (operands[0])) + return "movq2dq\t{%1, %0|%0, %1}"; + else + return "movdq2q\t{%1, %0|%0, %1}"; + + case TYPE_SSEMOV: + switch (get_attr_mode (insn)) + { + case MODE_TI: + return "%vmovdqa\t{%1, %0|%0, %1}"; + case MODE_DI: + return "%vmovq\t{%1, %0|%0, %1}"; + case MODE_V4SF: + return "movaps\t{%1, %0|%0, %1}"; + case MODE_V2SF: + return "movlps\t{%1, %0|%0, %1}"; + default: + gcc_unreachable (); + } + + case TYPE_MMXMOV: + return "movq\t{%1, %0|%0, %1}"; + + case TYPE_SSELOG1: + return standard_sse_constant_opcode (insn, operands[1]); + + case TYPE_MMX: + return "pxor\t%0, %0"; + + case TYPE_MULTI: + return "#"; + + default: + gcc_unreachable (); + } +} [(set (attr "isa") (if_then_else (eq_attr "alternative" "9,10,11,12") (const_string "noavx") (const_string "base"))) - (set_attr "type" "*,*,mmx,mmxmov,mmxmov,sselog1,ssemov,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov") + (set (attr "type") + (cond [(eq_attr "alternative" "0,1") + (const_string "multi") + (eq_attr "alternative" "2") + (const_string "mmx") + (eq_attr "alternative" "3,4") + (const_string "mmxmov") + (eq_attr "alternative" "5,9") + (const_string "sselog1") + (eq_attr "alternative" "13,14") + (const_string "ssecvt") + ] + (const_string "ssemov"))) (set (attr "prefix") (if_then_else (eq_attr "alternative" "5,6,7,8") (const_string "maybe_vex") (const_string "orig"))) - (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF")]) + (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF,DI,DI")]) (define_split [(set (match_operand:DI 0 "nonimmediate_operand" "") @@ -2158,9 +2196,7 @@ switch (get_attr_type (insn)) { case TYPE_SSELOG1: - if (get_attr_mode (insn) == MODE_TI) - return "%vpxor\t%0, %d0"; - return "%vxorps\t%0, %d0"; + return standard_sse_constant_opcode (insn, operands[1]); case TYPE_SSEMOV: switch (get_attr_mode (insn))