public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59968] Unused BT patterns
Date: Tue, 28 Jan 2014 16:20:00 -0000	[thread overview]
Message-ID: <bug-59968-4-uNzBCK8KIl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59968-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59968

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to H.J. Lu from comment #0)
> There are some BT patterns in i386 guarded with
> TARGET_USE_BT.  But there are no testcases to show
> if they are used at all.

testsuite/gcc.target/i386/bt-*.c

> Also BT instructions supports memory destination.
> But BT patterns only allow register destination.

bt with a memory operand is slow. The bitpos argument is not limited to operand
size, and is primarily used for locked memory access.

BTW:

$ objdump -d cc1 | grep "bt " | wc -l
1228
>From gcc-bugs-return-441765-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jan 28 16:23:25 2014
Return-Path: <gcc-bugs-return-441765-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10293 invoked by alias); 28 Jan 2014 16:23:25 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 10246 invoked by uid 55); 28 Jan 2014 16:23:21 -0000
From: "hjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59672] Add -m16 support for x86
Date: Tue, 28 Jan 2014 16:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: hjl at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59672-4-Tec5uzMOuQ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59672-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59672-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg02907.txt.bz2
Content-length: 2117

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY672

--- Comment #8 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Tue Jan 28 16:22:45 2014
New Revision: 207196

URL: http://gcc.gnu.org/viewcvs?rev 7196&root=gcc&view=rev
Log:
Add -m16 support for x86

The .code16gcc directive was added to binutils back in 1999:

---
   '.code16gcc' provides experimental support for generating 16-bit code
from gcc, and differs from '.code16' in that 'call', 'ret', 'enter',
'leave', 'push', 'pop', 'pusha', 'popa', 'pushf', and 'popf'
instructions default to 32-bit size.  This is so that the stack pointer
is manipulated in the same way over function calls, allowing access to
function parameters at the same stack offsets as in 32-bit mode.
'.code16gcc' also automatically adds address size prefixes where
necessary to use the 32-bit addressing modes that gcc generates.
---

It encodes 32-bit assembly instructions generated by GCC in 16-bit format
so that GCC can be used to generate 16-bit instructions.  To do that, the
.code16gcc directive must be placed at the very beginning of the assembly
code.  This patch adds -m16 to x86 backend by:

1. Add -m16 and make it mutually exclusive with -m32, -m64 and -mx32.
2. Treat -m16 like -m32 so that --32 is passed to assembler.
3. Output .code16gcc at the very beginning of the assembly code.
4. Turn off 64-bit ISA when -m16 is used.

    PR target/59672
    * config/i386/gnu-user64.h (SPEC_32): Add "m16|" to "m32".
    (SPEC_X32): Likewise.
    (SPEC_64): Likewise.
    * config/i386/i386.c (ix86_option_override_internal): Turn off
    OPTION_MASK_ISA_64BIT, OPTION_MASK_ABI_X32 and OPTION_MASK_ABI_64
    for TARGET_16BIT.
    (x86_file_start): Output .code16gcc for TARGET_16BIT.
    * config/i386/i386.h (TARGET_16BIT): New macro.
    (TARGET_16BIT_P): Likewise.
    * config/i386/i386.opt: Add m16.
    * doc/invoke.texi: Document -m16.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/gnu-user64.h
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.h
    trunk/gcc/config/i386/i386.opt
    trunk/gcc/doc/invoke.texi


  parent reply	other threads:[~2014-01-28 16:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28 14:38 [Bug target/59968] New: " hjl.tools at gmail dot com
2014-01-28 16:12 ` [Bug target/59968] " hjl.tools at gmail dot com
2014-01-28 16:18 ` hjl.tools at gmail dot com
2014-01-28 16:20 ` ubizjak at gmail dot com [this message]
2014-01-28 16:24 ` ubizjak at gmail dot com
2014-01-28 17:48 ` hjl.tools at gmail dot com
2014-01-28 17:59 ` hjl.tools at gmail dot com
2014-01-28 18:16 ` hjl.tools at gmail dot com
2014-01-28 18:21 ` hjl.tools at gmail dot com
2014-01-28 18:22 ` hjl.tools at gmail dot com
2014-01-28 18:44 ` ubizjak at gmail dot com
2014-01-28 18:47 ` ubizjak at gmail dot com
2014-01-28 22:21 ` hjl.tools at gmail dot com
2014-01-29  0:20 ` hjl.tools at gmail dot com
2014-01-29  0:23 ` hjl.tools at gmail dot com
2014-01-29 17:58 ` hjl.tools at gmail dot com
2014-01-29 20:39 ` hjl.tools at gmail dot com
2021-08-15  5:47 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-59968-4-uNzBCK8KIl@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).