Home | History | Annotate | Line # | Download | only in gcn
      1 ;; Constraint definitions for GCN.
      2 ;; Copyright (C) 2016-2022 Free Software Foundation, Inc.
      3 ;;
      4 ;; This file is part of GCC.
      5 ;;
      6 ;; GCC is free software; you can redistribute it and/or modify
      7 ;; it under the terms of the GNU General Public License as published by
      8 ;; the Free Software Foundation; either version 3, or (at your option)
      9 ;; any later version.
     10 ;;
     11 ;; GCC is distributed in the hope that it will be useful,
     12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ;; GNU General Public License for more details.
     15 ;;
     16 ;; You should have received a copy of the GNU General Public License
     17 ;; along with GCC; see the file COPYING3.  If not see
     18 ;; <http://www.gnu.org/licenses/>.
     19 
     20 (define_constraint "I"
     21   "Inline integer constant"
     22   (and (match_code "const_int")
     23        (match_test "ival >= -16 && ival <= 64")))
     24 
     25 (define_constraint "J"
     26   "Signed integer 16-bit inline constant"
     27   (and (match_code "const_int")
     28        (match_test "((unsigned HOST_WIDE_INT) ival + 0x8000) < 0x10000")))
     29 
     30 (define_constraint "Kf"
     31   "Immeditate constant -1"
     32   (and (match_code "const_int")
     33        (match_test "ival == -1")))
     34 
     35 (define_constraint "L"
     36   "Unsigned integer 15-bit constant"
     37   (and (match_code "const_int")
     38        (match_test "((unsigned HOST_WIDE_INT) ival) < 0x8000")))
     39 
     40 (define_constraint "A"
     41   "Inline immediate parameter"
     42   (and (match_code "const_int,const_double,const_vector")
     43        (match_test "gcn_inline_constant_p (op)")))
     44 
     45 (define_constraint "B"
     46   "Immediate 32-bit parameter"
     47   (and (match_code "const_int,const_double,const_vector")
     48 	(match_test "gcn_constant_p (op)")))
     49 
     50 (define_constraint "C"
     51   "Immediate 32-bit parameter zero-extended to 64-bits"
     52   (and (match_code "const_int,const_double,const_vector")
     53 	(match_test "gcn_constant64_p (op)")))
     54 
     55 (define_constraint "DA"
     56   "Immediate 64-bit parameter, low and high part match 'A'"
     57   (and (match_code "const_int,const_double,const_vector")
     58        (match_test "gcn_inline_constant64_p (op, 0)")))
     59 
     60 (define_constraint "Db"
     61   "Immediate 64-bit parameter, low part matches 'B', high part matches 'A'"
     62   (and (match_code "const_int,const_double,const_vector")
     63        (match_test "gcn_inline_constant64_p (op, 1)")))
     64 
     65 (define_constraint "DB"
     66   "Immediate 64-bit parameter, low and high part match 'B'"
     67   (match_code "const_int,const_double,const_vector"))
     68 
     69 (define_constraint "U"
     70   "unspecified value"
     71   (match_code "unspec"))
     72 
     73 (define_constraint "Y"
     74   "Symbol or label for relative calls"
     75   (match_code "symbol_ref,label_ref"))
     76 
     77 (define_register_constraint "v" "VGPR_REGS"
     78   "VGPR registers")
     79 
     80 (define_register_constraint "Sg" "SGPR_REGS"
     81   "SGPR registers")
     82 
     83 (define_register_constraint "SD" "SGPR_DST_REGS"
     84   "registers useable as a destination of scalar operation")
     85 
     86 (define_register_constraint "SS" "SGPR_SRC_REGS"
     87   "registers useable as a source of scalar operation")
     88 
     89 (define_register_constraint "Sm" "SGPR_MEM_SRC_REGS"
     90   "registers useable as a source of scalar memory operation")
     91 
     92 (define_register_constraint "Sv" "SGPR_VOP_SRC_REGS"
     93   "registers useable as a source of VOP3A instruction")
     94 
     95 (define_register_constraint "ca" "ALL_CONDITIONAL_REGS"
     96   "SCC VCCZ or EXECZ")
     97 
     98 (define_register_constraint "cs" "SCC_CONDITIONAL_REG"
     99   "SCC")
    100 
    101 (define_register_constraint "cV" "VCC_CONDITIONAL_REG"
    102   "VCC")
    103 
    104 (define_register_constraint "e" "EXEC_MASK_REG"
    105   "EXEC")
    106 
    107 (define_special_memory_constraint "RB"
    108   "Buffer memory address to scratch memory."
    109   (and (match_code "mem")
    110        (match_test "AS_SCRATCH_P (MEM_ADDR_SPACE (op))")))
    111 
    112 (define_special_memory_constraint "RF"
    113   "Buffer memory address to flat memory."
    114   (and (match_code "mem")
    115        (match_test "AS_FLAT_P (MEM_ADDR_SPACE (op))
    116 		    && gcn_flat_address_p (XEXP (op, 0), mode)")))
    117 
    118 (define_special_memory_constraint "RS"
    119   "Buffer memory address to scalar flat memory."
    120   (and (match_code "mem")
    121        (match_test "AS_SCALAR_FLAT_P (MEM_ADDR_SPACE (op))
    122 		    && gcn_scalar_flat_mem_p (op)")))
    123 
    124 (define_special_memory_constraint "RL"
    125   "Buffer memory address to LDS memory."
    126   (and (match_code "mem")
    127        (match_test "AS_LDS_P (MEM_ADDR_SPACE (op))")))
    128 
    129 (define_special_memory_constraint "RG"
    130   "Buffer memory address to GDS memory."
    131   (and (match_code "mem")
    132        (match_test "AS_GDS_P (MEM_ADDR_SPACE (op))")))
    133 
    134 (define_special_memory_constraint "RD"
    135   "Buffer memory address to GDS or LDS memory."
    136   (and (match_code "mem")
    137        (ior (match_test "AS_GDS_P (MEM_ADDR_SPACE (op))")
    138 	    (match_test "AS_LDS_P (MEM_ADDR_SPACE (op))"))))
    139 
    140 (define_special_memory_constraint "RM"
    141   "Memory address to global (main) memory."
    142   (and (match_code "mem")
    143        (match_test "AS_GLOBAL_P (MEM_ADDR_SPACE (op))
    144 		    && gcn_global_address_p (XEXP (op, 0))")))
    145