public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "marxin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/95218] [11 Regression] FAIL: gcc.target/i386/fma_run_double_1.c execution test since r11-455-g94f687bd9ae37ece
Date: Wed, 20 May 2020 12:29:37 +0000	[thread overview]
Message-ID: <bug-95218-4-MVZeEVeTH3@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95218-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
There's partially reduced test-case:

$ cat fma.i

double res_test0101[] = {
    -3,    1,     17,    51,    109,   197,   321,   487,   701,   969,  1297,
    1691,  2157,  2701,  3329,  4047,  4861,  5777,  6801,  7939,  9197, 10581,
    12097, 13751, 15549, 17497, 19601, 21867, 24301, 26909, 29697, 32671};
double res_test0110[] = {3,      -1,     -17,    -51,    -109,   -197,   -321,
                         -487,   -701,   -969,   -1297,  -1691,  -2157,  -2701,
                         -3329,  -4047,  -4861,  -5777,  -6801,  -7939,  -9197,
                         -10581, -12097, -13751, -15549, -17497, -19601,
-21867,
                         -24301, -26909, -29697, -32671};
extern void abort() __attribute__(()) __attribute__(());
static __inline int __get_cpuid(unsigned int __leaf, unsigned int *__eax,
                                unsigned int *__ebx, unsigned int *__ecx,
                                unsigned int *__edx) {
  __asm__("cpuid\n\t"
          : "=a"(*__eax), "=b"(*__ebx), "=c"(*__ecx), "=d"(*__edx)
          : "0"(__leaf));
}
static void fma_test();
int main() {
  unsigned int eax, ebx, ecx, edx;
  if (!__get_cpuid(1, &eax, &ebx, &ecx, &edx)) 0;
  if (ecx & (1 << 12)) fma_test();

  return 0;
}
double m1[] = {1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16,
               17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32};
double m2[] = {2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16, 17,
               18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33};
double m3[] = {3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16, 17, 18,
               19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34};
double m4[32];
int test_fails = 0;
void compare_result(double *res) {
  int i;
  int good = 1;
  i = 0;
  for (i; i < 32; i++)
    if (m4[i] != res[i])
      if (good) good = 0;
  if (!good) test_fails = 1;
}
static void fma_test() {
  double __trans_tmp_3;
  double __trans_tmp_2;
  double __trans_tmp_1;
  int i;
  for (i = 0; i < 32; i++) m4[i] = 0;
  i = 0;
  for (i; i < 32; i++) {
    double a = m1[i];
    double b = m2[i];
    double c = m3[i];
    __trans_tmp_1 = ((a * b) - c) * a - b;

    m4[i] = __trans_tmp_1;
  }
  compare_result(res_test0101);
  i = 0;
  for (i; i < 32; i++) {
    {
      double a = m1[i];
      double b = m2[i];
      double c = m3[i];

      __trans_tmp_3 = -((a * b) - c) * a + b;
    }

    m4[i] = __trans_tmp_3;
  }
  compare_result(res_test0110);
  i = 0;
  for (i; i < 32; i++) {
    double a = m1[i];
    double b = m2[i];
    double c = m3[i];
    __trans_tmp_2 = -((a * b) - c) * a - b;

    m4[i] = __trans_tmp_2;
  }
  if (test_fails) abort();
}

$ gcc -O3 -Wno-attributes -mfpmath=sse -mfma fma.i  && ./a.out 
Aborted (core dumped)

  parent reply	other threads:[~2020-05-20 12:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 18:31 [Bug target/95218] New: [11 Regression] FAIL: gcc.target/i386/fma_run_double_1.c execution test msebor at gcc dot gnu.org
2020-05-19 18:37 ` [Bug target/95218] " msebor at gcc dot gnu.org
2020-05-20  6:27 ` rguenth at gcc dot gnu.org
2020-05-20 10:02 ` [Bug target/95218] [11 Regression] FAIL: gcc.target/i386/fma_run_double_1.c execution test since r11-455-g94f687bd9ae37ece marxin at gcc dot gnu.org
2020-05-20 11:07 ` ubizjak at gmail dot com
2020-05-20 11:13 ` marxin at gcc dot gnu.org
2020-05-20 12:17 ` ubizjak at gmail dot com
2020-05-20 12:22 ` ubizjak at gmail dot com
2020-05-20 12:29 ` marxin at gcc dot gnu.org [this message]
2020-05-20 12:50 ` ubizjak at gmail dot com
2020-05-20 13:05 ` rguenther at suse dot de
2020-05-20 13:13 ` rguenth at gcc dot gnu.org
2020-05-20 13:49 ` ubizjak at gmail dot com
2020-05-20 14:04 ` jakub at gcc dot gnu.org
2020-05-20 14:05 ` ubizjak at gmail dot com
2020-05-20 14:17 ` ubizjak at gmail dot com
2020-05-20 22:04 ` law at redhat dot com
2020-05-20 22:49 ` ubizjak at gmail dot com
2020-05-20 22:55 ` ubizjak at gmail dot com
2020-05-20 23:53 ` cvs-commit at gcc dot gnu.org
2020-05-22 10:35 ` rguenth 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-95218-4-MVZeEVeTH3@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).