aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorLulu Cheng <chenglulu@loongson.cn>2025-03-27 11:27:40 +0800
committerLulu Cheng <chenglulu@loongson.cn>2025-03-29 09:25:55 +0800
commit6525b408b25945970d84ed1f534616fd63b03a50 (patch)
tree084c1b83dd4f7940294ec06e7a1a59eb81993da4 /gcc
parent69a85f1f66835beff056d130767d82632594b41c (diff)
downloadgcc-6525b408b25945970d84ed1f534616fd63b03a50.zip
gcc-6525b408b25945970d84ed1f534616fd63b03a50.tar.gz
gcc-6525b408b25945970d84ed1f534616fd63b03a50.tar.bz2
LoongArch: Set default alignment for functions jumps loops and labels.
Based on r15-7624, a set of align combinations with better performance was tested through spec2006. LA464: -falign-loops=8 -falign-functions=32 -falign-jumps=32 -falign-labels=8 LA664: -falign-loops=16 -falign-functions=16 -falign-jumps=32 -falign-labels=8 gcc/ChangeLog: * config/loongarch/loongarch-def.cc (la464_align): Add settings for labels. (la664_align): Likewise. * config/loongarch/loongarch-opts.cc (loongarch_target_option_override): Likewise. * config/loongarch/loongarch-tune.h (struct loongarch_align): Implement the function `label_`.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/loongarch/loongarch-def.cc4
-rw-r--r--gcc/config/loongarch/loongarch-opts.cc3
-rw-r--r--gcc/config/loongarch/loongarch-tune.h9
3 files changed, 13 insertions, 3 deletions
diff --git a/gcc/config/loongarch/loongarch-def.cc b/gcc/config/loongarch/loongarch-def.cc
index 5f235a0..04b277e 100644
--- a/gcc/config/loongarch/loongarch-def.cc
+++ b/gcc/config/loongarch/loongarch-def.cc
@@ -107,12 +107,12 @@ array_tune<loongarch_cache> loongarch_cpu_cache =
static inline loongarch_align la464_align ()
{
- return loongarch_align ().function_ ("32").loop_ ("16").jump_ ("16");
+ return loongarch_align ().function_ ("32").loop_ ("8").jump_ ("32").label_ ("8");
}
static inline loongarch_align la664_align ()
{
- return loongarch_align ().function_ ("8").loop_ ("8").jump_ ("32");
+ return loongarch_align ().function_ ("16").loop_ ("16").jump_ ("32").label_ ("8");
}
array_tune<loongarch_align> loongarch_cpu_align =
diff --git a/gcc/config/loongarch/loongarch-opts.cc b/gcc/config/loongarch/loongarch-opts.cc
index c2a63f7..6e72084 100644
--- a/gcc/config/loongarch/loongarch-opts.cc
+++ b/gcc/config/loongarch/loongarch-opts.cc
@@ -965,6 +965,9 @@ loongarch_target_option_override (struct loongarch_target *target,
if (opts->x_flag_align_jumps && !opts->x_str_align_jumps)
opts->x_str_align_jumps = loongarch_cpu_align[target->cpu_tune].jump;
+
+ if (opts->x_flag_align_labels && !opts->x_str_align_labels)
+ opts->x_str_align_labels = loongarch_cpu_align[target->cpu_tune].label;
}
/* Set up parameters to be used in prefetching algorithm. */
diff --git a/gcc/config/loongarch/loongarch-tune.h b/gcc/config/loongarch/loongarch-tune.h
index f7819fe..0ae74e7 100644
--- a/gcc/config/loongarch/loongarch-tune.h
+++ b/gcc/config/loongarch/loongarch-tune.h
@@ -177,8 +177,9 @@ struct loongarch_align {
const char *function; /* default value for -falign-functions */
const char *loop; /* default value for -falign-loops */
const char *jump; /* default value for -falign-jumps */
+ const char *label; /* default value for -falign-labels */
- loongarch_align () : function (nullptr), loop (nullptr), jump (nullptr) {}
+ loongarch_align () : function (nullptr), loop (nullptr), jump (nullptr), label (nullptr) {}
loongarch_align function_ (const char *_function)
{
@@ -197,6 +198,12 @@ struct loongarch_align {
jump = _jump;
return *this;
}
+
+ loongarch_align label_ (const char *_label)
+ {
+ label = _label;
+ return *this;
+ }
};
#endif /* LOONGARCH_TUNE_H */