aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/rs6000
diff options
context:
space:
mode:
authorJiufu Guo <guojiufu@linux.ibm.com>2023-12-13 08:10:25 +0800
committerguojiufu <guojiufu@linux.ibm.com>2023-12-13 08:53:18 +0800
commita9046f1979f05c1fd4e69a3bbf5a8629e2573fd3 (patch)
treeaa36ceba43e86b265bd91ee23f3a1bd55f6464cb /gcc/config/rs6000
parent97b3b38e5faec2b5486368f5a0ffb16eb4ab4190 (diff)
downloadgcc-a9046f1979f05c1fd4e69a3bbf5a8629e2573fd3.zip
gcc-a9046f1979f05c1fd4e69a3bbf5a8629e2573fd3.tar.gz
gcc-a9046f1979f05c1fd4e69a3bbf5a8629e2573fd3.tar.bz2
rs6000: using pli for constant splitting
For constant building e.g. r120=0x66666666, which does not fit 'li or lis', 'pli' is used to build this constant via 'emit_move_insn'. While for a complicated constant, e.g. 0x6666666666666666ULL, when using 'rs6000_emit_set_long_const' to split the constant recursively, it fails to use 'pli' to build the half part constant: 0x66666666. 'rs6000_emit_set_long_const' could be updated to use 'pli' to build half part of the constant when necessary. For example: 0x6666666666666666ULL, "pli 3,1717986918; rldimi 3,3,32,0" can be used. gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add code to use pli for 34bit constant. gcc/testsuite/ChangeLog: * gcc.target/powerpc/const-build-1.c: New test.
Diffstat (limited to 'gcc/config/rs6000')
-rw-r--r--gcc/config/rs6000/rs6000.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 5cb94f6..09a5d29 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -10521,6 +10521,13 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c, int *num_insns)
emit_insn (dest_or_insn);
};
+ if (TARGET_PREFIXED && SIGNED_INTEGER_34BIT_P (c))
+ {
+ /* li/lis/pli */
+ count_or_emit_insn (dest, GEN_INT (c));
+ return;
+ }
+
if ((ud4 == 0xffff && ud3 == 0xffff && ud2 == 0xffff && (ud1 & 0x8000))
|| (ud4 == 0 && ud3 == 0 && ud2 == 0 && !(ud1 & 0x8000)))
{