* [PATCH] target/106219 - proprly mark builtins pure via ix86_add_new_builtins
@ 2022-07-07 8:49 Richard Biener
0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-07-07 8:49 UTC (permalink / raw)
To: gcc-patches
The target optimize pragma path to initialize extra target specific
builtins missed handling of the pure_p flag which in turn causes
extra clobber side-effects of gather builtins leading to unexpected
issues downhill.
Bootstrap and regtest running on x86_64-unknown-linux-gnu, will push
as obvious if that succeeds.
* config/i386/i386-builtins.cc (ix86_add_new_builtins): Properly
set DECL_PURE_P.
* g++.dg/pr106219.C: New testcase.
---
gcc/config/i386/i386-builtins.cc | 2 ++
gcc/testsuite/g++.dg/pr106219.C | 31 +++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/pr106219.C
diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc
index 96743e6122d..fe7243c3837 100644
--- a/gcc/config/i386/i386-builtins.cc
+++ b/gcc/config/i386/i386-builtins.cc
@@ -385,6 +385,8 @@ ix86_add_new_builtins (HOST_WIDE_INT isa, HOST_WIDE_INT isa2)
ix86_builtins[i] = decl;
if (ix86_builtins_isa[i].const_p)
TREE_READONLY (decl) = 1;
+ if (ix86_builtins_isa[i].pure_p)
+ DECL_PURE_P (decl) = 1;
}
}
diff --git a/gcc/testsuite/g++.dg/pr106219.C b/gcc/testsuite/g++.dg/pr106219.C
new file mode 100644
index 00000000000..3cad1507d5f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr106219.C
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-O3" }
+// { dg-additional-options "-march=bdver2" { target x86_64-*-* } }
+
+int max(int __b) {
+ if (0 < __b)
+ return __b;
+ return 0;
+}
+struct Plane {
+ Plane(int, int);
+ int *Row();
+};
+#ifdef __x86_64__
+#pragma GCC target "sse2,ssse3,avx,avx2"
+#endif
+float *ConvolveXSampleAndTranspose_rowp;
+int ConvolveXSampleAndTranspose_res, ConvolveXSampleAndTranspose_r;
+void ConvolveXSampleAndTranspose() {
+ Plane out(0, ConvolveXSampleAndTranspose_res);
+ for (int y;;) {
+ float sum;
+ for (int i = ConvolveXSampleAndTranspose_r; i; ++i)
+ sum += i;
+ for (; ConvolveXSampleAndTranspose_r; ++ConvolveXSampleAndTranspose_r)
+ sum +=
+ ConvolveXSampleAndTranspose_rowp[max(ConvolveXSampleAndTranspose_r)] *
+ ConvolveXSampleAndTranspose_r;
+ out.Row()[y] = sum;
+ }
+}
--
2.35.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] target/106219 - proprly mark builtins pure via ix86_add_new_builtins
@ 2022-07-07 8:49 Richard Biener
0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-07-07 8:49 UTC (permalink / raw)
To: gcc-patches
The target optimize pragma path to initialize extra target specific
builtins missed handling of the pure_p flag which in turn causes
extra clobber side-effects of gather builtins leading to unexpected
issues downhill.
Bootstrap and regtest running on x86_64-unknown-linux-gnu, will push
as obvious if that succeeds.
* config/i386/i386-builtins.cc (ix86_add_new_builtins): Properly
set DECL_PURE_P.
* g++.dg/pr106219.C: New testcase.
---
gcc/config/i386/i386-builtins.cc | 2 ++
gcc/testsuite/g++.dg/pr106219.C | 31 +++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/pr106219.C
diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc
index 96743e6122d..fe7243c3837 100644
--- a/gcc/config/i386/i386-builtins.cc
+++ b/gcc/config/i386/i386-builtins.cc
@@ -385,6 +385,8 @@ ix86_add_new_builtins (HOST_WIDE_INT isa, HOST_WIDE_INT isa2)
ix86_builtins[i] = decl;
if (ix86_builtins_isa[i].const_p)
TREE_READONLY (decl) = 1;
+ if (ix86_builtins_isa[i].pure_p)
+ DECL_PURE_P (decl) = 1;
}
}
diff --git a/gcc/testsuite/g++.dg/pr106219.C b/gcc/testsuite/g++.dg/pr106219.C
new file mode 100644
index 00000000000..3cad1507d5f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr106219.C
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-O3" }
+// { dg-additional-options "-march=bdver2" { target x86_64-*-* } }
+
+int max(int __b) {
+ if (0 < __b)
+ return __b;
+ return 0;
+}
+struct Plane {
+ Plane(int, int);
+ int *Row();
+};
+#ifdef __x86_64__
+#pragma GCC target "sse2,ssse3,avx,avx2"
+#endif
+float *ConvolveXSampleAndTranspose_rowp;
+int ConvolveXSampleAndTranspose_res, ConvolveXSampleAndTranspose_r;
+void ConvolveXSampleAndTranspose() {
+ Plane out(0, ConvolveXSampleAndTranspose_res);
+ for (int y;;) {
+ float sum;
+ for (int i = ConvolveXSampleAndTranspose_r; i; ++i)
+ sum += i;
+ for (; ConvolveXSampleAndTranspose_r; ++ConvolveXSampleAndTranspose_r)
+ sum +=
+ ConvolveXSampleAndTranspose_rowp[max(ConvolveXSampleAndTranspose_r)] *
+ ConvolveXSampleAndTranspose_r;
+ out.Row()[y] = sum;
+ }
+}
--
2.35.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] target/106219 - proprly mark builtins pure via ix86_add_new_builtins
@ 2022-07-07 8:49 Richard Biener
0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-07-07 8:49 UTC (permalink / raw)
To: gcc-patches
The target optimize pragma path to initialize extra target specific
builtins missed handling of the pure_p flag which in turn causes
extra clobber side-effects of gather builtins leading to unexpected
issues downhill.
Bootstrap and regtest running on x86_64-unknown-linux-gnu, will push
as obvious if that succeeds.
* config/i386/i386-builtins.cc (ix86_add_new_builtins): Properly
set DECL_PURE_P.
* g++.dg/pr106219.C: New testcase.
---
gcc/config/i386/i386-builtins.cc | 2 ++
gcc/testsuite/g++.dg/pr106219.C | 31 +++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/pr106219.C
diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc
index 96743e6122d..fe7243c3837 100644
--- a/gcc/config/i386/i386-builtins.cc
+++ b/gcc/config/i386/i386-builtins.cc
@@ -385,6 +385,8 @@ ix86_add_new_builtins (HOST_WIDE_INT isa, HOST_WIDE_INT isa2)
ix86_builtins[i] = decl;
if (ix86_builtins_isa[i].const_p)
TREE_READONLY (decl) = 1;
+ if (ix86_builtins_isa[i].pure_p)
+ DECL_PURE_P (decl) = 1;
}
}
diff --git a/gcc/testsuite/g++.dg/pr106219.C b/gcc/testsuite/g++.dg/pr106219.C
new file mode 100644
index 00000000000..3cad1507d5f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr106219.C
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-O3" }
+// { dg-additional-options "-march=bdver2" { target x86_64-*-* } }
+
+int max(int __b) {
+ if (0 < __b)
+ return __b;
+ return 0;
+}
+struct Plane {
+ Plane(int, int);
+ int *Row();
+};
+#ifdef __x86_64__
+#pragma GCC target "sse2,ssse3,avx,avx2"
+#endif
+float *ConvolveXSampleAndTranspose_rowp;
+int ConvolveXSampleAndTranspose_res, ConvolveXSampleAndTranspose_r;
+void ConvolveXSampleAndTranspose() {
+ Plane out(0, ConvolveXSampleAndTranspose_res);
+ for (int y;;) {
+ float sum;
+ for (int i = ConvolveXSampleAndTranspose_r; i; ++i)
+ sum += i;
+ for (; ConvolveXSampleAndTranspose_r; ++ConvolveXSampleAndTranspose_r)
+ sum +=
+ ConvolveXSampleAndTranspose_rowp[max(ConvolveXSampleAndTranspose_r)] *
+ ConvolveXSampleAndTranspose_r;
+ out.Row()[y] = sum;
+ }
+}
--
2.35.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-07 8:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 8:49 [PATCH] target/106219 - proprly mark builtins pure via ix86_add_new_builtins Richard Biener
2022-07-07 8:49 Richard Biener
2022-07-07 8:49 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).