]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/loongarch/predicates.md
Update copyright years.
[thirdparty/gcc.git] / gcc / config / loongarch / predicates.md
index 946ed0d8212d0bcb313806430138dc2cb5008886..ba5336cfb3ef2300beecd0699f4597bc1a1f7ee1 100644 (file)
@@ -1,5 +1,5 @@
 ;; Predicate definitions for LoongArch target.
-;; Copyright (C) 2021-2023 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2024 Free Software Foundation, Inc.
 ;; Contributed by Loongson Ltd.
 ;; Based on MIPS target for GNU compiler.
 ;;
   (and (match_code "const_int,const_wide_int,const_double,const_vector")
        (match_test "op == CONST1_RTX (GET_MODE (op))")))
 
+(define_predicate "const_vector_1_operand"
+  (and (match_code "const_vector")
+       (match_test "op == CONST1_RTX (GET_MODE (op))")))
+
 (define_predicate "reg_or_1_operand"
   (ior (match_operand 0 "const_1_operand")
        (match_operand 0 "register_operand")))
 
+(define_predicate "reg_or_vecotr_1_operand"
+  (ior (match_operand 0 "const_vector_1_operand")
+       (match_operand 0 "register_operand")))
+
 ;; These are used in vec_merge, hence accept bitmask as const_int.
 (define_predicate "const_exp_2_operand"
   (and (match_code "const_int")
     {
     case SYMBOL_PCREL:
       if (TARGET_CMODEL_EXTREME
-         || (TARGET_CMODEL_MEDIUM && !TARGET_EXPLICIT_RELOCS))
+         || (TARGET_CMODEL_MEDIUM
+             && (la_opt_explicit_relocs == EXPLICIT_RELOCS_NONE)))
        return false;
       else
-       return 1;
+       return true;
 
     case SYMBOL_GOT_DISP:
       if (TARGET_CMODEL_EXTREME
          || !flag_plt
          || (flag_plt && TARGET_CMODEL_MEDIUM
-             && !TARGET_EXPLICIT_RELOCS))
+             && (la_opt_explicit_relocs == EXPLICIT_RELOCS_NONE)))
        return false;
       else
-       return 1;
+       return true;
 
     default:
       return false;
   return loongarch_symbolic_constant_p (op, &type) && type == SYMBOL_PCREL;
 })
 
+(define_predicate "symbolic_pcrel_offset_operand"
+  (and (match_code "plus")
+       (match_operand 0 "symbolic_pcrel_operand")
+       (match_operand 1 "const_int_operand")))
+
+(define_predicate "mem_simple_ldst_operand"
+  (match_code "mem")
+{
+  op = XEXP (op, 0);
+  return (symbolic_pcrel_operand (op, Pmode)
+         || symbolic_pcrel_offset_operand (op, Pmode));
+})
+
 (define_predicate "equality_operator"
   (match_code "eq,ne"))
 
 (define_predicate "loongarch_cstore_operator"
   (match_code "ne,eq,gt,gtu,ge,geu,lt,ltu,le,leu"))
 
+(define_predicate "loongarch_fcmp_operator"
+  (match_code
+    "unordered,uneq,unlt,unle,eq,lt,le,ordered,ltgt,ne,ge,gt,unge,ungt"))
+
 (define_predicate "small_data_pattern"
   (and (match_code "set,parallel,unspec,unspec_volatile,prefetch")
        (match_test "loongarch_small_data_pattern_p (op)")))