public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/62664] New: MMX set intrinsics
@ 2014-09-01 22:38 g.peterhoff.home at talkplus dot de
  2014-09-01 23:22 ` [Bug target/62664] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: g.peterhoff.home at talkplus dot de @ 2014-09-01 22:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62664
           Summary: MMX set intrinsics
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: g.peterhoff.home at talkplus dot de

Hello,
the set/set1-mmx intrinsics do not work with optimizations on Windows. The
code:

typedef union
{
    __m64    m;
    int32_t    e[2];
} ZZ;

int main()
{
    srand(time(nullptr));

    int32_t    r=rand()%100;
    double    d; // or float; integer works
    ZZ    z;

    z.m=_mm_set1_pi32(r); // or other _mm_setX_piXX with correct ZZ.e
    d=z.e[0];
    std::cout<<z.e[0]<<std::endl<<d<<std::endl<<d<<std::endl<<d<<std::endl<<d;

    return 0;
}

result (eg):
81
nan
-81
81
81

Without optimizations it is correct. I have tested with
Win 8.0
  cygwin/32 gcc 4.8.3
  mingw/32 gcc 4.8.1
  mingw/64 gcc 4.8.1
Suse 12.3/64 gcc 4.7 -> working properly


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/62664] MMX set intrinsics
  2014-09-01 22:38 [Bug other/62664] New: MMX set intrinsics g.peterhoff.home at talkplus dot de
@ 2014-09-01 23:22 ` pinskia at gcc dot gnu.org
  2014-09-02  0:12 ` g.peterhoff.home at talkplus dot de
  2014-09-02  2:36 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-09-01 23:22 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|other                       |target

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think you forgot to clear the MMX state.  MMX and FP share the same register
set and need to be cleared before going from MMX to FP.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/62664] MMX set intrinsics
  2014-09-01 22:38 [Bug other/62664] New: MMX set intrinsics g.peterhoff.home at talkplus dot de
  2014-09-01 23:22 ` [Bug target/62664] " pinskia at gcc dot gnu.org
@ 2014-09-02  0:12 ` g.peterhoff.home at talkplus dot de
  2014-09-02  2:36 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: g.peterhoff.home at talkplus dot de @ 2014-09-02  0:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from g.peterhoff.home at talkplus dot de ---
Sorry, I mean
typedef union
{
    __m64 m;
    __m128i s;
    int32_t e [4];
ZZ};


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/62664] MMX set intrinsics
  2014-09-01 22:38 [Bug other/62664] New: MMX set intrinsics g.peterhoff.home at talkplus dot de
  2014-09-01 23:22 ` [Bug target/62664] " pinskia at gcc dot gnu.org
  2014-09-02  0:12 ` g.peterhoff.home at talkplus dot de
@ 2014-09-02  2:36 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-09-02  2:36 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
You need to use _mm_empty ().

Read http://msdn.microsoft.com/en-us/library/ays9ef83(v=vs.90).aspx on why.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-02  2:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-01 22:38 [Bug other/62664] New: MMX set intrinsics g.peterhoff.home at talkplus dot de
2014-09-01 23:22 ` [Bug target/62664] " pinskia at gcc dot gnu.org
2014-09-02  0:12 ` g.peterhoff.home at talkplus dot de
2014-09-02  2:36 ` pinskia at gcc dot gnu.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).