[PATCH] Committed: Add testcases for a few PRs

2022-01-01 Thread apinski--- via Gcc-patches
From: Andrew Pinski 

These were fixed as part of the fix for PR 99766,
I thought it would be useful to add a few testcases
for the other cases that were failing.

Committed as obvious after running the tests to make
sure they work.

PR rtl-optimization/100241
PR rtl-optimization/99787

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr100241-1.c: New test.
* gcc.c-torture/compile/pr99787-1.c: New test.
---
 .../gcc.c-torture/compile/pr100241-1.c| 48 +++
 .../gcc.c-torture/compile/pr99787-1.c | 18 +++
 2 files changed, 66 insertions(+)
 create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr100241-1.c
 create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr99787-1.c

diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100241-1.c 
b/gcc/testsuite/gcc.c-torture/compile/pr100241-1.c
new file mode 100644
index 000..593ef96bdb7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr100241-1.c
@@ -0,0 +1,48 @@
+/* { dg-require-visibility "" } */
+/* { dg-options "-fvisibility=internal -fPIC" { target fpic } } */
+
+extern char num_4x4_blocks_high_lookup, num_4x4_blocks_wide_lookup,
+vp9_foreach_transformed_block_in_plane_xd_0_0_0;
+int vp9_first_pass_encode_tile_mb_row_cpi_0,
+vp9_first_pass_encode_tile_mb_row_tile_data_0_0, vp9_encode_sby_pass1_x;
+typedef void foreach_transformed_block_visitor();
+void vp9_encode_sby_pass1();
+typedef struct {
+  long coded_error;
+  long sr_coded_error;
+  long frame_noise_energy;
+  long intra_error;
+} FIRSTPASS_DATA;
+typedef struct {
+  FIRSTPASS_DATA fp_data;
+} TileDataEnc;
+TileDataEnc accumulate_fp_mb_row_stat_this_tile;
+void vp9_first_pass_encode_tile_mb_row(FIRSTPASS_DATA *fp_acc_data) {
+  int mb_col_end = vp9_first_pass_encode_tile_mb_row_tile_data_0_0;
+  for (; mb_col_end;) {
+vp9_encode_sby_pass1();
+if (vp9_first_pass_encode_tile_mb_row_cpi_0) {
+  FIRSTPASS_DATA __trans_tmp_1 = *fp_acc_data;
+  accumulate_fp_mb_row_stat_this_tile.fp_data.coded_error +=
+  accumulate_fp_mb_row_stat_this_tile.fp_data.sr_coded_error +=
+  __trans_tmp_1.sr_coded_error;
+  accumulate_fp_mb_row_stat_this_tile.fp_data.frame_noise_energy +=
+  __trans_tmp_1.frame_noise_energy;
+  accumulate_fp_mb_row_stat_this_tile.fp_data.intra_error +=
+  __trans_tmp_1.intra_error;
+}
+  }
+}
+foreach_transformed_block_visitor vp9_foreach_transformed_block_in_plane_visit;
+void vp9_foreach_transformed_block_in_plane(void *arg) {
+  int c, max_blocks_wide = num_4x4_blocks_wide_lookup;
+  for (; num_4x4_blocks_high_lookup;) {
+c = 0;
+for (; c < max_blocks_wide;
+ c += vp9_foreach_transformed_block_in_plane_xd_0_0_0)
+  vp9_foreach_transformed_block_in_plane_visit(arg);
+  }
+}
+void vp9_encode_sby_pass1() {
+  vp9_foreach_transformed_block_in_plane(&vp9_encode_sby_pass1_x);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr99787-1.c 
b/gcc/testsuite/gcc.c-torture/compile/pr99787-1.c
new file mode 100644
index 000..d98b7e746be
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr99787-1.c
@@ -0,0 +1,18 @@
+/* { dg-options "-ftree-slp-vectorize -ffp-contract=on -ffloat-store"  }  */
+
+_Complex foo_x_0;
+int foo_n11, foo_i, foo_l;
+_Complex float foo_s;
+_Complex *foo_f_0_0_0;
+
+void
+foo() {
+  _Complex f[foo_l];
+  for (; foo_i; foo_i++) {
+int n9;
+for (; n9 < foo_l; n9++)
+  for (; foo_n11; foo_n11++)
+foo_s += foo_f_0_0_0[n9] * 0 * foo_f_0_0_0[foo_n11];
+foo_x_0 += foo_s;
+  }
+}
-- 
2.17.1



[PATCH] Fixincludes: handle __FLT_EVAL_METHOD__ == 16 on darwin

2022-01-01 Thread FX via Gcc-patches
Hi,

The darwin system headers error out on __FLT_EVAL_METHOD__ == 16, which
occurs when the compiler is called with -mavx512fp16 on i386. Allow this
value to proceed past the check (nothing else depends on it in the
system headers). See https://gcc.gnu.org/pipermail/gcc/2021-December/237972.html
for details.

We can use fixincludes to fix this.
Bootstrapped on both x86_64-apple-darwin and aarch64-apple-darwin.

OK to commit?



0001-Fixincludes-Handle-__FLT_EVAL_METHOD__-16-on-darwin.patch
Description: Binary data


Re: [PATCH] Fixincludes: handle __FLT_EVAL_METHOD__ == 16 on darwin

2022-01-01 Thread Iain Sandoe
Hi FX

> On 1 Jan 2022, at 11:30, FX via Gcc-patches  wrote:
> 
> The darwin system headers error out on __FLT_EVAL_METHOD__ == 16, which
> occurs when the compiler is called with -mavx512fp16 on i386. Allow this
> value to proceed past the check (nothing else depends on it in the
> system headers). See 
> https://gcc.gnu.org/pipermail/gcc/2021-December/237972.html
> for details.
> 
> We can use fixincludes to fix this.
> Bootstrapped on both x86_64-apple-darwin and aarch64-apple-darwin.

OK for master, thanks for the patch.
Iain