;; Machine description for GNU compiler, VAX Version
-;; Copyright (C) 1987-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1987-2024 Free Software Foundation, Inc.
;; This file is part of GCC.
VUNSPEC_PEM ; 'procedure_entry_mask' insn.
])
+;; UNSPEC usage:
+
+(define_c_enum "unspec" [
+ UNSPEC_SETMEM_FILL ; 'fill' operand to 'setmem' insn.
+])
+
(define_constants
[(VAX_AP_REGNUM 12) ; Register 12 contains the argument pointer
(VAX_FP_REGNUM 13) ; Register 13 contains the frame pointer
(define_mode_iterator VAXcc [CC CCN CCNZ CCZ])
(define_mode_iterator VAXccnz [CCN CCNZ CCZ])
-(define_mode_attr cc [(CC "cc") (CCN "ccn") (CCNZ "ccnz") (CCZ "ccz")])
(define_code_iterator any_extract [sign_extract zero_extract])
(include "predicates.md")
;; Make instructions that set the N, N+Z, and Z condition codes respectively.
-(define_subst "subst_<cc>"
+(define_subst "subst_<mode>"
[(set (match_operand 0 "")
(match_operand 1 ""))
(clobber (reg:CC VAX_PSL_REGNUM))]
(set (match_dup 0)
(match_dup 1))])
-(define_subst "subst_f<cc>"
- [(set (match_operand 0 "")
- (match_operand 1 ""))
+(define_subst "subst_f<VAXccnz:mode>"
+ [(set (match_operand:VAXfp 0 "")
+ (match_operand:VAXfp 1 ""))
(clobber (reg:CC VAX_PSL_REGNUM))]
""
[(set (reg:VAXccnz VAX_PSL_REGNUM)
(compare:VAXccnz (match_dup 1)
- (const_double_zero)))
+ (const_double_zero:VAXfp)))
(set (match_dup 0)
(match_dup 1))])
(clobber (reg:CC VAX_PSL_REGNUM))]
"reload_completed"
"movc3 %2,%1,%0")
+
+;; This is here to accept 4 arguments and pass the first 3 along
+;; to the setmemhi1 pattern that really does the work.
+(define_expand "setmemhi"
+ [(set (match_operand:BLK 0 "memory_operand" "")
+ (match_operand:QI 2 "general_operand" ""))
+ (use (match_operand:HI 1 "general_operand" ""))
+ (match_operand 3 "" "")]
+ ""
+ "
+{
+ emit_insn (gen_setmemhi1 (operands[0], operands[1], operands[2]));
+ DONE;
+}")
+
+;; The srcaddr operand of MOVC5 is not dereferenced if srclen is zero, so we
+;; set it to (%ap) somewhat arbitrarily chosen for the shortest encoding.
+(define_insn_and_split "setmemhi1"
+ [(set (match_operand:BLK 0 "memory_operand" "=o")
+ (unspec:BLK [(use (match_operand:QI 2 "general_operand" "g"))]
+ UNSPEC_SETMEM_FILL))
+ (use (match_operand:HI 1 "general_operand" "g"))
+ (clobber (reg:SI 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI 2))
+ (clobber (reg:SI 3))
+ (clobber (reg:SI 4))
+ (clobber (reg:SI 5))]
+ ""
+ "#"
+ "reload_completed"
+ [(parallel
+ [(set (match_dup 0)
+ (unspec:BLK [(use (match_dup 2))] UNSPEC_SETMEM_FILL))
+ (use (match_dup 1))
+ (clobber (reg:SI 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI 2))
+ (clobber (reg:SI 3))
+ (clobber (reg:SI 4))
+ (clobber (reg:SI 5))
+ (clobber (reg:CC VAX_PSL_REGNUM))])]
+ "")
+
+(define_insn "*setmemhi1"
+ [(set (match_operand:BLK 0 "memory_operand" "=o")
+ (unspec:BLK [(use (match_operand:QI 2 "general_operand" "g"))]
+ UNSPEC_SETMEM_FILL))
+ (use (match_operand:HI 1 "general_operand" "g"))
+ (clobber (reg:SI 0))
+ (clobber (reg:SI 1))
+ (clobber (reg:SI 2))
+ (clobber (reg:SI 3))
+ (clobber (reg:SI 4))
+ (clobber (reg:SI 5))
+ (clobber (reg:CC VAX_PSL_REGNUM))]
+ "reload_completed"
+ "movc5 $0,(%%ap),%2,%1,%0")
\f
;; Extension and truncation insns.
;; The following used to be needed because constant propagation can
;; create them starting from the bic insn patterns above. This is no
;; longer a problem. However, having these patterns allows optimization
-;; opportunities in combine.c.
+;; opportunities in combine.cc.
(define_insn_and_split "*and<mode>3_const_int"
[(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g")
;; the "*bit<mode>" pattern does for the purpose of the compare
;; elimination pass. Try to get rid of the extra operation by hand
;; and where the sequence is used to set the condition codes only
-;; convert MNEG/BIC => BIT.
+;; convert MCOM/BIC => BIT.
(define_peephole2
[(parallel
[(set (match_operand:VAXint 0 "register_operand")
(define_insn_and_split "*cbranch<VAXint:mode>4_<VAXcc:mode>"
[(set (pc)
(if_then_else
- (match_operator 0 "vax_<cc>_comparison_operator"
+ (match_operator 0 "vax_<VAXcc:mode>_comparison_operator"
[(match_operand:VAXint 1 "general_operand" "nrmT")
(match_operand:VAXint 2 "general_operand" "nrmT")])
(label_ref (match_operand 3 "" ""))
(define_insn_and_split "*cbranch<VAXfp:mode>4_<VAXccnz:mode>"
[(set (pc)
(if_then_else
- (match_operator 0 "vax_<cc>_comparison_operator"
+ (match_operator 0 "vax_<VAXccnz:mode>_comparison_operator"
[(match_operand:VAXfp 1 "general_operand" "gF")
(match_operand:VAXfp 2 "general_operand" "gF")])
(label_ref (match_operand 3 "" ""))
(define_insn "*branch_<mode>"
[(set (pc)
- (if_then_else (match_operator 0 "vax_<cc>_comparison_operator"
+ (if_then_else (match_operator 0 "vax_<mode>_comparison_operator"
[(reg:VAXcc VAX_PSL_REGNUM)
(const_int 0)])
(label_ref (match_operand 1 "" ""))
;; Recognize reversed jumps.
(define_insn "*branch_<mode>_reversed"
[(set (pc)
- (if_then_else (match_operator 0 "vax_<cc>_comparison_operator"
+ (if_then_else (match_operator 0 "vax_<mode>_comparison_operator"
[(reg:VAXcc VAX_PSL_REGNUM)
(const_int 0)])
(pc)