Re: [PATCH] S/390: Introduce relative_long attribute

2018-11-06 Thread Andreas Krebbel
On 05.11.18 15:18, Ilya Leoshkevich wrote:
> In order to properly fix PR87762, we need to distinguish between
> instructions which support relative addressing and instructions which
> don't.  We could check whether the existing "type" attribute is equal to
> "larl", but there are notable exceptions (lrl, for example), and
> changing them makes scheduling worse on z10.  We could also check
> whether the existing "op_type" attribute is equal to "RIL-b" or "RIL-c".
> However, adding a new attribute provides more flexibility, since we
> don't depend idiosyncrasies which might be introduced into PoP in the
> future.
> 
> gcc/ChangeLog:
> 
> 2018-11-05  Ilya Leoshkevich  
> 
>   PR target/87762
>   * config/s390/s390.md: Add relative_long attribute.

Ok. Thanks!

Andreas



[PATCH] S/390: Introduce relative_long attribute

2018-11-05 Thread Ilya Leoshkevich
In order to properly fix PR87762, we need to distinguish between
instructions which support relative addressing and instructions which
don't.  We could check whether the existing "type" attribute is equal to
"larl", but there are notable exceptions (lrl, for example), and
changing them makes scheduling worse on z10.  We could also check
whether the existing "op_type" attribute is equal to "RIL-b" or "RIL-c".
However, adding a new attribute provides more flexibility, since we
don't depend idiosyncrasies which might be introduced into PoP in the
future.

gcc/ChangeLog:

2018-11-05  Ilya Leoshkevich  

PR target/87762
* config/s390/s390.md: Add relative_long attribute.
---
 gcc/config/s390/s390.md | 94 +
 1 file changed, 67 insertions(+), 27 deletions(-)

diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index e4049c25406..c203bf9ad12 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -570,6 +570,13 @@
 ]
(const_int 0)))
 
+;; Whether an instruction supports relative long addressing.
+;; Currently this corresponds to RIL-b and RIL-c instruction formats,
+;; but having a separate attribute, as opposed to reusing op_type,
+;; provides additional flexibility.
+
+(define_attr "relative_long" "no,yes" (const_string "no"))
+
 ;; Pipeline description for z900.
 (include "2064.md")
 
@@ -1130,7 +1137,8 @@
cgfrl\t%0,%1"
   [(set_attr "op_type"  "RRE,RXY,RIL")
(set_attr "z10prop" "z10_c,*,*")
-   (set_attr "type" "*,*,larl")])
+   (set_attr "type" "*,*,larl")
+   (set_attr "relative_long" "*,*,yes")])
 
 
 
@@ -1146,7 +1154,8 @@
   [(set_attr "op_type"  "RX,RXY,RIL")
(set_attr "cpu_facility" "*,longdisp,z10")
(set_attr "type" "*,*,larl")
-   (set_attr "z196prop" "z196_cracked,z196_cracked,z196_cracked")])
+   (set_attr "z196prop" "z196_cracked,z196_cracked,z196_cracked")
+   (set_attr "relative_long" "*,*,yes")])
 
 (define_insn "*cmphi_ccs_z10"
   [(set (reg CC_REGNUM)
@@ -1166,7 +1175,8 @@
cgh\t%0,%1
cghrl\t%0,%1"
   [(set_attr "op_type" "RXY,RIL")
-   (set_attr "type""*,larl")])
+   (set_attr "type""*,larl")
+   (set_attr "relative_long" "*,yes")])
 
 ; cr, chi, cfi, c, cy, cgr, cghi, cgfi, cg, chsi, cghsi, crl, cgrl
 (define_insn "*cmp_ccs"
@@ -1187,7 +1197,8 @@
   [(set_attr "op_type" "RR,RI,SIL,RIL,RX,RXY,RIL")
(set_attr "cpu_facility" "*,*,z10,extimm,*,longdisp,z10")
(set_attr "type" "*,*,*,*,*,*,larl")
-   (set_attr "z10prop" 
"z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,z10_super")])
+   (set_attr "z10prop" 
"z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,z10_super")
+   (set_attr "relative_long" "*,*,*,*,*,*,yes")])
 
 
 ; Compare (unsigned) instructions
@@ -1201,7 +1212,8 @@
   "clhrl\t%0,%1"
   [(set_attr "op_type" "RIL")
(set_attr "type""larl")
-   (set_attr "z10prop" "z10_super")])
+   (set_attr "z10prop" "z10_super")
+   (set_attr "relative_long" "yes")])
 
 ; clhrl, clghrl
 (define_insn "*cmp_ccu_zerohi_rldi"
@@ -1213,7 +1225,8 @@
   "clhrl\t%0,%1"
   [(set_attr "op_type" "RIL")
(set_attr "type""larl")
-   (set_attr "z10prop" "z10_super")])
+   (set_attr "z10prop" "z10_super")
+   (set_attr "relative_long" "yes")])
 
 (define_insn "*cmpdi_ccu_zero"
   [(set (reg CC_REGNUM)
@@ -1228,7 +1241,8 @@
   [(set_attr "op_type"  "RRE,RXY,RIL")
(set_attr "cpu_facility" "*,*,z10")
(set_attr "type" "*,*,larl")
-   (set_attr "z10prop" "z10_super_c,z10_super_E1,z10_super")])
+   (set_attr "z10prop" "z10_super_c,z10_super_E1,z10_super")
+   (set_attr "relative_long" "*,*,yes")])
 
 (define_insn "*cmpdi_ccu"
   [(set (reg CC_REGNUM)
@@ -1248,7 +1262,8 @@
   [(set_attr "op_type" "RRE,RIL,RIL,SIL,RXY,SS,SS")
(set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*")
(set_attr "type" "*,*,larl,*,*,*,*")
-   (set_attr "z10prop" 
"z10_super_c,z10_super,z10_super,z10_super,z10_super,*,*")])
+   (set_attr "z10prop" 
"z10_super_c,z10_super,z10_super,z10_super,z10_super,*,*")
+   (set_attr "relative_long" "*,*,yes,*,*,*,*")])
 
 (define_insn "*cmpsi_ccu"
   [(set (reg CC_REGNUM)
@@ -1267,7 +1282,8 @@
   [(set_attr "op_type" "RR,RIL,RIL,SIL,RX,RXY,SS,SS")
(set_attr "cpu_facility" "*,extimm,z10,z10,*,longdisp,*,*")
(set_attr "type" "*,*,larl,*,*,*,*,*")
-   (set_attr "z10prop" 
"z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,*,*")])
+   (set_attr "z10prop" 
"z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,*,*")
+   (set_attr "relative_long" "*,*,yes,*,*,*,*,*")])
 
 (define_insn "*cmphi_ccu"
   [(set (reg CC_REGNUM)
@@ -1805,6 +1821,10 @@
 *,
 *,*,*,*,*,*,*,
 z10_super_A1")
+   (set_attr "relative_long" "*,*,*,*,*,*,*,*,*,*,
+  *,yes,*,*,*,*,*,*,*,*,
+  yes,*,*,*,*,*,*,*,*,*,
+  *,*,ye