public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "yuri at tsoft dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/25500] REGREGRESSION: SSE2 vectorized code is many times slower on 4.x.x than on 3.4.4
Date: Tue, 20 Dec 2005 05:34:00 -0000	[thread overview]
Message-ID: <20051220053447.14543.qmail@sourceware.org> (raw)
In-Reply-To: <bug-25500-6649@http.gcc.gnu.org/bugzilla/>



------- Comment #1 from yuri at tsoft dot com  2005-12-20 05:34 -------
actually it's the defect in this case: result is not used.
But runtimes are very different in any case.
44.9s on 4.x.x vs. 0m2.371s on 3.4.4

--- begin corrected testcase -----------------------------------
#include <iostream>
using namespace std;

typedef float __v2df __attribute__ ((__vector_size__ (16)));
typedef __v2df __m128;

static __inline __m128 _mm_sub_pd (__m128 __A, __m128 __B) { return
(__m128)__builtin_ia32_subps ((__v2df)__A, (__v2df)__B); }
static __inline __m128 _mm_add_pd (__m128 __A, __m128 __B) { return
(__m128)__builtin_ia32_addps ((__v2df)__A, (__v2df)__B); }
static __inline __m128 _mm_setr_ps (float __Z, float __Y, float __X, float __W)
{ return __extension__ (__m128)(__v2df){ __Z, __Y, __X, __W }; }

struct FF {
  __m128 d;

  __inline FF() { }
  __inline FF(__m128 new_d) : d(new_d) { }
  __inline FF(float f) : d(_mm_setr_ps(f, f, f, f)) { }

  __inline FF operator+(FF other) { return (FF(_mm_add_pd(d,other.d))); }
  __inline FF operator-(FF other) { return (FF(_mm_sub_pd(d,other.d))); }
};

float f[1024*1024];

    union U {
      __m128 m;
      float f[4];
    };

int main() {
  int i;

  FF gtotal(0.f);
  for (i = 0; i < 1024*1024; i++) { f[i] = 1.f/(1024*1024 + 10 - i); }

  FF total(0.f);

  for (int rpt = 0; rpt < 1000; rpt++) {
    FF p1(0.f), p2(0.), c;

    __m128 *pf = (__m128*)f;
    for (i = 0; i < 1024*1024/4; i++) {
      FF c(*pf++);

      total = total + c - p2 + p1;

      p1 = p2;
      p2 = c;
    }
    gtotal = gtotal + total;
  }

  U u;
  u.m = gtotal.d;

  cout << (u.f[0]) << endl;
}
--- end corrected testcase -------------------------------------


-- 


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


  reply	other threads:[~2005-12-20  5:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-20  5:25 [Bug c/25500] New: " yuri at tsoft dot com
2005-12-20  5:34 ` yuri at tsoft dot com [this message]
2005-12-20  5:55 ` [Bug target/25500] " pinskia at gcc dot gnu dot org
2005-12-20  6:01 ` yuri at tsoft dot com
2005-12-20  6:03 ` yuri at tsoft dot com
2005-12-20  6:19 ` yuri at tsoft dot com
2005-12-20  6:33 ` pinskia at gcc dot gnu dot org
2005-12-20  6:36 ` pinskia at gcc dot gnu dot org
2005-12-20  6:51 ` yuri at tsoft dot com
2005-12-20  6:55 ` pinskia at gcc dot gnu dot org
2005-12-20  7:40 ` yuri at tsoft dot com
2005-12-25  1:02 ` [Bug target/25500] [4.0/4.1/4.2 Regression]: " pinskia at gcc dot gnu dot org
2005-12-28 16:53 ` jakub at gcc dot gnu dot org
2006-01-15 22:13 ` [Bug target/25500] [4.0/4.1/4.2 Regression]: SSE2 vectorized code is " mmitchel at gcc dot gnu dot org
2006-02-24  0:31 ` mmitchel at gcc dot gnu dot org
2006-05-25  2:38 ` [Bug target/25500] [4.0/4.1/4.2 Regression]: SSE2 vectorized code is slower on 4.x.x than previous mmitchel at gcc dot gnu dot org
2006-07-05  9:50 ` pinskia at gcc dot gnu dot org
2006-08-07  7:55 ` bonzini at gnu dot org
2006-08-07  7:59 ` bonzini at gnu dot org
2006-08-07 15:36 ` pinskia at gcc dot gnu dot org
2006-08-17  8:16 ` bonzini at gnu dot org
2006-08-18 16:16 ` bonzini at gnu dot org
2006-11-12  8:07 ` [Bug target/25500] [4.0/4.1/4.2/4.3 " pinskia at gcc dot gnu dot org
2006-11-15  0:38 ` pinskia at gcc dot gnu dot org
2006-11-20 20:29 ` pinskia at gcc dot gnu dot org
2006-11-20 20:29 ` pinskia at gcc dot gnu dot org

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=20051220053447.14543.qmail@sourceware.org \
    --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).