[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-11-04 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45336

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||jakub at gcc dot gnu.org
 Resolution||FIXED

--- Comment #12 from Jakub Jelinek jakub at gcc dot gnu.org 2010-11-04 
08:26:03 UTC ---
Fixed.


[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-08-20 Thread hjl dot tools at gmail dot com


--- Comment #7 from hjl dot tools at gmail dot com  2010-08-20 16:54 ---
Created an attachment (id=21531)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21531action=view)
A patch

I talked to icc people. They think the return value should be
zero-extended to reflex what hardware does. However, we need to
optimize out sign_extend in:

(insn:TI 9 7 10 (set (reg:SI 0 ax [orig:68 D.6819 ] [68])
(zero_extend:SI (vec_select:QI (reg:V16QI 21 xmm0 [orig:64 x ] [64])
(parallel [
(const_int 4 [0x4])
]
/export/build/gnu/gcc/build-x86_64-linux/gcc/include/smmintrin.h:442 1681
{*sse4_1_pextrb}
 (expr_list:REG_DEAD (reg:V16QI 21 xmm0 [orig:64 x ] [64])
(nil)))

(insn:TI 10 9 18 (set (reg:DI 0 ax [orig:67 D.6819 ] [67])
(sign_extend:DI (reg:SI 0 ax [orig:68 D.6819 ] [68]))) foo.c:3 126
{extendsidi2_rex64}
 (nil))


-- 


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



[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-08-20 Thread jakub at gcc dot gnu dot org


--- Comment #8 from jakub at gcc dot gnu dot org  2010-08-20 20:54 ---
Subject: Bug 45336

Author: jakub
Date: Fri Aug 20 20:54:25 2010
New Revision: 163420

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=163420
Log:
PR target/45336
* config/i386/sse.md (*sse4_1_pextrb): Add SWI48 mode iterator
to cover zero extension into 64-bit register.
(*sse2_pextrw): Likewise.
(*sse4_1_pextrd_zext): New insn.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/sse.md


-- 


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



[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-08-20 Thread hjl at gcc dot gnu dot org


--- Comment #9 from hjl at gcc dot gnu dot org  2010-08-20 20:58 ---
Subject: Bug 45336

Author: hjl
Date: Fri Aug 20 20:57:56 2010
New Revision: 163421

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=163421
Log:
Cast to unsigned short/char first for _mm_extract_epi16/_mm_extract_epi8.

gcc/

2010-08-20  H.J. Lu  hongjiu...@intel.com

PR target/45336
* config/i386/emmintrin.h (_mm_extract_epi16): Cast to unsigned
short first.

* config/i386/smmintrin.h (_mm_extract_epi8): Cast to unsigned
char first.

gcc/testsuite/

2010-08-20  H.J. Lu  hongjiu...@intel.com

PR target/45336
* gcc.target/i386/pr45336-1.c: New.
* gcc.target/i386/pr45336-2.c: Likewise.
* gcc.target/i386/pr45336-3.c: Likewise.
* gcc.target/i386/pr45336-4.c: Likewise.

Added:
trunk/gcc/testsuite/gcc.target/i386/pr45336-1.c
trunk/gcc/testsuite/gcc.target/i386/pr45336-2.c
trunk/gcc/testsuite/gcc.target/i386/pr45336-3.c
trunk/gcc/testsuite/gcc.target/i386/pr45336-4.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/emmintrin.h
trunk/gcc/config/i386/smmintrin.h
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-08-20 Thread tbptbp at gmail dot com


--- Comment #10 from tbptbp at gmail dot com  2010-08-21 00:49 ---
Subject: Re:  pextr{b,w,d}, (worse than) redundant extensions

A quick check vs trunk tells me that not only pextr* are now sane but
about 2% movs*/movz* disappeared altogether (in that particular
binary).
Hat's off.


-- 


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



[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-08-20 Thread hjl dot tools at gmail dot com


--- Comment #11 from hjl dot tools at gmail dot com  2010-08-21 05:21 
---
*** Bug 41323 has been marked as a duplicate of this bug. ***


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||etjq78kl at free dot fr


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



[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-08-19 Thread jakub at gcc dot gnu dot org


--- Comment #1 from jakub at gcc dot gnu dot org  2010-08-19 13:04 ---
Created an attachment (id=21518)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21518action=view)
gcc46-pr45336.patch

If you are complaining about the 2 gradual sign extensions instead of one sign
extension, then here is an untested fix.


-- 


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



[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-08-19 Thread hjl dot tools at gmail dot com


--- Comment #2 from hjl dot tools at gmail dot com  2010-08-19 13:31 ---
Please hold off any changes. I am talking to icc people
about this. I hope to come up with a solution soon.


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||hjl dot tools at gmail dot
   ||com


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



[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-08-19 Thread hjl dot tools at gmail dot com


--- Comment #3 from hjl dot tools at gmail dot com  2010-08-19 13:34 ---
(In reply to comment #1)
 Created an attachment (id=21518)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21518action=view) [edit]
 gcc46-pr45336.patch
 
 If you are complaining about the 2 gradual sign extensions instead of one sign
 extension, then here is an untested fix.
 

This patch is independent of the issue I am working on.


-- 


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



[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-08-19 Thread jakub at gcc dot gnu dot org


--- Comment #4 from jakub at gcc dot gnu dot org  2010-08-19 14:07 ---
Of course, this is a generic patch that can (and does) trigger in other cases.


-- 


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



[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-08-19 Thread jakub at gcc dot gnu dot org


--- Comment #5 from jakub at gcc dot gnu dot org  2010-08-19 17:44 ---
Subject: Bug 45336

Author: jakub
Date: Thu Aug 19 17:43:50 2010
New Revision: 163384

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=163384
Log:
PR target/45336
* simplify-rtx.c (simplify_unary_operation_1): Optimize nested
SIGN_EXTENDs or ZERO_EXTENDs.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/simplify-rtx.c


-- 


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



[Bug target/45336] pextr{b,w,d}, (worse than) redundant extensions

2010-08-19 Thread tbptbp at gmail dot com


--- Comment #6 from tbptbp at gmail dot com  2010-08-19 19:21 ---
Subject: Re:  pextr{b,w,d}, (worse than) redundant extensions

Thank you very much for this neat patch, Jakub.
Alas, in this case, zero extension would be suboptimal and any sign
extension simply wrong: i ask for a 64bit something, pextr{b,w,d}
already zero extends.

What i have trouble understanding is why there is so much inertia
fixing builtins (to match hardware and return, say, an unsigned
byte/short/int) when nobody's supposed to use those builtins but GCC
itself. I bet you could then still have those corresponding intrinsics
sign extend, even if no one's actually doing that, not even ICC.


-- 


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