S/390: Introduce relative_long attribute
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 6 Nov 2018 13:20:21 +0000 (13:20 +0000)
committerIlya Leoshkevich <iii@gcc.gnu.org>
Tue, 6 Nov 2018 13:20:21 +0000 (13:20 +0000)
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-06  Ilya Leoshkevich  <iii@linux.ibm.com>

PR target/87762
* config/s390/s390.md: Add relative_long attribute.

From-SVN: r265844

gcc/ChangeLog
gcc/config/s390/s390.md

index abe98c3..eb09970 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-06  Ilya Leoshkevich  <iii@linux.ibm.com>
+
+       PR target/87762
+       * config/s390/s390.md: Add relative_long attribute.
+
 2018-11-06  Jan Hubicka  <jh@suse.cz>
 
        * ipa-pure-const.c (check_decl): Do not test TYPE_NEEDS_CONSTRUCTING.
index 4ffd438..957c378 100644 (file)
         ]
        (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")
 
    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")])
 
 
 
   [(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)
    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<mode>_ccs"
   [(set_attr "op_type" "RR<E>,RI,SIL,RIL,RX<Y>,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
   "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<GPR:mode>_ccu_zerohi_rldi"
   "cl<g>hrl\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)
   [(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)
   [(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)
   [(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)
                         *,
                         *,*,*,*,*,*,*,
                         z10_super_A1")
+   (set_attr "relative_long" "*,*,*,*,*,*,*,*,*,*,
+                              *,yes,*,*,*,*,*,*,*,*,
+                              yes,*,*,*,*,*,*,*,*,*,
+                              *,*,yes")
 ])
 
 (define_split
   "larl\t%0,%1"
    [(set_attr "op_type" "RIL")
     (set_attr "type"    "larl")
-    (set_attr "z10prop" "z10_fwd_A1")])
+    (set_attr "z10prop" "z10_fwd_A1")
+    (set_attr "relative_long" "yes")])
 
 (define_insn "*movsi_zarch"
   [(set (match_operand:SI 0 "nonimmediate_operand"
                         *,
                         z10_rec,
                         z10_super,
-                        *,*,*,*,*,*,*")])
+                        *,*,*,*,*,*,*")
+   (set_attr "relative_long" "*,*,*,*,*,yes,*,*,*,*,
+                              *,*,*,*,*,*,*,*,*,*,
+                              *,yes,*,*,*,*,*,*,*,*")])
 
 (define_insn "*movsi_esa"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!*f,!*f,!R,d,t,Q,t")
                        z10_rec,
                        z10_rec,
                        z10_rec,
-                       z10_super,*,*,*,*,*,*")])
+                       z10_super,*,*,*,*,*,*")
+   (set_attr "relative_long" "*,*,*,*,yes,*,*,yes,*,*,*,*,*,*,*")])
 
 (define_peephole2
   [(set (match_operand:HI 0 "register_operand" "")
    (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,floaddf,floaddf,
                      fstoredf,fstoredf,*,lr,load,load,store,store,*,*,*,*,load,store")
    (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,*,*,*,*,*,*")
-   (set_attr "cpu_facility" "z196,*,*,*,*,longdisp,*,longdisp,*,*,z10,*,z10,*,vx,vx,vx,vx,vx,vx")])
+   (set_attr "cpu_facility" "z196,*,*,*,*,longdisp,*,longdisp,*,*,z10,*,z10,*,vx,vx,vx,vx,vx,vx")
+   (set_attr "relative_long" "*,*,*,*,*,*,*,*,*,*,yes,*,yes,*,*,*,*,*,*,*")])
 
 (define_insn "*mov<mode>_64"
   [(set (match_operand:DD_DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,d,d,b,T")
    (set_attr "type"    "fsimpdf,fload<mode>,fload<mode>,fload<mode>,
                         fstore<mode>,fstore<mode>,*,lr,load,load,store,store")
    (set_attr "z10prop" "*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec")
-   (set_attr "cpu_facility" "z196,*,*,longdisp,*,longdisp,*,*,z10,*,z10,*")])
+   (set_attr "cpu_facility" "z196,*,*,longdisp,*,longdisp,*,*,z10,*,z10,*")
+   (set_attr "relative_long" "*,*,*,*,*,*,*,*,yes,*,*,*")])
 
 (define_insn "*mov<mode>_31"
   [(set (match_operand:DD_DF 0 "nonimmediate_operand"
    (set_attr "type"    "fsimpsf,fsimpsf,fload<mode>,fload<mode>,fload<mode>,fload<mode>,
                         fstore<mode>,fstore<mode>,*,lr,load,load,load,store,store,store,*,*,*,*,load,store")
    (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,z10_rec,*,*,*,*,*,*")
-   (set_attr "cpu_facility" "z196,vx,*,vx,*,longdisp,*,longdisp,*,*,z10,*,longdisp,z10,*,longdisp,vx,vx,vx,vx,vx,vx")])
+   (set_attr "cpu_facility" "z196,vx,*,vx,*,longdisp,*,longdisp,*,*,z10,*,longdisp,z10,*,longdisp,vx,vx,vx,vx,vx,vx")
+   (set_attr "relative_long" "*,*,*,*,*,*,*,*,*,*,yes,*,*,yes,*,*,*,*,*,*,*,*")])
 
 ;
 ; movcc instruction pattern
    && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
   "exrl\t%1,%3"
   [(set_attr "op_type" "RIL")
-   (set_attr "type"    "cs")])
+   (set_attr "type"    "cs")
+   (set_attr "relative_long" "yes")])
 
 (define_insn "*execute"
   [(match_parallel 0 "execute_operation"
   [(set_attr "op_type"      "RRE,RXY,RIL")
    (set_attr "type"         "*,*,larl")
    (set_attr "cpu_facility" "*,*,z10")
-   (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
+   (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")
+   (set_attr "relative_long" "*,*,yes")])
 
 ;
 ; extend(hi|qi)(si|di)2 instruction pattern(s).
   [(set_attr "op_type"      "RRE,RXY,RIL")
    (set_attr "type"         "*,*,larl")
    (set_attr "cpu_facility" "extimm,extimm,z10")
-   (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
+   (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")
+   (set_attr "relative_long" "*,*,yes")])
 
 (define_insn "*extendhidi2"
   [(set (match_operand:DI 0 "register_operand" "=d")
   [(set_attr "op_type"      "RRE,RX,RXY,RIL")
    (set_attr "type"         "*,*,*,larl")
    (set_attr "cpu_facility" "extimm,extimm,extimm,z10")
-   (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
+   (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")
+   (set_attr "relative_long" "*,*,*,yes")])
 
 (define_insn "*extendhisi2"
   [(set (match_operand:SI 0 "register_operand" "=d,d")
   [(set_attr "op_type"      "RRE,RXY,RIL")
    (set_attr "type"         "*,*,larl")
    (set_attr "cpu_facility" "*,*,z10")
-   (set_attr "z10prop" "z10_fwd_E1,z10_fwd_A3,z10_fwd_A3")])
+   (set_attr "z10prop" "z10_fwd_E1,z10_fwd_A3,z10_fwd_A3")
+   (set_attr "relative_long" "*,*,yes")])
 
 ;
 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
   [(set_attr "op_type"      "RXY,RRE,RIL")
    (set_attr "type"         "*,*,larl")
    (set_attr "cpu_facility" "*,*,z10")
-   (set_attr "z10prop" "z10_super_E1,z10_fwd_A3,z10_fwd_A3")])
+   (set_attr "z10prop" "z10_super_E1,z10_fwd_A3,z10_fwd_A3")
+   (set_attr "relative_long" "*,*,yes")])
 
 ; llhr, llcr, llghr, llgcr, llh, llc, llgh, llgc
 (define_insn "*zero_extend<HQI:mode><GPR:mode>2_extimm"
   "brasl\t%2,%0"
   [(set_attr "op_type" "RIL")
    (set_attr "type"    "jsr")
-   (set_attr "z196prop" "z196_cracked")])
+   (set_attr "z196prop" "z196_cracked")
+   (set_attr "relative_long" "yes")])
 
 (define_insn "*basr"
   [(call (mem:QI (match_operand 0 "address_operand" "ZR"))
   "brasl\t%3,%1"
   [(set_attr "op_type" "RIL")
    (set_attr "type"    "jsr")
-   (set_attr "z196prop" "z196_cracked")])
+   (set_attr "z196prop" "z196_cracked")
+   (set_attr "relative_long" "yes")])
 
 (define_insn "*basr_r"
   [(set (match_operand 0 "" "")
   "brasl\t%3,%1%J4"
   [(set_attr "op_type" "RIL")
    (set_attr "type"    "jsr")
-   (set_attr "z196prop" "z196_cracked")])
+   (set_attr "z196prop" "z196_cracked")
+   (set_attr "relative_long" "yes")])
 
 (define_insn "*basr_tls"
   [(set (match_operand 0 "" "")
   [(unspec_volatile [(const_int 0)] UNSPECV_NOP_6_BYTE)]
   ""
   "brcl\t0, 0"
-  [(set_attr "op_type" "RIL")])
+  [(set_attr "op_type" "RIL")
+   (set_attr "relative_long" "yes")])
 
 
 ;
   "larl\t%0,%1"
   [(set_attr "op_type" "RIL")
    (set_attr "type"    "larl")
-   (set_attr "z10prop" "z10_fwd_A1")])
+   (set_attr "z10prop" "z10_fwd_A1")
+   (set_attr "relative_long" "yes")])
 
 (define_insn "main_pool"
   [(set (match_operand 0 "register_operand" "=a")
   [(set_attr "type" "load,larl")
    (set_attr "op_type" "RXY,RIL")
    (set_attr "z10prop" "z10_super")
-   (set_attr "z196prop" "z196_alone")])
+   (set_attr "z196prop" "z196_alone")
+   (set_attr "relative_long" "yes")])
 
 
 ;