1;; Machine Description for Altera Nios II synchronization primitives. 2;; Copyright (C) 2014-2021 Free Software Foundation, Inc. 3;; Contributed by Mentor Graphics, Inc. 4;; 5;; This file is part of GCC. 6;; 7;; GCC is free software; you can redistribute it and/or modify 8;; it under the terms of the GNU General Public License as published by 9;; the Free Software Foundation; either version 3, or (at your option) 10;; any later version. 11;; 12;; GCC is distributed in the hope that it will be useful, 13;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15;; GNU General Public License for more details. 16;; 17;; You should have received a copy of the GNU General Public License 18;; along with GCC; see the file COPYING3. If not see 19;; <http://www.gnu.org/licenses/>. 20 21(define_int_iterator UNSPECV_LOAD_EXCLUSIVE [UNSPECV_LDEX UNSPECV_LDSEX]) 22(define_int_attr load_exclusive [(UNSPECV_LDEX "ldex") 23 (UNSPECV_LDSEX "ldsex")]) 24(define_insn "<load_exclusive>" 25 [(set (match_operand:SI 0 "register_operand" "=r") 26 (unspec_volatile:SI 27 [(match_operand:SI 1 "ldstex_memory_operand" "v")] 28 UNSPECV_LOAD_EXCLUSIVE))] 29 "TARGET_ARCH_R2" 30 "<load_exclusive>\\t%0, %A1" 31 [(set_attr "type" "ld")]) 32 33(define_int_iterator UNSPECV_STORE_EXCLUSIVE [UNSPECV_STEX UNSPECV_STSEX]) 34(define_int_attr store_exclusive [(UNSPECV_STEX "stex") 35 (UNSPECV_STSEX "stsex")]) 36(define_insn "<store_exclusive>" 37 [(set (match_operand:SI 2 "register_operand" "=r") 38 (unspec_volatile:SI [(const_int 0)] UNSPECV_STORE_EXCLUSIVE)) 39 (set (match_operand:SI 0 "ldstex_memory_operand" "=v") 40 (unspec_volatile:SI 41 [(match_operand:SI 1 "reg_or_0_operand" "rM")] 42 UNSPECV_STORE_EXCLUSIVE))] 43 "TARGET_ARCH_R2" 44 "<store_exclusive>\\t%2, %z1, %A0" 45 [(set_attr "type" "st")]) 46