public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/95488] Suboptimal multiplication codegen for v16qi
Date: Thu, 11 Jun 2020 08:11:36 +0000	[thread overview]
Message-ID: <bug-95488-4-HyCrNqzWnh@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95488-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Hongtao.liu <crazylht at gmail dot com> ---
Microbenchmark
----
cat test.c

#include <stdio.h>
#include <stdlib.h>
#include <x86intrin.h>

typedef char  v16qi  __attribute__ ((vector_size (16)));
extern v16qi interleave_mul (v16qi, v16qi);
extern v16qi extend_mul (v16qi, v16qi);

#define LOOP 30000000


int
main ()
{
  int i;
  unsigned long long start, end;
  unsigned long long diff;
  unsigned int aux;
  v16qi *p0;
  v16qi *p1;
  v16qi x, y;

  p0 = (v16qi *) malloc (LOOP *  sizeof (*p0));
  p1 = (v16qi *) malloc (LOOP *  sizeof (*p1));
  for (i = 0; i < LOOP; i++)
    for (int j = 0; j != 16; j++)
    {
      p0[i][j] = 1 + i + j;
      p1[i][j] = 1 + i * i + j * j;
    }

#if 1
  start = __rdtscp (&aux);
  for (i = 0; i < LOOP; i+=16)
    y = interleave_mul (p0[i], p1[i]);
  end = __rdtscp (&aux);
  diff = end - start;

  printf ("interleave_mul : %lld\n", diff);

#endif

#if 1
  start = __rdtscp (&aux);
  for (i = 0; i < LOOP; i+=16)
    x = extend_mul (p0[i], p1[i]);
  end = __rdtscp (&aux);
  diff = end - start;

  printf ("extend_mul :    %lld\n", diff);
#endif

  free (p0);
  free (p1);

  return 0;
}
---
show a little bit improvement:

interleave_mul : 104180000
extend_mul :    103922083

  parent reply	other threads:[~2020-06-11  8:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03  3:00 [Bug target/95488] New: " crazylht at gmail dot com
2020-06-03  3:26 ` [Bug target/95488] " crazylht at gmail dot com
2020-06-03  6:13 ` rguenth at gcc dot gnu.org
2020-06-03  7:08 ` crazylht at gmail dot com
2020-06-03  7:15 ` crazylht at gmail dot com
2020-06-11  8:11 ` crazylht at gmail dot com [this message]
2020-06-15  1:47 ` cvs-commit at gcc dot gnu.org
2020-06-15  2:06 ` crazylht at gmail dot com
2020-06-16 13:13 ` hjl.tools at gmail dot com
2020-06-17  1:25 ` crazylht at gmail dot com
2020-07-09  6:56 ` crazylht at gmail dot com
2021-08-21 18:26 ` pinskia at gcc dot gnu.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=bug-95488-4-HyCrNqzWnh@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).