public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kretz at kde dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/57156] miscompilation of call to _mm_cmpeq_epi8(a, a) or _mm_comtrue_epu8(a, a) with uninitialized a
Date: Thu, 11 Jul 2013 09:25:00 -0000	[thread overview]
Message-ID: <bug-57156-4-mEk06G7Zcq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57156-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Matthias Kretz <kretz at kde dot org> ---
I just noticed the following in the Intel Optimization Reference Manual
(Version 028 from July 2013), section 2.2 "Sandy Bridge":
2.2.3.1 Renamer
[...]
There is another dependency breaking idiom - the "ones idiom".
• CMPEQ XMM1, XMM1; "ones idiom" set all elements to all "ones"
In this case, the micro-op must execute, however, since it is known that
regardless of the input data the output data is always "all ones" the micro-op
dependency upon its sources does not exist as with the zero idiom and it can
execute as soon as it finds a free execution port.

Therefore I think it makes sense if this feature is exposed somehow. Right now,
according to what you said, it is impossible to make use of this feature when
programming with intrinsics.
I see two solutions right now:
1. Let the cmpeq intrinsic reflect this special behavior: i.e. if the two
inputs are the same variable, this behaves like a function without input.
2. Provide a new intrinsic/builtin analogous to _mm_setzero_* /
_mm256_setzero_*
>From gcc-bugs-return-426138-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jul 11 09:45:34 2013
Return-Path: <gcc-bugs-return-426138-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 16943 invoked by alias); 11 Jul 2013 09:45:34 -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 16927 invoked by uid 48); 11 Jul 2013 09:45:31 -0000
From: "bardeau at iram dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/57881] New: Pre-processor pre-includes breaks preprocessing of non C/C++ code
Date: Thu, 11 Jul 2013 09:45:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: preprocessor
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: bardeau at iram dot fr
X-Bugzilla-Status: UNCONFIRMED
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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-57881-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: 2013-07/txt/msg00645.txt.bz2
Content-length: 1721

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

            Bug ID: 57881
           Summary: Pre-processor pre-includes breaks preprocessing of non
                    C/C++ code
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bardeau at iram dot fr

According to http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Standards.html the C
pre-precessor includes implicitly the file /usr/include/stdc-predef.h to any
pre-processed source.

For non C/C++ code, we are told here http://gcc.gnu.org/gcc-4.8/porting_to.html
to add the option -P. This just won't work in real use cases. People using the
C preprocessor on non C/C++ code combine the following options:
-P: no line markers added,
-C: do not discard comments. In non-C/C++ code, false-positive blocks of /* */
could be deleted out.
-traditional-cpp: preserve blank lines. In non C/C++ code, blank lines may be
relevant. At least, it preserves line numbering.

Obviously, pre-preprocessing of non-C/C++ code with "cpp -P -C -traditional"
adds now C comments and blank lines. Its certainly a feature, not a bug, but:

1) you should modify the comment in http://gcc.gnu.org/gcc-4.8/porting_to.html:
"For non C/C++ code, use the pre-processor flag -ffreestanding" for full
compatibility with possible options.

2) the option "-ffreestanding" has no meaning for non C/C++ code. You should
consider adding an option for preprocessing of non C/C++ sources, which gathers
the options "-P -C -traditional -ffreestanding", plus any future change needed.

Thanks for having a look into this!


  parent reply	other threads:[~2013-07-11  9:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03  9:09 [Bug target/57156] New: " kretz at kde dot org
2013-05-03  9:10 ` [Bug target/57156] " kretz at kde dot org
2013-05-03  9:15 ` kretz at kde dot org
2013-05-03  9:16 ` pinskia at gcc dot gnu.org
2013-05-03  9:38 ` kretz at kde dot org
2013-05-03  9:56 ` kretz at kde dot org
2013-05-03 12:27 ` rguenth at gcc dot gnu.org
2013-05-03 14:13 ` [Bug tree-optimization/57156] " kretz at kde dot org
2013-07-11  9:25 ` kretz at kde dot org [this message]
2013-10-30 21:12 ` law at redhat 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-57156-4-mEk06G7Zcq@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).