[Sync] sync patches from openeuler/gcc.

This commit is contained in:
zhenyu--zhao_admin 2024-12-11 15:00:53 +08:00
parent 0e8bcf7272
commit 56d5fcee2a
4 changed files with 1126 additions and 2 deletions

View File

@ -0,0 +1,52 @@
From 8f5c12954adb237685c837cb37c98b7594e9fa61 Mon Sep 17 00:00:00 2001
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
Date: Tue, 10 Dec 2024 15:50:16 +0800
Subject: [PATCH] [bugfix] fix vector costs for hip09.
---
gcc/config/aarch64/aarch64-cost-tables.h | 6 +++++-
gcc/config/aarch64/aarch64.cc | 4 +++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gcc/config/aarch64/aarch64-cost-tables.h b/gcc/config/aarch64/aarch64-cost-tables.h
index dc51d9c2c..06da1b271 100644
--- a/gcc/config/aarch64/aarch64-cost-tables.h
+++ b/gcc/config/aarch64/aarch64-cost-tables.h
@@ -872,7 +872,11 @@ const struct cpu_cost_table hip09_extra_costs =
},
/* Vector */
{
- COSTS_N_INSNS (1) /* alu. */
+ COSTS_N_INSNS (1), /* alu. */
+ COSTS_N_INSNS (4), /* mult. */
+ COSTS_N_INSNS (1), /* movi. */
+ COSTS_N_INSNS (2), /* dup. */
+ COSTS_N_INSNS (2) /* extract. */
}
};
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 829e0da8f..f2444a039 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -499,6 +499,8 @@ static const struct cpu_addrcost_table hip09_addrcost_table =
},
0, /* pre_modify */
0, /* post_modify */
+ 0, /* post_modify_ld3_st3 */
+ 0, /* post_modify_ld4_st4 */
0, /* register_offset */
1, /* register_sextend */
1, /* register_zextend */
@@ -1910,7 +1912,7 @@ static const struct tune_params hip09_tunings =
&hip09_extra_costs,
&hip09_addrcost_table,
&hip09_regmove_cost,
- &hip09_vector_cost,
+ &generic_vector_cost,
&generic_branch_cost,
&generic_approx_modes,
SVE_256, /* sve_width */
--
2.33.0

View File

@ -0,0 +1,54 @@
From 14457b169e1e4cb372d165de3bbdde391e8b817f Mon Sep 17 00:00:00 2001
From: YunQiang Su <yunqiang@isrc.iscas.ac.cn>
Date: Tue, 8 Oct 2024 18:04:01 +0800
Subject: [PATCH] gcc/opts-common.cc: Fix build with clang
1. For putenv ("AI_INFER_LEVEL=1"), clang complains that C++11 deprecates
convert string literal to char *, while putenv expcets "char *".
Let's use setenv, which expects "const char *".
2. Ditto for char *lan in handle_lto_option.
3. In `handle_machine_option`, there is a variable length array,
int64_t argv_hw[argc_hw]
clang complains about it, and in fact, argc_hw can be an const var.
---
gcc/opts-common.cc | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc
index 12c3f7299..33c696f3d 100644
--- a/gcc/opts-common.cc
+++ b/gcc/opts-common.cc
@@ -1053,7 +1053,7 @@ ai_infer_optimization (int argc, const char **argv,
dlclose (onnxruntime_lib_handle);
if (model_pred == 1)
- putenv ("AI_INFER_LEVEL=1");
+ setenv ("AI_INFER_LEVEL", "1", 1);
return model_pred;
}
@@ -1065,9 +1065,8 @@ handle_lto_option (unsigned int lang_mask,
struct cl_decoded_option *&opt_array)
{
int ret = 0;
- char *lan = "";
char *compiler = xstrdup (argv[0]);
- lan = strrchr (compiler, '/');
+ char *lan = strrchr (compiler, '/');
if (lan != NULL)
lan ++;
else
@@ -1125,7 +1124,7 @@ handle_machine_option (unsigned int lang_mask,
{
return ret;
}
- int argc_hw = 6;
+ const int argc_hw = 6;
int64_t argv_hw[argc_hw] = {
global_options.x_param_simultaneous_prefetches,
global_options.x_param_l1_cache_size,
--
2.33.0

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
%global gcc_major 12 %global gcc_major 12
# Note, gcc_release must be integer, if you want to add suffixes to # Note, gcc_release must be integer, if you want to add suffixes to
# %%{release}, append them after %%{gcc_release} on Release: line. # %%{release}, append them after %%{gcc_release} on Release: line.
%global gcc_release 58 %global gcc_release 59
%global _unpackaged_files_terminate_build 0 %global _unpackaged_files_terminate_build 0
%global _performance_build 1 %global _performance_build 1
@ -429,6 +429,9 @@ Patch320: 0320-if-split-fix-bugs.patch
Patch321: 0321-Struct-reorg-Avoid-doing-struct-split-and-reorder_fi.patch Patch321: 0321-Struct-reorg-Avoid-doing-struct-split-and-reorder_fi.patch
Patch322: 0322-Bugfix-Create-POINTER_PLUS_EXPR-for-REFERENCE_TYPE.patch Patch322: 0322-Bugfix-Create-POINTER_PLUS_EXPR-for-REFERENCE_TYPE.patch
Patch323: 0323-Bugfix-replace-tmp-pattern-split.patch Patch323: 0323-Bugfix-replace-tmp-pattern-split.patch
Patch324: 0324-bugfix-fix-vector-costs-for-hip09.patch
Patch325: 0325-gcc-opts-common.cc-Fix-build-with-clang.patch
Patch326: 0326-BUGFIX-Fix-build-error-on-risv_64.patch
# Part 1001-1999 # Part 1001-1999
%ifarch sw_64 %ifarch sw_64
@ -1538,6 +1541,9 @@ not stable, so plugins must be rebuilt any time GCC is updated.
%patch -P321 -p1 %patch -P321 -p1
%patch -P322 -p1 %patch -P322 -p1
%patch -P323 -p1 %patch -P323 -p1
%patch -P324 -p1
%patch -P325 -p1
%patch -P326 -p1
%ifarch sw_64 %ifarch sw_64
%patch -P1001 -p1 %patch -P1001 -p1
@ -3163,7 +3169,8 @@ end
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/lto-wrapper %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/lto-wrapper
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/liblto_plugin.so* %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/liblto_plugin.so*
%{_libdir}/bfd-plugins/liblto_plugin.so %{_libdir}/bfd-plugins/liblto_plugin.so
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/onnx.fdata %{_prefix}/libexec/gcc/onnx.fdata
%{_prefix}/libexec/gcc/optimizer.fdata
%ifarch aarch64 %ifarch aarch64
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/libbolt_plugin.so* %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/libbolt_plugin.so*
%endif %endif
@ -4160,6 +4167,12 @@ end
%doc rpm.doc/changelogs/libcc1/ChangeLog* %doc rpm.doc/changelogs/libcc1/ChangeLog*
%changelog %changelog
* Wed Dec 11 2024 Zhenyu Zhao <zhaozhenyu17@huawei.com> - 12.3.1-59
- Type:Sync
- ID:NA
- SUG:NA
- DESC: Sync patches from openeuler/gcc.
* Tue Dec 10 2024 huzife <634763349@qq.com> - 12.3.1-58 * Tue Dec 10 2024 huzife <634763349@qq.com> - 12.3.1-58
- Type:Bugfix - Type:Bugfix
- ID:NA - ID:NA