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/66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
Date: Tue, 02 Jun 2015 10:21:00 -0000 [thread overview]
Message-ID: <bug-66369-4-RH7DLPQwYq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66369-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66369
--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
I have looked briefly at this. The compiler actually generates the following:
vpmovmskb %ymm0, %edx # 16 avx2_pmovmskb [length = 4]
testl %edx, %edx # 18 *cmpsi_ccno_1/1 [length = 2]
je .L5 # 19 *jcc_1 [length = 2]
movslq %edx, %rdx # 21 *extendsidi2_rex64/2 [length = 3]
tzcntq %rdx, %rdx # 52 *ctzdi2_falsedep [length = 5]
from:
int _14;
long unsigned int v.1_15;
int _16;
...
_14 = __builtin_ia32_pmovmskb256 (_13);
if (_14 != 0)
goto <bb 5>;
else
goto <bb 6>;
<bb 5>:
v.1_15 = (long unsigned int) _14;
_16 = __builtin_ctzl (v.1_15);
_17 = (long int) _16;
The intrinsic returns "int", and from the above tree dump, the compiler won't
even consider to combine the sign-extension with vpmovmskb.
So, why not:
unsigned int v;
v = (unsigned int) _mm256_movemask_epi8( ... );
if (v != 0)
return (long) __builtin_ctz( v );
>From gcc-bugs-return-487815-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jun 02 10:21:32 2015
Return-Path: <gcc-bugs-return-487815-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 114651 invoked by alias); 2 Jun 2015 10:21:32 -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 114611 invoked by uid 48); 2 Jun 2015 10:21:28 -0000
From: "fxcoudert at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/66377] New: [F95] Wrong-code with equivalenced array in module
Date: Tue, 02 Jun 2015 10:21:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: fxcoudert at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
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 target_milestone
Message-ID: <bug-66377-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: 2015-06/txt/msg00147.txt.bz2
Content-length: 772
https://gcc.gnu.org/bugzilla/show_bug.cgi?idf377
Bug ID: 66377
Summary: [F95] Wrong-code with equivalenced array in module
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: fxcoudert at gcc dot gnu.org
Target Milestone: ---
This code:
module constant
integer :: x(2), x1, x2
equivalence (x(1),x1), (x(2),x2)
end module
program test
use constant
x = (/1, 2/)
call another()
contains
subroutine another()
use constant, only : x1
print *, x1
end subroutine
end program
should output "1", but outputs "0" with all versions of gfortran tested.
next prev parent reply other threads:[~2015-06-02 10:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-01 21:53 [Bug c/66369] New: " marcus.kool at urlfilterdb dot com
2015-06-01 21:57 ` [Bug c/66369] " marcus.kool at urlfilterdb dot com
2015-06-02 9:05 ` [Bug target/66369] " rguenth at gcc dot gnu.org
2015-06-02 10:21 ` ubizjak at gmail dot com [this message]
2015-06-02 11:21 ` marcus.kool at urlfilterdb dot com
2015-06-02 14:51 ` marcus.kool at urlfilterdb dot com
2015-06-03 18:00 ` ubizjak at gmail dot com
2015-06-04 10:06 ` uros at gcc dot gnu.org
2015-06-04 10:11 ` ubizjak at gmail dot com
2015-06-04 17:50 ` marcus.kool at urlfilterdb 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-66369-4-RH7DLPQwYq@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).