From patchwork Fri Jun 22 22:00:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 166679 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 014D8B6FA0 for ; Sat, 23 Jun 2012 08:00:52 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1341007253; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:MIME-Version:Received:In-Reply-To:References:From:Date: Message-ID:Subject:To:Cc:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=1vnGBdfODR6qn7goZjvECPovVf0=; b=UVGMaLvinhz0opx yMrynrLwBXIdBOUjrIKthR1uTcmcD7yvGYp880AYMCojIkw+BPOkfYQUt3JZohL4 3+0NiR3RhkBmBiZDFEkQ/5PH0tSxvahnDgklqKnUzP1Jm2KUgCsSMfALthuElUxe mqkAkkmcQuGkngCy4UVjJn4dBiK4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:MIME-Version:Received:In-Reply-To:References:From:Date:Message-ID:Subject:To:Cc:Content-Type:X-System-Of-Record:X-Gm-Message-State:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=v6HYUOZn+FgU2S5yKI0ZA0ltKdzmMuGOn3KFJYtzIytRfMinlnVbMruITsubvR 73J1OxypGMmrAj57aCkrt1yY2L7M3QNTKegW0ugpGJto1Uw+OqluJ8qi+qYjBz7t nK7EZFuEaMCam1XrE4CmhEVTG9Fz+8gVFZ6I1Q6Yxza04=; Received: (qmail 4386 invoked by alias); 22 Jun 2012 22:00:43 -0000 Received: (qmail 4369 invoked by uid 22791); 22 Jun 2012 22:00:41 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_ZC, T_RP_MATCHES_RCVD, URIBL_BLACK X-Spam-Check-By: sourceware.org Received: from mail-qa0-f47.google.com (HELO mail-qa0-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 22 Jun 2012 22:00:28 +0000 Received: by qabg1 with SMTP id g1so622462qab.20 for ; Fri, 22 Jun 2012 15:00:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=OGMtsZOLPSpuZ39aBfFbUewZqPjdroBqX1kxIenTGb8=; b=U/CSItC7Zbk1Wffs/7/GuS31HnOZEgRn9CHy8OfEwQS2FvaTWoNYc587AgN79Da+OI lNF4MY3Qlc5YFBavGifLnKsd87EU/pPZiQnEOys1yKN24gS3JM6bzYk8M27bvex3Yw5H u3IEarxHz23LUpM99P9i+JyeNfWwXhqFA3Rl5e+VRP1m1XXHvYW9zu6XyK54ZI9TwEUd ie71tewmb5Sy5ZACXX/yKd1RC4MIjJAeX72kCQo6MiSFxoI+G3NW13XXDGO4Y2b8lqgc Hs7xqq8IzHuddA2QzUa9ICv/89vzBNBcqsI6UnJebvUC4c5mZT85B5eZ7rtu1T3TZ4eJ jmCg== Received: by 10.224.78.195 with SMTP id m3mr9485902qak.1.1340402427516; Fri, 22 Jun 2012 15:00:27 -0700 (PDT) Received: by 10.224.78.195 with SMTP id m3mr9485886qak.1.1340402427385; Fri, 22 Jun 2012 15:00:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.185.3 with HTTP; Fri, 22 Jun 2012 15:00:07 -0700 (PDT) In-Reply-To: References: From: Roland McGrath Date: Fri, 22 Jun 2012 15:00:07 -0700 Message-ID: Subject: Re: [off list] Re: [PATCH] x86: use 'rep bsf' syntax when assembler supports it To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org X-System-Of-Record: true X-Gm-Message-State: ALoCoQn38eKXLgKC11F9swHoMcth0X+3tiTTNq6M6zaCcBy9TPba8i4LxKFz4MwxNR83BfFxuuRFXLfvFBXok4Q0eDdzmK1ppBe19EQOtI1yfUhI+zd9A1VbAwG0t2tzskT5/VYu0gtls+0/KQiCSm59vzdUajNCzl7VVx3Y79COekffCHpV6pmqNpqMUn2OAyGL4a8SEJpw 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 Here is an alternative patch that just changes the configure test controlling %; so it will elide the ; only for an assembler that also accepts 'rep bsf', 'rep bsr', and 'rep ret', and just uses %; for these cases too. You'll need to have built binutils from its trunk within the last five minutes or so to have an assembler that passes the test now. Thanks, Roland gcc/ 2012-06-22 Roland McGrath * configure.ac (HAVE_AS_IX86_REP_LOCK_PREFIX): Also require that the assembler accept 'rep bsf ...', 'rep bsr ...', and 'rep ret'. * configure: Regenerated. * config/i386/i386.md (simple_return_internal_long): Use %; (ctz2): Likewise. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 879b87b..16056c1 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -11902,7 +11902,7 @@ [(simple_return) (unspec [(const_int 0)] UNSPEC_REP)] "reload_completed" - "rep\;ret" + "rep%; ret" [(set_attr "length" "2") (set_attr "atom_unit" "jeu") (set_attr "length_immediate" "0") @@ -12234,8 +12234,8 @@ else if (optimize_function_for_size_p (cfun)) ; else if (TARGET_GENERIC) - /* tzcnt expands to rep;bsf and we can use it even if !TARGET_BMI. */ - return "rep; bsf{}\t{%1, %0|%0, %1}"; + /* tzcnt expands to 'rep bsf' and we can use it even if !TARGET_BMI. */ + return "rep%; bsf{}\t{%1, %0|%0, %1}"; return "bsf{}\t{%1, %0|%0, %1}"; } diff --git a/gcc/configure b/gcc/configure index 1fdf0af..5e8107f 100755 --- a/gcc/configure +++ b/gcc/configure @@ -24791,7 +24791,10 @@ else if test x$gcc_cv_as != x; then $as_echo 'rep movsl lock addl %edi, (%eax,%esi) - lock orl $0, (%esp)' > conftest.s + lock orl $0, (%esp) + rep bsf %ecx, %eax + rep bsr %ecx, %eax + rep ret' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 @@ -28698,4 +28701,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - diff --git a/gcc/configure.ac b/gcc/configure.ac index 22dab55..428a21a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3642,7 +3642,10 @@ foo: nop gcc_cv_as_ix86_rep_lock_prefix,,, [rep movsl lock addl %edi, (%eax,%esi) - lock orl $0, (%esp)],, + lock orl $0, (%esp) + rep bsf %ecx, %eax + rep bsr %ecx, %eax + rep ret],, [AC_DEFINE(HAVE_AS_IX86_REP_LOCK_PREFIX, 1, [Define if the assembler supports 'rep , lock '.])]) @@ -5163,4 +5166,3 @@ done ], [subdirs='$subdirs']) AC_OUTPUT -