From patchwork Thu Feb 13 23:46:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 320252 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 70B112C007A for ; Fri, 14 Feb 2014 10:47:14 +1100 (EST) 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:from:date:message-id:subject:to:content-type; q= dns; s=default; b=hZ8ukT4/FwHb91pb6d8+FtvHTRqt/JTjsvKC3MXVh/LEJ3 oINcL+5D4OYxyszzA04X+JEPtcOQfJT/X5sWpaAhvVMqbOhCZUKW6z9mrZqTPmaA nd+uzIKcD38ZxWjlMS75ZU2aqis9dNHpXLgDIC1dz4ThEi/op3+AAp8x+qrHM= 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:from:date:message-id:subject:to:content-type; s= default; bh=IuaAHvVYnkccV8ChxGbeUTIDpog=; b=HR2eShCemIfHazLArTm2 kaOjUm+6tJOCk8m/z++SezHm0/s0j0lWVcx30x36kIlUShYhiXGI6qFpnsdziSOz XhPjWI1Yq90bN12QXksbPWunBVBDMyonH1Q0e5bDhOhq16FT/sL1oOErdBirCbiA oOJQoIQsH7ISkUOz34n0slA= Received: (qmail 11723 invoked by alias); 13 Feb 2014 23:47:07 -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 11714 invoked by uid 89); 13 Feb 2014 23:47:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS, URIBL_BLACK autolearn=no version=3.3.2 X-HELO: mail-ig0-f170.google.com Received: from mail-ig0-f170.google.com (HELO mail-ig0-f170.google.com) (209.85.213.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 13 Feb 2014 23:47:04 +0000 Received: by mail-ig0-f170.google.com with SMTP id m12so125498iga.1 for ; Thu, 13 Feb 2014 15:47:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=n2TuIrE2h9VcRJqdO2KuYth93tu8/D0/vK/7zL0F7sI=; b=lOHnYUkG0CrohqL+pfNy/edSpwP0vOeLHDSx7+676ta8hAWVg82ZwF5wTrArCLnnKP cA30cjfXgsq5U4fkzMRTyAeu/ku1Ar+cxp4AGd9HNawZk7rWm4D7YZTIBB1Wsp2J/EL/ /OHuQd4sCcAydm2qj3bldGjoBq79tdV4n3GsHRI7coeDLgnXQvNIDYcaQQlwZLzLDzMW gYFtoDNFYy+eOsaUyEd1pVItd96+m6dh9q4On4VhNHrVj3mBhfV+cVRhD90EmMhkY0Ws hXbQqPOGJvTuuGZ5y+sjgkRBjpdX0cMh0WMt8rFPiTwRZXzoZm3+VfGzWKq1OLID7K1a 39oA== X-Gm-Message-State: ALoCoQmLKUGB+W/indf+sFItV0VsSuIpHkcATqhKpSJpOGxxgu3eKGknME3uphx/mnhxkjwhazOyxep17KTt3DLmTgvMsqXUx3n/D3duXScrU1/oXBALrph3P1b3ADVFCz/zKv34dl9E6cIBlEmqFD5huD/1juySv/ir1QgkM/okZMKOIJFsc9jELTDMTNi6pE4q1IjoMJioyDCI+BZjp9IJ6abbfme6tw== X-Received: by 10.50.137.100 with SMTP id qh4mr6476777igb.4.1392335222598; Thu, 13 Feb 2014 15:47:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.240.3 with HTTP; Thu, 13 Feb 2014 15:46:42 -0800 (PST) From: Roland McGrath Date: Thu, 13 Feb 2014 15:46:42 -0800 Message-ID: Subject: [PATCH] x86: Use ud2 assembly mnemonic when available. To: "gcc-patches@gcc.gnu.org" Non-ancient assemblers support the "ud2" mnemonic, so there is no need to emit the literal opcode as data. OK for trunk and 4.8? Thanks, Roland gcc/ 2014-02-13 Roland McGrath * configure.ac (HAVE_AS_IX86_UD2): New test for 'ud2' mnemonic. * configure: Regenerated. * config.in: Regenerated. * config/i386/i386.md (trap) [HAVE_AS_IX86_UD2]: Use the mnemonic instead of ASM_SHORT. --- a/gcc/config.in +++ b/gcc/config.in @@ -375,6 +375,12 @@ #endif +/* Define if your assembler supports the 'ud2' mnemonic. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_IX86_UD2 +#endif + + /* Define if your assembler supports the lituse_jsrdirect relocation. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_JSRDIRECT_RELOCS --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -17843,7 +17843,13 @@ (define_insn "trap" [(trap_if (const_int 1) (const_int 6))] "" - { return ASM_SHORT "0x0b0f"; } +{ +#ifdef HAVE_AS_IX86_UD2 + return "ud2"; +#else + return ASM_SHORT "0x0b0f"; +#endif +} [(set_attr "length" "2")]) (define_expand "prefetch" --- a/gcc/configure +++ b/gcc/configure @@ -25109,6 +25109,37 @@ $as_echo "#define HAVE_AS_IX86_REP_LOCK_PREFIX 1" >>confdefs.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for ud2 mnemonic" >&5 +$as_echo_n "checking assembler for ud2 mnemonic... " >&6; } +if test "${gcc_cv_as_ix86_ud2+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_ix86_ud2=no + if test x$gcc_cv_as != x; then + $as_echo 'ud2' > 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 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + gcc_cv_as_ix86_ud2=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ix86_ud2" >&5 +$as_echo "$gcc_cv_as_ix86_ud2" >&6; } +if test $gcc_cv_as_ix86_ud2 = yes; then + +$as_echo "#define HAVE_AS_IX86_UD2 1" >>confdefs.h + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for R_386_TLS_GD_PLT reloc" >&5 $as_echo_n "checking assembler for R_386_TLS_GD_PLT reloc... " >&6; } if test "${gcc_cv_as_ix86_tlsgdplt+set}" = set; then : --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3895,6 +3895,12 @@ foo: nop [AC_DEFINE(HAVE_AS_IX86_REP_LOCK_PREFIX, 1, [Define if the assembler supports 'rep , lock '.])]) + gcc_GAS_CHECK_FEATURE([ud2 mnemonic], + gcc_cv_as_ix86_ud2,,, + [ud2],, + [AC_DEFINE(HAVE_AS_IX86_UD2, 1, + [Define if your assembler supports the 'ud2' mnemonic.])]) + gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc], gcc_cv_as_ix86_tlsgdplt,,, [call tls_gd@tlsgdplt],