📄 s390.md
字号:
;;- Machine description for GNU compiler -- S/390 / zSeries version.;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005;; Free Software Foundation, Inc.;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and;; Ulrich Weigand (uweigand@de.ibm.com).;; This file is part of GCC.;; GCC is free software; you can redistribute it and/or modify it under;; the terms of the GNU General Public License as published by the Free;; Software Foundation; either version 2, or (at your option) any later;; version.;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY;; WARRANTY; without even the implied warranty of MERCHANTABILITY or;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License;; for more details.;; You should have received a copy of the GNU General Public License;; along with GCC; see the file COPYING. If not, write to the Free;; Software Foundation, 59 Temple Place - Suite 330, Boston, MA;; 02111-1307, USA.;;;; Special constraints for s/390 machine description:;;;; a -- Any address register from 1 to 15.;; c -- Condition code register 33.;; d -- Any register from 0 to 15.;; I -- An 8-bit constant (0..255).;; J -- A 12-bit constant (0..4095).;; K -- A 16-bit constant (-32768..32767).;; L -- Value appropriate as displacement.;; (0..4095) for short displacement;; (-524288..524287) for long displacement;; M -- Constant integer with a value of 0x7fffffff.;; N -- Multiple letter constraint followed by 4 parameter letters.;; 0..9,x: number of the part counting from most to least significant;; H,Q: mode of the part;; D,S,H: mode of the containing operand;; 0,F: value of the other parts (F - all bits set);;;; The constraint matches if the specified part of a constant;; has a value different from its other parts. If the letter x;; is specified instead of a part number, the constraint matches;; if there is any single part with non-default value.;; Q -- Memory reference without index register and with short displacement.;; R -- Memory reference with index register and short displacement.;; S -- Memory reference without index register but with long displacement.;; T -- Memory reference with index register and long displacement.;; A -- Multiple letter constraint followed by Q, R, S, or T:;; Offsettable memory reference of type specified by second letter.;; B -- Multiple letter constraint followed by Q, R, S, or T:;; Memory reference of the type specified by second letter that;; does *not* refer to a literal pool entry.;; U -- Pointer with short displacement.;; W -- Pointer with long displacement.;; Y -- Shift count operand.;;;; Special formats used for outputting 390 instructions.;;;; %C: print opcode suffix for branch condition.;; %D: print opcode suffix for inverse branch condition.;; %J: print tls_load/tls_gdcall/tls_ldcall suffix;; %O: print only the displacement of a memory reference.;; %R: print only the base register of a memory reference.;; %S: print S-type memory reference (base+displacement).;; %N: print the second word of a DImode operand.;; %M: print the second word of a TImode operand.;; %b: print integer X as if it's an unsigned byte.;; %x: print integer X as if it's an unsigned word.;; %h: print integer X as if it's a signed word.;; %i: print the first nonzero HImode part of X;; %j: print the first HImode part unequal to 0xffff of X;;;; We have a special constraint for pattern matching.;;;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.;;;;;; UNSPEC usage;;(define_constants [; Miscellaneous (UNSPEC_ROUND 1) (UNSPEC_CMPINT 2) (UNSPEC_SETHIGH 10) ; GOT/PLT and lt-relative accesses (UNSPEC_LTREL_OFFSET 100) (UNSPEC_LTREL_BASE 101) (UNSPEC_GOTENT 110) (UNSPEC_GOT 111) (UNSPEC_GOTOFF 112) (UNSPEC_PLT 113) (UNSPEC_PLTOFF 114) ; Literal pool (UNSPEC_RELOAD_BASE 210) (UNSPEC_MAIN_BASE 211) (UNSPEC_LTREF 212) (UNSPEC_INSN 213) (UNSPEC_EXECUTE 214) ; TLS relocation specifiers (UNSPEC_TLSGD 500) (UNSPEC_TLSLDM 501) (UNSPEC_NTPOFF 502) (UNSPEC_DTPOFF 503) (UNSPEC_GOTNTPOFF 504) (UNSPEC_INDNTPOFF 505) ; TLS support (UNSPEC_TLSLDM_NTPOFF 511) (UNSPEC_TLS_LOAD 512) ; String Functions (UNSPEC_SRST 600) ]);;;; UNSPEC_VOLATILE usage;;(define_constants [; Blockage (UNSPECV_BLOCKAGE 0) ; TPF Support (UNSPECV_TPF_PROLOGUE 20) (UNSPECV_TPF_EPILOGUE 21) ; Literal pool (UNSPECV_POOL 200) (UNSPECV_POOL_SECTION 201) (UNSPECV_POOL_ALIGN 202) (UNSPECV_POOL_ENTRY 203) (UNSPECV_MAIN_POOL 300) ; TLS support (UNSPECV_SET_TP 500) ]);; Instruction operand type as used in the Principles of Operation.;; Used to determine defaults for length and other attribute values.(define_attr "op_type" "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY" (const_string "NN"));; Instruction type attribute used for scheduling.(define_attr "type" "none,integer,load,lr,la,larl,lm,stm, cs,vs,store,imul,idiv, branch,jsr,fsimpd,fsimps, floadd,floads,fstored, fstores, fmuld,fmuls,fdivd,fdivs, ftoi,itof,fsqrtd,fsqrts, other" (cond [(eq_attr "op_type" "NN") (const_string "other") (eq_attr "op_type" "SS") (const_string "cs")] (const_string "integer")));; Another attribute used for scheduling purposes:;; agen: Instruction uses the address generation unit;; reg: Instruction does not use the agen unit(define_attr "atype" "agen,reg" (cond [(eq_attr "op_type" "E") (const_string "reg") (eq_attr "op_type" "RR") (const_string "reg") (eq_attr "op_type" "RX") (const_string "agen") (eq_attr "op_type" "RI") (const_string "reg") (eq_attr "op_type" "RRE") (const_string "reg") (eq_attr "op_type" "RS") (const_string "agen") (eq_attr "op_type" "RSI") (const_string "agen") (eq_attr "op_type" "S") (const_string "agen") (eq_attr "op_type" "SI") (const_string "agen") (eq_attr "op_type" "SS") (const_string "agen") (eq_attr "op_type" "SSE") (const_string "agen") (eq_attr "op_type" "RXE") (const_string "agen") (eq_attr "op_type" "RSE") (const_string "agen") (eq_attr "op_type" "RIL") (const_string "agen") (eq_attr "op_type" "RXY") (const_string "agen") (eq_attr "op_type" "RSY") (const_string "agen") (eq_attr "op_type" "SIY") (const_string "agen")] (const_string "agen")));; Length in bytes.(define_attr "length" "" (cond [(eq_attr "op_type" "E") (const_int 2) (eq_attr "op_type" "RR") (const_int 2) (eq_attr "op_type" "RX") (const_int 4) (eq_attr "op_type" "RI") (const_int 4) (eq_attr "op_type" "RRE") (const_int 4) (eq_attr "op_type" "RS") (const_int 4) (eq_attr "op_type" "RSI") (const_int 4) (eq_attr "op_type" "S") (const_int 4) (eq_attr "op_type" "SI") (const_int 4) (eq_attr "op_type" "SS") (const_int 6) (eq_attr "op_type" "SSE") (const_int 6) (eq_attr "op_type" "RXE") (const_int 6) (eq_attr "op_type" "RSE") (const_int 6) (eq_attr "op_type" "RIL") (const_int 6) (eq_attr "op_type" "RXY") (const_int 6) (eq_attr "op_type" "RSY") (const_int 6) (eq_attr "op_type" "SIY") (const_int 6)] (const_int 6)));; Processor type. This attribute must exactly match the processor_type;; enumeration in s390.h. The current machine description does not;; distinguish between g5 and g6, but there are differences between the two;; CPUs could in theory be modeled.(define_attr "cpu" "g5,g6,z900,z990" (const (symbol_ref "s390_tune")));; Pipeline description for z900. For lack of anything better,;; this description is also used for the g5 and g6.(include "2064.md");; Pipeline description for z990. (include "2084.md");;;;- Compare instructions.;;(define_expand "cmpdi" [(set (reg:CC 33) (compare:CC (match_operand:DI 0 "register_operand" "") (match_operand:DI 1 "general_operand" "")))] "TARGET_64BIT"{ s390_compare_op0 = operands[0]; s390_compare_op1 = operands[1]; DONE;})(define_expand "cmpsi" [(set (reg:CC 33) (compare:CC (match_operand:SI 0 "register_operand" "") (match_operand:SI 1 "general_operand" "")))] ""{ s390_compare_op0 = operands[0]; s390_compare_op1 = operands[1]; DONE;})(define_expand "cmpdf" [(set (reg:CC 33) (compare:CC (match_operand:DF 0 "register_operand" "") (match_operand:DF 1 "general_operand" "")))] "TARGET_HARD_FLOAT"{ s390_compare_op0 = operands[0]; s390_compare_op1 = operands[1]; DONE;})(define_expand "cmpsf" [(set (reg:CC 33) (compare:CC (match_operand:SF 0 "register_operand" "") (match_operand:SF 1 "general_operand" "")))] "TARGET_HARD_FLOAT"{ s390_compare_op0 = operands[0]; s390_compare_op1 = operands[1]; DONE;}); Test-under-Mask instructions(define_insn "*tmqi_mem" [(set (reg 33) (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S") (match_operand:QI 1 "immediate_operand" "n,n")) (match_operand:QI 2 "immediate_operand" "n,n")))] "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))" "@ tm\t%S0,%b1 tmy\t%S0,%b1" [(set_attr "op_type" "SI,SIY")])(define_insn "*tmdi_reg" [(set (reg 33) (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d") (match_operand:DI 1 "immediate_operand" "N0HD0,N1HD0,N2HD0,N3HD0")) (match_operand:DI 2 "immediate_operand" "n,n,n,n")))] "TARGET_64BIT && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1)) && s390_single_part (operands[1], DImode, HImode, 0) >= 0" "@ tmhh\t%0,%i1 tmhl\t%0,%i1 tmlh\t%0,%i1 tmll\t%0,%i1" [(set_attr "op_type" "RI")])(define_insn "*tmsi_reg" [(set (reg 33) (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d") (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0")) (match_operand:SI 2 "immediate_operand" "n,n")))] "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1)) && s390_single_part (operands[1], SImode, HImode, 0) >= 0" "@ tmh\t%0,%i1 tml\t%0,%i1" [(set_attr "op_type" "RI")])(define_insn "*tmhi_full" [(set (reg 33) (compare (match_operand:HI 0 "register_operand" "d") (match_operand:HI 1 "immediate_operand" "n")))] "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))" "tml\t%0,65535" [(set_attr "op_type" "RI")])(define_insn "*tmqi_full" [(set (reg 33) (compare (match_operand:QI 0 "register_operand" "d") (match_operand:QI 1 "immediate_operand" "n")))] "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))" "tml\t%0,255" [(set_attr "op_type" "RI")]); Load-and-Test instructions(define_insn "*tstdi_sign" [(set (reg 33) (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0) (const_int 32)) (const_int 32)) (match_operand:DI 1 "const0_operand" ""))) (set (match_operand:DI 2 "register_operand" "=d") (sign_extend:DI (match_dup 0)))] "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT" "ltgfr\t%2,%0" [(set_attr "op_type" "RRE")])(define_insn "*tstdi" [(set (reg 33) (compare (match_operand:DI 0 "register_operand" "d") (match_operand:DI 1 "const0_operand" ""))) (set (match_operand:DI 2 "register_operand" "=d") (match_dup 0))] "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT" "ltgr\t%2,%0" [(set_attr "op_type" "RRE")])(define_insn "*tstdi_cconly" [(set (reg 33) (compare (match_operand:DI 0 "register_operand" "d") (match_operand:DI 1 "const0_operand" "")))] "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT" "ltgr\t%0,%0" [(set_attr "op_type" "RRE")])(define_insn "*tstdi_cconly_31" [(set (reg 33) (compare (match_operand:DI 0 "register_operand" "d") (match_operand:DI 1 "const0_operand" "")))] "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT" "srda\t%0,0" [(set_attr "op_type" "RS") (set_attr "atype" "reg")])(define_insn "*tstsi" [(set (reg 33) (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S") (match_operand:SI 1 "const0_operand" ""))) (set (match_operand:SI 2 "register_operand" "=d,d,d") (match_dup 0))] "s390_match_ccmode(insn, CCSmode)" "@ ltr\t%2,%0 icm\t%2,15,%S0 icmy\t%2,15,%S0" [(set_attr "op_type" "RR,RS,RSY")])(define_insn "*tstsi_cconly" [(set (reg 33) (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S") (match_operand:SI 1 "const0_operand" ""))) (clobber (match_scratch:SI 2 "=X,d,d"))] "s390_match_ccmode(insn, CCSmode)" "@ ltr\t%0,%0 icm\t%2,15,%S0 icmy\t%2,15,%S0" [(set_attr "op_type" "RR,RS,RSY")])(define_insn "*tstsi_cconly2" [(set (reg 33) (compare (match_operand:SI 0 "register_operand" "d") (match_operand:SI 1 "const0_operand" "")))] "s390_match_ccmode(insn, CCSmode)" "ltr\t%0,%0" [(set_attr "op_type" "RR")])(define_insn "*tsthiCCT" [(set (reg 33) (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d") (match_operand:HI 1 "const0_operand" ""))) (set (match_operand:HI 2 "register_operand" "=d,d,0") (match_dup 0))] "s390_match_ccmode(insn, CCTmode)" "@ icm\t%2,3,%S0 icmy\t%2,3,%S0 tml\t%0,65535" [(set_attr "op_type" "RS,RSY,RI")])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -