@@ -4847,6 +4847,21 @@ rs6000_option_override_internal (bool global_init_p)
warning (0, "%qs is deprecated and not recommended in any circumstances",
"-mno-speculate-indirect-jumps");
+ /* Set the threshold for how complicated constant should be put
+ into constant pool. */
+ if (!OPTION_SET_P (rs6000_min_insns_constant_in_pool))
+ {
+ /* one insn could load for the constant: pld 3, .LC1@pcrel
+ ld 0,.LC1@toc(2). */
+ if (TARGET_PREFIXED || (TARGET_64BIT && TARGET_CMODEL == CMODEL_SMALL))
+ rs6000_min_insns_constant_in_pool = 1;
+
+ /* Consider address addjust, slight increase the threshold:
+ add 30,0,30; lwz 9,.LC1-.LCTOC1(30); ld 9,0(9); or
+ lis 9,.LC0@ha; la 9,.LC0@l(9); ld 9,0(9)*/
+ else if (TARGET_32BIT && flag_pic != 1)
+ rs6000_min_insns_constant_in_pool = 3;
+ }
return ret;
}
@@ -1,5 +1,5 @@
/* { dg-do compile { target lp64 } } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 --param=rs6000-min-insns-constant-in-pool=2" } */
/* { dg-require-effective-target power10_ok } */
unsigned long long msk66() { return 0x6666666666666666ULL; }
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O2 -save-temps" } */
+/* { dg-options "-O2 -save-temps --param=rs6000-min-insns-constant-in-pool=2" } */
/* { dg-require-effective-target has_arch_ppc64 } */
/* Verify that two instructions are successfully used to build constants.