public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]middle-end: add additional runtime test for [PR113467]
@ 2024-02-05 13:08 Tamar Christina
  2024-02-05 13:11 ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Tamar Christina @ 2024-02-05 13:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, rguenther, jlaw

[-- Attachment #1: Type: text/plain, Size: 1989 bytes --]

Hi All,

This just adds an additional runtime testcase for the fixed issue.

Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.

Ok for master?

Thanks,
Tamar

gcc/testsuite/ChangeLog:

	PR tree-optimization/113467
	* gcc.dg/vect/vect-early-break_110-pr113467.c: New test.

--- inline copy of patch -- 
diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
new file mode 100644
index 0000000000000000000000000000000000000000..2d8a071c0e922ccfd5fa8c7b27044444852dbd95
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
@@ -0,0 +1,51 @@
+/* { dg-add-options vect_early_break } */
+/* { dg-require-effective-target vect_early_break } */
+/* { dg-require-effective-target vect_int } */
+
+/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */
+
+#include "tree-vect.h"
+
+typedef struct gcry_mpi *gcry_mpi_t;
+struct gcry_mpi {
+  int nlimbs;
+  unsigned long *d;
+};
+
+long gcry_mpi_add_ui_up;
+void gcry_mpi_add_ui(gcry_mpi_t w, gcry_mpi_t u, unsigned v) {
+  gcry_mpi_add_ui_up = *w->d;
+  if (u) {
+    unsigned long *res_ptr = w->d, *s1_ptr = w->d;
+    int s1_size = u->nlimbs;
+    unsigned s2_limb = v, x = *s1_ptr++;
+    s2_limb += x;
+    *res_ptr++ = s2_limb;
+    if (x)
+      while (--s1_size) {
+        x = *s1_ptr++ + 1;
+        *res_ptr++ = x;
+        if (x) {
+          break;
+        }
+      }
+  }
+}
+
+int main()
+{
+  check_vect ();
+
+  static struct gcry_mpi sv;
+  static unsigned long vals[] = {4294967288, 191,        4160749568, 4294963263,
+                                 127,        4294950912, 255,        4294901760,
+                                 534781951,  33546240,   4294967292, 4294960127,
+                                 4292872191, 4294967295, 4294443007, 3};
+  gcry_mpi_t v = &sv;
+  v->nlimbs = 16;
+  v->d = vals;
+
+  gcry_mpi_add_ui(v, v, 8);
+  if (v->d[1] != 192)
+    __builtin_abort();
+}




-- 

[-- Attachment #2: rb18246.patch --]
[-- Type: text/plain, Size: 1668 bytes --]

diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
new file mode 100644
index 0000000000000000000000000000000000000000..2d8a071c0e922ccfd5fa8c7b27044444852dbd95
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
@@ -0,0 +1,51 @@
+/* { dg-add-options vect_early_break } */
+/* { dg-require-effective-target vect_early_break } */
+/* { dg-require-effective-target vect_int } */
+
+/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */
+
+#include "tree-vect.h"
+
+typedef struct gcry_mpi *gcry_mpi_t;
+struct gcry_mpi {
+  int nlimbs;
+  unsigned long *d;
+};
+
+long gcry_mpi_add_ui_up;
+void gcry_mpi_add_ui(gcry_mpi_t w, gcry_mpi_t u, unsigned v) {
+  gcry_mpi_add_ui_up = *w->d;
+  if (u) {
+    unsigned long *res_ptr = w->d, *s1_ptr = w->d;
+    int s1_size = u->nlimbs;
+    unsigned s2_limb = v, x = *s1_ptr++;
+    s2_limb += x;
+    *res_ptr++ = s2_limb;
+    if (x)
+      while (--s1_size) {
+        x = *s1_ptr++ + 1;
+        *res_ptr++ = x;
+        if (x) {
+          break;
+        }
+      }
+  }
+}
+
+int main()
+{
+  check_vect ();
+
+  static struct gcry_mpi sv;
+  static unsigned long vals[] = {4294967288, 191,        4160749568, 4294963263,
+                                 127,        4294950912, 255,        4294901760,
+                                 534781951,  33546240,   4294967292, 4294960127,
+                                 4292872191, 4294967295, 4294443007, 3};
+  gcry_mpi_t v = &sv;
+  v->nlimbs = 16;
+  v->d = vals;
+
+  gcry_mpi_add_ui(v, v, 8);
+  if (v->d[1] != 192)
+    __builtin_abort();
+}




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

* Re: [PATCH]middle-end: add additional runtime test for [PR113467]
  2024-02-05 13:08 [PATCH]middle-end: add additional runtime test for [PR113467] Tamar Christina
@ 2024-02-05 13:11 ` Richard Biener
  2024-02-05 13:35   ` Tamar Christina
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2024-02-05 13:11 UTC (permalink / raw)
  To: Tamar Christina; +Cc: gcc-patches, nd, jlaw

On Mon, 5 Feb 2024, Tamar Christina wrote:

> Hi All,
> 
> This just adds an additional runtime testcase for the fixed issue.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> 
> Ok for master?

I think you need a lp64 target check for the large constants or
alternatively use uint64_t?

> Thanks,
> Tamar
> 
> gcc/testsuite/ChangeLog:
> 
> 	PR tree-optimization/113467
> 	* gcc.dg/vect/vect-early-break_110-pr113467.c: New test.
> 
> --- inline copy of patch -- 
> diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..2d8a071c0e922ccfd5fa8c7b27044444852dbd95
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
> @@ -0,0 +1,51 @@
> +/* { dg-add-options vect_early_break } */
> +/* { dg-require-effective-target vect_early_break } */
> +/* { dg-require-effective-target vect_int } */
> +
> +/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */
> +
> +#include "tree-vect.h"
> +
> +typedef struct gcry_mpi *gcry_mpi_t;
> +struct gcry_mpi {
> +  int nlimbs;
> +  unsigned long *d;
> +};
> +
> +long gcry_mpi_add_ui_up;
> +void gcry_mpi_add_ui(gcry_mpi_t w, gcry_mpi_t u, unsigned v) {
> +  gcry_mpi_add_ui_up = *w->d;
> +  if (u) {
> +    unsigned long *res_ptr = w->d, *s1_ptr = w->d;
> +    int s1_size = u->nlimbs;
> +    unsigned s2_limb = v, x = *s1_ptr++;
> +    s2_limb += x;
> +    *res_ptr++ = s2_limb;
> +    if (x)
> +      while (--s1_size) {
> +        x = *s1_ptr++ + 1;
> +        *res_ptr++ = x;
> +        if (x) {
> +          break;
> +        }
> +      }
> +  }
> +}
> +
> +int main()
> +{
> +  check_vect ();
> +
> +  static struct gcry_mpi sv;
> +  static unsigned long vals[] = {4294967288, 191,        4160749568, 4294963263,
> +                                 127,        4294950912, 255,        4294901760,
> +                                 534781951,  33546240,   4294967292, 4294960127,
> +                                 4292872191, 4294967295, 4294443007, 3};
> +  gcry_mpi_t v = &sv;
> +  v->nlimbs = 16;
> +  v->d = vals;
> +
> +  gcry_mpi_add_ui(v, v, 8);
> +  if (v->d[1] != 192)
> +    __builtin_abort();
> +}
> 
> 
> 
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

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

* RE: [PATCH]middle-end: add additional runtime test for [PR113467]
  2024-02-05 13:11 ` Richard Biener
@ 2024-02-05 13:35   ` Tamar Christina
  2024-02-05 14:29     ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Tamar Christina @ 2024-02-05 13:35 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches, nd, jlaw

[-- Attachment #1: Type: text/plain, Size: 2181 bytes --]

> > Ok for master?
> 
> I think you need a lp64 target check for the large constants or
> alternatively use uint64_t?
> 

Ok, how about this one.

Regtested on x86_64-pc-linux-gnu with -m32,-m64 and no issues.

Ok for master?

Thanks,
Tamar

gcc/testsuite/ChangeLog:

	PR tree-optimization/113467
	* gcc.dg/vect/vect-early-break_110-pr113467.c: New test.

--- inline copy of patch ---

diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
new file mode 100644
index 0000000000000000000000000000000000000000..1e2c47be5fdf1e1fed88e4b5f45d7eda6c3b85d1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
@@ -0,0 +1,52 @@
+/* { dg-add-options vect_early_break } */
+/* { dg-require-effective-target vect_early_break } */
+/* { dg-require-effective-target vect_long_long } */
+
+/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */
+
+#include "tree-vect.h"
+#include <stdint.h>
+
+typedef struct gcry_mpi *gcry_mpi_t;
+struct gcry_mpi {
+  int nlimbs;
+  unsigned long *d;
+};
+
+long gcry_mpi_add_ui_up;
+void gcry_mpi_add_ui(gcry_mpi_t w, gcry_mpi_t u, unsigned v) {
+  gcry_mpi_add_ui_up = *w->d;
+  if (u) {
+    uint64_t *res_ptr = w->d, *s1_ptr = w->d;
+    int s1_size = u->nlimbs;
+    unsigned s2_limb = v, x = *s1_ptr++;
+    s2_limb += x;
+    *res_ptr++ = s2_limb;
+    if (x)
+      while (--s1_size) {
+        x = *s1_ptr++ + 1;
+        *res_ptr++ = x;
+        if (x) {
+          break;
+        }
+      }
+  }
+}
+
+int main()
+{
+  check_vect ();
+
+  static struct gcry_mpi sv;
+  static uint64_t vals[] = {4294967288ULL, 191ULL,        4160749568ULL, 4294963263ULL,
+                            127ULL,        4294950912ULL, 255ULL,        4294901760ULL,
+                            534781951ULL,  33546240ULL,   4294967292ULL, 4294960127ULL,
+                            4292872191ULL, 4294967295ULL, 4294443007ULL, 3ULL};
+  gcry_mpi_t v = &sv;
+  v->nlimbs = 16;
+  v->d = vals;
+
+  gcry_mpi_add_ui(v, v, 8);
+  if (v->d[1] != 192)
+    __builtin_abort();
+}

[-- Attachment #2: rb18246.patch --]
[-- Type: application/octet-stream, Size: 1715 bytes --]

diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
new file mode 100644
index 0000000000000000000000000000000000000000..1e2c47be5fdf1e1fed88e4b5f45d7eda6c3b85d1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
@@ -0,0 +1,52 @@
+/* { dg-add-options vect_early_break } */
+/* { dg-require-effective-target vect_early_break } */
+/* { dg-require-effective-target vect_long_long } */
+
+/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */
+
+#include "tree-vect.h"
+#include <stdint.h>
+
+typedef struct gcry_mpi *gcry_mpi_t;
+struct gcry_mpi {
+  int nlimbs;
+  unsigned long *d;
+};
+
+long gcry_mpi_add_ui_up;
+void gcry_mpi_add_ui(gcry_mpi_t w, gcry_mpi_t u, unsigned v) {
+  gcry_mpi_add_ui_up = *w->d;
+  if (u) {
+    uint64_t *res_ptr = w->d, *s1_ptr = w->d;
+    int s1_size = u->nlimbs;
+    unsigned s2_limb = v, x = *s1_ptr++;
+    s2_limb += x;
+    *res_ptr++ = s2_limb;
+    if (x)
+      while (--s1_size) {
+        x = *s1_ptr++ + 1;
+        *res_ptr++ = x;
+        if (x) {
+          break;
+        }
+      }
+  }
+}
+
+int main()
+{
+  check_vect ();
+
+  static struct gcry_mpi sv;
+  static uint64_t vals[] = {4294967288ULL, 191ULL,        4160749568ULL, 4294963263ULL,
+                            127ULL,        4294950912ULL, 255ULL,        4294901760ULL,
+                            534781951ULL,  33546240ULL,   4294967292ULL, 4294960127ULL,
+                            4292872191ULL, 4294967295ULL, 4294443007ULL, 3ULL};
+  gcry_mpi_t v = &sv;
+  v->nlimbs = 16;
+  v->d = vals;
+
+  gcry_mpi_add_ui(v, v, 8);
+  if (v->d[1] != 192)
+    __builtin_abort();
+}

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

* RE: [PATCH]middle-end: add additional runtime test for [PR113467]
  2024-02-05 13:35   ` Tamar Christina
@ 2024-02-05 14:29     ` Richard Biener
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2024-02-05 14:29 UTC (permalink / raw)
  To: Tamar Christina; +Cc: gcc-patches, nd, jlaw

On Mon, 5 Feb 2024, Tamar Christina wrote:

> > > Ok for master?
> > 
> > I think you need a lp64 target check for the large constants or
> > alternatively use uint64_t?
> > 
> 
> Ok, how about this one.
> 
> Regtested on x86_64-pc-linux-gnu with -m32,-m64 and no issues.
> 
> Ok for master?

OK

> Thanks,
> Tamar
> 
> gcc/testsuite/ChangeLog:
> 
> 	PR tree-optimization/113467
> 	* gcc.dg/vect/vect-early-break_110-pr113467.c: New test.
> 
> --- inline copy of patch ---
> 
> diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..1e2c47be5fdf1e1fed88e4b5f45d7eda6c3b85d1
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_110-pr113467.c
> @@ -0,0 +1,52 @@
> +/* { dg-add-options vect_early_break } */
> +/* { dg-require-effective-target vect_early_break } */
> +/* { dg-require-effective-target vect_long_long } */
> +
> +/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */
> +
> +#include "tree-vect.h"
> +#include <stdint.h>
> +
> +typedef struct gcry_mpi *gcry_mpi_t;
> +struct gcry_mpi {
> +  int nlimbs;
> +  unsigned long *d;
> +};
> +
> +long gcry_mpi_add_ui_up;
> +void gcry_mpi_add_ui(gcry_mpi_t w, gcry_mpi_t u, unsigned v) {
> +  gcry_mpi_add_ui_up = *w->d;
> +  if (u) {
> +    uint64_t *res_ptr = w->d, *s1_ptr = w->d;
> +    int s1_size = u->nlimbs;
> +    unsigned s2_limb = v, x = *s1_ptr++;
> +    s2_limb += x;
> +    *res_ptr++ = s2_limb;
> +    if (x)
> +      while (--s1_size) {
> +        x = *s1_ptr++ + 1;
> +        *res_ptr++ = x;
> +        if (x) {
> +          break;
> +        }
> +      }
> +  }
> +}
> +
> +int main()
> +{
> +  check_vect ();
> +
> +  static struct gcry_mpi sv;
> +  static uint64_t vals[] = {4294967288ULL, 191ULL,        4160749568ULL, 4294963263ULL,
> +                            127ULL,        4294950912ULL, 255ULL,        4294901760ULL,
> +                            534781951ULL,  33546240ULL,   4294967292ULL, 4294960127ULL,
> +                            4292872191ULL, 4294967295ULL, 4294443007ULL, 3ULL};
> +  gcry_mpi_t v = &sv;
> +  v->nlimbs = 16;
> +  v->d = vals;
> +
> +  gcry_mpi_add_ui(v, v, 8);
> +  if (v->d[1] != 192)
> +    __builtin_abort();
> +}
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

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

end of thread, other threads:[~2024-02-05 14:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05 13:08 [PATCH]middle-end: add additional runtime test for [PR113467] Tamar Christina
2024-02-05 13:11 ` Richard Biener
2024-02-05 13:35   ` Tamar Christina
2024-02-05 14:29     ` Richard Biener

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).