annotate gcc/config/m68k/sync.md @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ;; GCC machine description for m68k synchronization instructions.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 ;; Copyright (C) 2011-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3 ;;
kono
parents:
diff changeset
4 ;; This file is part of GCC.
kono
parents:
diff changeset
5 ;;
kono
parents:
diff changeset
6 ;; GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
7 ;; it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
8 ;; the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
9 ;; any later version.
kono
parents:
diff changeset
10 ;;
kono
parents:
diff changeset
11 ;; GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
14 ;; GNU General Public License for more details.
kono
parents:
diff changeset
15 ;;
kono
parents:
diff changeset
16 ;; You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 ;; along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 ;; <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 (define_expand "atomic_compare_and_swap<mode>"
kono
parents:
diff changeset
22 [(match_operand:QI 0 "register_operand" "") ;; bool success output
kono
parents:
diff changeset
23 (match_operand:I 1 "register_operand" "") ;; oldval output
kono
parents:
diff changeset
24 (match_operand:I 2 "memory_operand" "") ;; memory
kono
parents:
diff changeset
25 (match_operand:I 3 "register_operand" "") ;; expected input
kono
parents:
diff changeset
26 (match_operand:I 4 "register_operand" "") ;; newval input
kono
parents:
diff changeset
27 (match_operand:SI 5 "const_int_operand" "") ;; is_weak
kono
parents:
diff changeset
28 (match_operand:SI 6 "const_int_operand" "") ;; success model
kono
parents:
diff changeset
29 (match_operand:SI 7 "const_int_operand" "")] ;; failure model
kono
parents:
diff changeset
30 "TARGET_CAS"
kono
parents:
diff changeset
31 {
kono
parents:
diff changeset
32 emit_insn (gen_atomic_compare_and_swap<mode>_1
kono
parents:
diff changeset
33 (operands[0], operands[1], operands[2],
kono
parents:
diff changeset
34 operands[3], operands[4]));
kono
parents:
diff changeset
35 emit_insn (gen_negqi2 (operands[0], operands[0]));
kono
parents:
diff changeset
36 DONE;
kono
parents:
diff changeset
37 })
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 (define_insn "atomic_compare_and_swap<mode>_1"
kono
parents:
diff changeset
40 [(set (match_operand:I 1 "register_operand" "=d")
kono
parents:
diff changeset
41 (unspec_volatile:I
kono
parents:
diff changeset
42 [(match_operand:I 2 "memory_operand" "+m")
kono
parents:
diff changeset
43 (match_operand:I 3 "register_operand" "1")
kono
parents:
diff changeset
44 (match_operand:I 4 "register_operand" "d")]
kono
parents:
diff changeset
45 UNSPECV_CAS_1))
kono
parents:
diff changeset
46 (set (match_dup 2)
kono
parents:
diff changeset
47 (unspec_volatile:I
kono
parents:
diff changeset
48 [(match_dup 2) (match_dup 3) (match_dup 4)]
kono
parents:
diff changeset
49 UNSPECV_CAS_2))
kono
parents:
diff changeset
50 (set (match_operand:QI 0 "register_operand" "=d")
kono
parents:
diff changeset
51 (unspec_volatile:QI
kono
parents:
diff changeset
52 [(match_dup 2) (match_dup 3) (match_dup 4)]
kono
parents:
diff changeset
53 UNSPECV_CAS_2))]
kono
parents:
diff changeset
54 "TARGET_CAS"
kono
parents:
diff changeset
55 ;; Elide the seq if operands[0] is dead.
kono
parents:
diff changeset
56 "cas<sz> %1,%4,%2\;seq %0")
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 (define_expand "atomic_test_and_set"
kono
parents:
diff changeset
59 [(match_operand:QI 0 "register_operand" "") ;; bool success output
kono
parents:
diff changeset
60 (match_operand:QI 1 "memory_operand" "") ;; memory
kono
parents:
diff changeset
61 (match_operand:SI 2 "const_int_operand" "")] ;; model
kono
parents:
diff changeset
62 "ISA_HAS_TAS"
kono
parents:
diff changeset
63 {
kono
parents:
diff changeset
64 rtx t = gen_reg_rtx (QImode);
kono
parents:
diff changeset
65 emit_insn (gen_atomic_test_and_set_1 (t, operands[1]));
kono
parents:
diff changeset
66 t = expand_simple_unop (QImode, NEG, t, operands[0], 0);
kono
parents:
diff changeset
67 if (t != operands[0])
kono
parents:
diff changeset
68 emit_move_insn (operands[0], t);
kono
parents:
diff changeset
69 DONE;
kono
parents:
diff changeset
70 })
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 (define_insn "atomic_test_and_set_1"
kono
parents:
diff changeset
73 [(set (match_operand:QI 0 "register_operand" "=d")
kono
parents:
diff changeset
74 (unspec_volatile:QI
kono
parents:
diff changeset
75 [(match_operand:QI 1 "memory_operand" "+m")]
kono
parents:
diff changeset
76 UNSPECV_TAS_1))
kono
parents:
diff changeset
77 (set (match_dup 1)
kono
parents:
diff changeset
78 (unspec_volatile:QI [(match_dup 1)] UNSPECV_TAS_2))]
kono
parents:
diff changeset
79 "ISA_HAS_TAS"
kono
parents:
diff changeset
80 "tas %1\;sne %0")