public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/66703] [4.9/5/6] gcc.target/i386/readeflags-1.c aborts on -march=i586 or on -miamcu
Date: Sat, 04 Jul 2015 14:24:00 -0000	[thread overview]
Message-ID: <bug-66703-4-H3XJsjZQax@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66703-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66703

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
We have

unsigned int
readeflags_test (unsigned int a, unsigned int b)
{
  unsigned x = (a == b);
  return __builtin_ia32_readeflags_u32 ();
}

For

unsigned x = (a == b);

-march=i586 generates:



;; _3 = a_1(D) == b_2(D);

(insn 5 4 6 (set (reg:SI 90)
        (mem/c:SI (reg/f:SI 81 virtual-incoming-args) [0 a+0 S4 A32])) y.i:4 -1
     (nil))

(insn 6 5 7 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 90)
            (mem/c:SI (plus:SI (reg/f:SI 81 virtual-incoming-args)
                    (const_int 4 [0x4])) [0 b+0 S4 A32]))) y.i:4 -1
     (nil))

(insn 7 6 0 (set (reg:QI 87 [ D.1413 ])
        (eq:QI (reg:CCZ 17 flags)
            (const_int 0 [0]))) y.i:4 -1
     (nil))

;; x_4 = (unsigned int) _3;

(insn 8 7 9 (parallel [
            (set (reg:SI 91)
                (zero_extend:SI (reg:QI 87 [ D.1413 ])))
            (clobber (reg:CC 17 flags))
        ]) y.i:4 -1
     (nil))

(insn 9 8 0 (set (mem/c:SI (plus:SI (reg/f:SI 82 virtual-stack-vars)
                (const_int -4 [0xfffffffffffffffc])) [0 x+0 S4 A32])
        (reg:SI 91)) y.i:4 -1
     (nil))

EFLAGS register is clobbered and __builtin_ia32_readeflags_u32
returns clobbered value.  So the testcase is expected to fail
if zero-extend bool to unsigned int clobbers EFLAGS register.  Since
we have

/* X86_TUNE_ZERO_EXTEND_WITH_AND: Use AND instruction instead
   of mozbl/movwl.  */  
DEF_TUNE (X86_TUNE_ZERO_EXTEND_WITH_AND, "zero_extend_with_and",
          m_486 | m_PENT)

This test should fail with -march=i486, -march=i586 or -miamcu.


  reply	other threads:[~2015-07-04 14:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 12:01 [Bug target/66703] New: [4.9] gcc.target/i386/readeflags-1.c aborts on -march=i586 julia.koval at intel dot com
2015-07-04 14:24 ` hjl.tools at gmail dot com [this message]
2015-07-07  9:18 ` [Bug target/66703] [4.9/5/6] gcc.target/i386/readeflags-1.c aborts on -march=i586 or on -miamcu julia.koval at intel dot com
2015-07-07 14:48 ` hjl.tools at gmail dot com
2015-07-10  8:49 ` ubizjak at gmail dot com
2015-07-10 12:43 ` hjl.tools at gmail dot com
2015-07-10 15:33 ` uros at gcc dot gnu.org
2015-07-17 16:31 ` uros at gcc dot gnu.org
2015-07-17 18:46 ` uros at gcc dot gnu.org
2015-07-17 18:53 ` ubizjak at gmail dot com

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-66703-4-H3XJsjZQax@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).