OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [config/] [m68k/] [sync.md] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 709 jeremybenn
;; GCC machine description for m68k synchronization instructions.
2
;; Copyright (C) 2011, 2012
3
;; Free Software Foundation, 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
;; .
20
 
21
 
22
(define_expand "atomic_compare_and_swap"
23
  [(match_operand:QI 0 "register_operand" "")           ;; bool success output
24
   (match_operand:I 1 "register_operand" "")            ;; oldval output
25
   (match_operand:I 2 "memory_operand" "")              ;; memory
26
   (match_operand:I 3 "register_operand" "")            ;; expected input
27
   (match_operand:I 4 "register_operand" "")            ;; newval input
28
   (match_operand:SI 5 "const_int_operand" "")          ;; is_weak
29
   (match_operand:SI 6 "const_int_operand" "")          ;; success model
30
   (match_operand:SI 7 "const_int_operand" "")]         ;; failure model
31
  "TARGET_CAS"
32
{
33
  emit_insn (gen_atomic_compare_and_swap_1
34
             (operands[0], operands[1], operands[2],
35
              operands[3], operands[4]));
36
  emit_insn (gen_negqi2 (operands[0], operands[0]));
37
  DONE;
38
})
39
 
40
(define_insn "atomic_compare_and_swap_1"
41
  [(set (match_operand:I 1 "register_operand" "=d")
42
        (unspec_volatile:I
43
          [(match_operand:I 2 "memory_operand" "+m")
44
           (match_operand:I 3 "register_operand" "1")
45
           (match_operand:I 4 "register_operand" "d")]
46
          UNSPECV_CAS_1))
47
   (set (match_dup 2)
48
        (unspec_volatile:I
49
          [(match_dup 2) (match_dup 3) (match_dup 4)]
50
          UNSPECV_CAS_2))
51
   (set (match_operand:QI 0 "register_operand" "=d")
52
        (unspec_volatile:QI
53
          [(match_dup 2) (match_dup 3) (match_dup 4)]
54
          UNSPECV_CAS_2))]
55
  "TARGET_CAS"
56
  ;; Elide the seq if operands[0] is dead.
57
  "cas %1,%4,%2\;seq %0")
58
 
59
(define_expand "atomic_test_and_set"
60
  [(match_operand:QI 0 "register_operand" "")           ;; bool success output
61
   (match_operand:QI 1 "memory_operand" "")             ;; memory
62
   (match_operand:SI 2 "const_int_operand" "")]         ;; model
63
  ""
64
{
65
  emit_insn (gen_atomic_test_and_set_1 (operands[0], operands[1]));
66
  emit_insn (gen_negqi2 (operands[0], operands[0]));
67
  DONE;
68
})
69
 
70
(define_insn "atomic_test_and_set_1"
71
  [(set (match_operand:QI 0 "register_operand" "=d")
72
        (unspec_volatile:QI
73
          [(match_operand:QI 1 "memory_operand" "+m")]
74
          UNSPECV_TAS_1))
75
   (set (match_dup 1)
76
        (unspec_volatile:QI [(match_dup 1)] UNSPECV_TAS_2))]
77
  ""
78
  "tas %1\;sne %0")

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.