public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/34435] New: SSE2 intrinsics - emmintrin with optimisations off and type conversion error
@ 2007-12-11 17:35 lo at meep dot co dot uk
2007-12-12 9:55 ` [Bug target/34435] [4.3 Regression] " rguenth at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: lo at meep dot co dot uk @ 2007-12-11 17:35 UTC (permalink / raw)
To: gcc-bugs
Using snapshot: gcc-4.3-20071109
Problem code follows:
///////
#include <emmintrin.h>
class Vec {
__m128i vec;
public:
Vec(int mm) {
vec = _mm_set1_epi16(mm);
}
operator __m128i() const {
return vec;
}
};
int main() {
_mm_shuffle_epi32(Vec(5), _MM_SHUFFLE(3,3,3,3)); // error
}
///////
This compiles fine with e.g. -O2, but with optimisations off, gcc reports
"error: can't convert value to a vector".
This seems to be because a macro version of _mm_shuffle_epi32 is used when
optimisations are off, and the type conversion from Vec to __mm128i can't
happen for the first parameter.
--
Summary: SSE2 intrinsics - emmintrin with optimisations off and
type conversion error
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lo at meep dot co dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34435
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/34435] [4.3 Regression] SSE2 intrinsics - emmintrin with optimisations off and type conversion error
2007-12-11 17:35 [Bug target/34435] New: SSE2 intrinsics - emmintrin with optimisations off and type conversion error lo at meep dot co dot uk
@ 2007-12-12 9:55 ` rguenth at gcc dot gnu dot org
2007-12-12 20:59 ` mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-12-12 9:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2007-12-12 09:55 -------
Without optimization main() preprocesses to
int main() {
((__m128i)__builtin_ia32_pshufd ((__v4si)Vec(5), (((3) << 6) | ((3) << 4) |
((3) << 2) | (3))));
}
with optimization we get instead
int main() {
_mm_shuffle_epi32(Vec(5), (((3) << 6) | ((3) << 4) | ((3) << 2) | (3)));
}
because with optimization we use an inline function instead of a macro.
Uros - it was you who changed that (and I see it may not be too easy to
make all parties happy here). My suggestion is to force the same "argument"
type by doing
#define _mm_shuffle_epi32(__A, __B) \
((__m128i)__builtin_ia32_pshufd ((__v4si)(__m128i)__A, (int)__B))
instead of
#define _mm_shuffle_epi32(__A, __B) \
((__m128i)__builtin_ia32_pshufd ((__v4si)__A, __B))
to match the prototype of _mm_shuffle_epi32 which reads
static __inline __m128i __attribute__((__always_inline__, __artificial__))
_mm_shuffle_epi32 (__m128i __A, const int __mask)
{
return (__m128i)__builtin_ia32_pshufd ((__v4si)__A, __mask);
}
and adjust all !__OPTIMIZE__ macro variants this way. (at least this makes
this testcase work properly)
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |uros at gcc dot gnu dot org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |rejects-valid
Last reconfirmed|0000-00-00 00:00:00 |2007-12-12 09:55:10
date| |
Summary|SSE2 intrinsics - emmintrin |[4.3 Regression] SSE2
|with optimisations off and |intrinsics - emmintrin with
|type conversion error |optimisations off and type
| |conversion error
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34435
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/34435] [4.3 Regression] SSE2 intrinsics - emmintrin with optimisations off and type conversion error
2007-12-11 17:35 [Bug target/34435] New: SSE2 intrinsics - emmintrin with optimisations off and type conversion error lo at meep dot co dot uk
2007-12-12 9:55 ` [Bug target/34435] [4.3 Regression] " rguenth at gcc dot gnu dot org
@ 2007-12-12 20:59 ` mmitchel at gcc dot gnu dot org
2007-12-12 21:40 ` ubizjak at gmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-12-12 20:59 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34435
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/34435] [4.3 Regression] SSE2 intrinsics - emmintrin with optimisations off and type conversion error
2007-12-11 17:35 [Bug target/34435] New: SSE2 intrinsics - emmintrin with optimisations off and type conversion error lo at meep dot co dot uk
2007-12-12 9:55 ` [Bug target/34435] [4.3 Regression] " rguenth at gcc dot gnu dot org
2007-12-12 20:59 ` mmitchel at gcc dot gnu dot org
@ 2007-12-12 21:40 ` ubizjak at gmail dot com
2007-12-13 18:20 ` ubizjak at gmail dot com
2007-12-13 18:20 ` uros at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2007-12-12 21:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from ubizjak at gmail dot com 2007-12-12 21:39 -------
(In reply to comment #1)
> My suggestion is to force the same "argument"
> type by doing
>
> #define _mm_shuffle_epi32(__A, __B) \
> ((__m128i)__builtin_ia32_pshufd ((__v4si)(__m128i)__A, (int)__B))
>
> and adjust all !__OPTIMIZE__ macro variants this way. (at least this makes
> this testcase work properly)
Thanks for the suggestion, the patch at
http://gcc.gnu.org/ml/gcc-patches/2007-12/msg00560.html implements suggested
approach.
>
--
ubizjak at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |ubizjak at gmail dot com
|dot org |
URL| |http://gcc.gnu.org/ml/gcc-
| |patches/2007-
| |12/msg00560.html
Status|NEW |ASSIGNED
Keywords| |patch
Last reconfirmed|2007-12-12 09:55:10 |2007-12-12 21:39:57
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34435
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/34435] [4.3 Regression] SSE2 intrinsics - emmintrin with optimisations off and type conversion error
2007-12-11 17:35 [Bug target/34435] New: SSE2 intrinsics - emmintrin with optimisations off and type conversion error lo at meep dot co dot uk
` (3 preceding siblings ...)
2007-12-13 18:20 ` ubizjak at gmail dot com
@ 2007-12-13 18:20 ` uros at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: uros at gcc dot gnu dot org @ 2007-12-13 18:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from uros at gcc dot gnu dot org 2007-12-13 18:19 -------
Subject: Bug 34435
Author: uros
Date: Thu Dec 13 18:19:38 2007
New Revision: 130904
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130904
Log:
PR target/34435
* config/i386/emmintrin.h (_mm_shuffle_pd, _mm_extract_epi16,
_mm_insert_epi16, _mm_shufflehi_epi16, _mm_shufflelo_epi16,
_mm_shuffle_epi32): Cast non-constant input values to either __m64,
__m128, __m128i or __m128d in a macro version of the intrinsic.
Cast constant input values to int.
* config/i386/ammintrin.h (_mm_extracti_si64, _mm_inserti_si64): Ditto.
* config/i386/bmmintrin.h (_mm_roti_epi8, _mm_roti_epi16,
_mm_roti_epi32, _mm_roti_epi64): Ditto.
* config/i386/smmintrin.h (_mm_blend_epi16, _mm_blend_ps, _mm_blend_pd,
_mm_dp_ps, _mm_dp_pd, _mm_insert_ps, _mm_extract_ps, _mm_insert_epi8,
_mm_insert_epi32, _mm_insert_epi64, _mm_extract_epi8, mm_extract_epi32,
_mm_extract_epi64, _mm_mpsadbw_epu8, _mm_cmpistrm, _mm_cmpistri,
_mm_cmpestrm, _mm_cmpestri, _mm_cmpistra, _mm_cmpistrc, _mm_cmpistro,
_mm_cmpistrs, _mm_cmpistrz, _mm_cmpestra, _mm_cmpestrc, _mm_cmpestro,
_mm_cmpestrs, _mm_cmpestrz): Ditto.
* config/i386/tmmintrin.h (_mm_alignr_epi8, _mm_alignr_pi8): Ditto.
* config/i386/xmmintrin.h (_mm_shuffle_ps, _mm_extract_pi16, _m_pextrw,
_mm_insert_pi16, _m_pinsrw, _mm_shuffle_pi16, _m_pshufw): Ditto.
* config/i386/mmintrin-common.h (_mm_round_pd, _mm_round_sd,
_mm_round_ps, _mm_round_ss): Ditto.
testsuite/ChangeLog:
PR target/34435
* g++.dg/other/pr34435.C: New testcase.
Added:
trunk/gcc/testsuite/g++.dg/other/pr34435.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/ammintrin.h
trunk/gcc/config/i386/bmmintrin.h
trunk/gcc/config/i386/emmintrin.h
trunk/gcc/config/i386/mmintrin-common.h
trunk/gcc/config/i386/smmintrin.h
trunk/gcc/config/i386/tmmintrin.h
trunk/gcc/config/i386/xmmintrin.h
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34435
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/34435] [4.3 Regression] SSE2 intrinsics - emmintrin with optimisations off and type conversion error
2007-12-11 17:35 [Bug target/34435] New: SSE2 intrinsics - emmintrin with optimisations off and type conversion error lo at meep dot co dot uk
` (2 preceding siblings ...)
2007-12-12 21:40 ` ubizjak at gmail dot com
@ 2007-12-13 18:20 ` ubizjak at gmail dot com
2007-12-13 18:20 ` uros at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2007-12-13 18:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from ubizjak at gmail dot com 2007-12-13 18:20 -------
Fixed.
--
ubizjak at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34435
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-12-13 18:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-11 17:35 [Bug target/34435] New: SSE2 intrinsics - emmintrin with optimisations off and type conversion error lo at meep dot co dot uk
2007-12-12 9:55 ` [Bug target/34435] [4.3 Regression] " rguenth at gcc dot gnu dot org
2007-12-12 20:59 ` mmitchel at gcc dot gnu dot org
2007-12-12 21:40 ` ubizjak at gmail dot com
2007-12-13 18:20 ` ubizjak at gmail dot com
2007-12-13 18:20 ` uros at gcc dot gnu dot org
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).