aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorStefan Schulze Frielinghaus <stefansf@gcc.gnu.org>2025-07-17 12:44:06 +0200
committerStefan Schulze Frielinghaus <stefansf@gcc.gnu.org>2025-07-17 12:44:06 +0200
commitdf20aac4c6662ef58e7577501ca9bb3c8d4ae507 (patch)
treebab271fc582c5039c22df0d56822a8d86bfa2fe7 /gcc
parentc66760923188f630fbeb68c22ac521d2f4cae645 (diff)
downloadgcc-df20aac4c6662ef58e7577501ca9bb3c8d4ae507.zip
gcc-df20aac4c6662ef58e7577501ca9bb3c8d4ae507.tar.gz
gcc-df20aac4c6662ef58e7577501ca9bb3c8d4ae507.tar.bz2
s390: Adapt GPR<->VR costs
Moving between GPRs and VRs in any mode with size less than or equal to 8 bytes becomes available with vector extensions. Without adapting costs for those loads, we typically go over memory. gcc/ChangeLog: * config/s390/s390.cc (s390_register_move_cost): Add costing for vlvg/vlgv.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/s390/s390.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index 737b176..b5e636c 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -3862,7 +3862,21 @@ s390_register_move_cost (machine_mode mode,
{
/* On s390, copy between fprs and gprs is expensive. */
- /* It becomes somewhat faster having ldgr/lgdr. */
+ /* With vector extensions any GPR<->VR load up to 8 bytes is supported. */
+ if (TARGET_VX && GET_MODE_SIZE (mode) <= 8)
+ {
+ /* ldgr/vlvgg take one cycle and vlvg[bhf] take two cycles. */
+ if (reg_classes_intersect_p (from, GENERAL_REGS)
+ && reg_classes_intersect_p (to, VEC_REGS))
+ return GET_MODE_SIZE (mode) == 8 ? 1 : 2;
+ /* lgdr/vlgv[fg] take three cycles and vlgv[bh] take five cycles. */
+ if (reg_classes_intersect_p (to, GENERAL_REGS)
+ && reg_classes_intersect_p (from, VEC_REGS))
+ return GET_MODE_SIZE (mode) >= 4 ? 3 : 4;
+ }
+
+ /* Without vector extensions it still becomes somewhat faster having
+ ldgr/lgdr. */
if (TARGET_Z10 && GET_MODE_SIZE (mode) == 8)
{
/* ldgr is single cycle. */