xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/microblaze/sync.md (revision d16b7486a53dcb8072b60ec6fcb4373a2d0c27b7)
1;; Machine description for Xilinx MicroBlaze synchronization instructions.
2;; Copyright (C) 2011-2020 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 it
7;; under the terms of the GNU General Public License as published
8;; by the Free Software Foundation; either version 3, or (at your
9;; option) any later version.
10;;
11;; GCC is distributed in the hope that it will be useful, but WITHOUT
12;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
14;; 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_insn "atomic_compare_and_swapsi"
21  [(match_operand:SI 0 "register_operand" "=&d")	;; bool output
22   (match_operand:SI 1 "register_operand" "=&d")	;; val output
23   (match_operand:SI 2 "nonimmediate_operand" "+Q")	;; memory
24   (match_operand:SI 3 "register_operand" "d")		;; expected value
25   (match_operand:SI 4 "register_operand" "d")		;; desired value
26   (match_operand:SI 5 "const_int_operand" "")		;; is_weak
27   (match_operand:SI 6 "const_int_operand" "")		;; mod_s
28   (match_operand:SI 7 "const_int_operand" "")		;; mod_f
29   (clobber (match_scratch:SI 8 "=&d"))]
30  ""
31  {
32    output_asm_insn ("addc \tr0,r0,r0", operands);
33    output_asm_insn ("lwx  \t%1,%y2,r0", operands);
34    output_asm_insn ("addic\t%8,r0,0", operands);
35    output_asm_insn ("bnei \t%8,.-8", operands);
36    output_asm_insn ("cmp  \t%0,%1,%3", operands);
37    output_asm_insn ("bnei \t%0,.+16", operands);
38    output_asm_insn ("swx  \t%4,%y2,r0", operands);
39    output_asm_insn ("addic\t%8,r0,0", operands);
40    output_asm_insn ("bnei \t%8,.-28", operands);
41    return "";
42  }
43)
44