diff options
author | Lulu Cheng <chenglulu@loongson.cn> | 2023-09-13 11:01:34 +0800 |
---|---|---|
committer | Lulu Cheng <chenglulu@loongson.cn> | 2023-09-14 14:59:26 +0800 |
commit | 3acf7e9da39360dab6ebb9dfc92208e9dadd982a (patch) | |
tree | 08eb35cd6f89ea9d898987edcce4a072c0119f52 /gcc | |
parent | 5079b620987f20d04a0bed837d649772735747f2 (diff) | |
download | gcc-3acf7e9da39360dab6ebb9dfc92208e9dadd982a.zip gcc-3acf7e9da39360dab6ebb9dfc92208e9dadd982a.tar.gz gcc-3acf7e9da39360dab6ebb9dfc92208e9dadd982a.tar.bz2 |
LoongArch: Change the value of branch_cost from 2 to 6.
gcc/ChangeLog:
* config/loongarch/loongarch-def.c: Modify the default value of
branch_cost.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/cmov_ii.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/loongarch/loongarch-def.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/loongarch/cmov_ii.c | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/config/loongarch/loongarch-def.c b/gcc/config/loongarch/loongarch-def.c index e744ee0..430ef8b 100644 --- a/gcc/config/loongarch/loongarch-def.c +++ b/gcc/config/loongarch/loongarch-def.c @@ -85,7 +85,7 @@ loongarch_cpu_align[N_TUNE_TYPES] = { .int_mult_di = COSTS_N_INSNS (1), \ .int_div_si = COSTS_N_INSNS (4), \ .int_div_di = COSTS_N_INSNS (6), \ - .branch_cost = 2, \ + .branch_cost = 6, \ .memory_latency = 4 /* The following properties cannot be looked up directly using "cpucfg". @@ -118,7 +118,7 @@ loongarch_rtx_cost_optimize_size = { .int_mult_di = 4, .int_div_si = 4, .int_div_di = 4, - .branch_cost = 2, + .branch_cost = 6, .memory_latency = 4, }; diff --git a/gcc/testsuite/gcc.target/loongarch/cmov_ii.c b/gcc/testsuite/gcc.target/loongarch/cmov_ii.c new file mode 100644 index 0000000..21b468e --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/cmov_ii.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler "test:.*xor.*maskeqz.*masknez.*or.*" } } */ + +extern void foo_ii (int *, int *, int *, int *); + +int +test (void) +{ + int a, b; + int c, d, out; + foo_ii (&a, &b, &c, &d); + out = a == b ? c : d; + return out; +} |