1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
2010-09-13 Andrew Stubbs <ams@codesourcery.com>
Backport from FSF:
2010-09-13 Marcus Shawcroft <marcus.shawcroft@arm.com>
* config/arm/arm.md: (define_attr "conds"): Update comment.
* config/arm/sync.md (arm_sync_compare_and_swapsi): Change
conds attribute to clob.
(arm_sync_compare_and_swapsi): Likewise.
(arm_sync_compare_and_swap<mode>): Likewise.
(arm_sync_lock_test_and_setsi): Likewise.
(arm_sync_lock_test_and_set<mode>): Likewise.
(arm_sync_new_<sync_optab>si): Likewise.
(arm_sync_new_nandsi): Likewise.
(arm_sync_new_<sync_optab><mode>): Likewise.
(arm_sync_new_nand<mode>): Likewise.
(arm_sync_old_<sync_optab>si): Likewise.
(arm_sync_old_nandsi): Likewise.
(arm_sync_old_<sync_optab><mode>): Likewise.
(arm_sync_old_nand<mode>): Likewise.
2010-09-13 Marcus Shawcroft <marcus.shawcroft@arm.com>
* gcc.target/arm/sync-1.c: New.
2010-09-10 Andrew Stubbs <ams@codesourcery.com>
gcc/
=== modified file 'gcc/config/arm/arm.md'
--- old/gcc/config/arm/arm.md 2010-09-09 15:03:00 +0000
+++ new/gcc/config/arm/arm.md 2010-09-13 15:39:11 +0000
@@ -352,10 +352,11 @@
; CLOB means that the condition codes are altered in an undefined manner, if
; they are altered at all
;
-; UNCONDITIONAL means the instions can not be conditionally executed.
+; UNCONDITIONAL means the instruction can not be conditionally executed and
+; that the instruction does not use or alter the condition codes.
;
-; NOCOND means that the condition codes are neither altered nor affect the
-; output of this insn
+; NOCOND means that the instruction does not use or alter the condition
+; codes but can be converted into a conditionally exectuted instruction.
(define_attr "conds" "use,set,clob,unconditional,nocond"
(if_then_else (eq_attr "type" "call")
=== modified file 'gcc/config/arm/sync.md'
--- old/gcc/config/arm/sync.md 2010-09-09 15:18:16 +0000
+++ new/gcc/config/arm/sync.md 2010-09-13 15:39:11 +0000
@@ -300,7 +300,7 @@
(set_attr "sync_new_value" "3")
(set_attr "sync_t1" "0")
(set_attr "sync_t2" "4")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "arm_sync_compare_and_swap<mode>"
@@ -327,7 +327,7 @@
(set_attr "sync_new_value" "3")
(set_attr "sync_t1" "0")
(set_attr "sync_t2" "4")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "arm_sync_lock_test_and_setsi"
@@ -348,7 +348,7 @@
(set_attr "sync_new_value" "2")
(set_attr "sync_t1" "0")
(set_attr "sync_t2" "3")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "arm_sync_lock_test_and_set<mode>"
@@ -369,7 +369,7 @@
(set_attr "sync_new_value" "2")
(set_attr "sync_t1" "0")
(set_attr "sync_t2" "3")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "arm_sync_new_<sync_optab>si"
@@ -394,7 +394,7 @@
(set_attr "sync_t1" "0")
(set_attr "sync_t2" "3")
(set_attr "sync_op" "<sync_optab>")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "arm_sync_new_nandsi"
@@ -419,7 +419,7 @@
(set_attr "sync_t1" "0")
(set_attr "sync_t2" "3")
(set_attr "sync_op" "nand")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "arm_sync_new_<sync_optab><mode>"
@@ -445,7 +445,7 @@
(set_attr "sync_t1" "0")
(set_attr "sync_t2" "3")
(set_attr "sync_op" "<sync_optab>")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "arm_sync_new_nand<mode>"
@@ -472,7 +472,7 @@
(set_attr "sync_t1" "0")
(set_attr "sync_t2" "3")
(set_attr "sync_op" "nand")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "arm_sync_old_<sync_optab>si"
@@ -498,7 +498,7 @@
(set_attr "sync_t1" "3")
(set_attr "sync_t2" "4")
(set_attr "sync_op" "<sync_optab>")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "arm_sync_old_nandsi"
@@ -524,7 +524,7 @@
(set_attr "sync_t1" "3")
(set_attr "sync_t2" "4")
(set_attr "sync_op" "nand")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "arm_sync_old_<sync_optab><mode>"
@@ -551,7 +551,7 @@
(set_attr "sync_t1" "3")
(set_attr "sync_t2" "4")
(set_attr "sync_op" "<sync_optab>")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "arm_sync_old_nand<mode>"
@@ -578,7 +578,7 @@
(set_attr "sync_t1" "3")
(set_attr "sync_t2" "4")
(set_attr "sync_op" "nand")
- (set_attr "conds" "nocond")
+ (set_attr "conds" "clob")
(set_attr "predicable" "no")])
(define_insn "*memory_barrier"
=== added file 'gcc/testsuite/gcc.target/arm/sync-1.c'
--- old/gcc/testsuite/gcc.target/arm/sync-1.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/sync-1.c 2010-09-13 15:39:11 +0000
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -march=armv7-a" } */
+
+volatile int mem;
+
+int
+bar (int x, int y)
+{
+ if (x)
+ __sync_fetch_and_add(&mem, y);
+ return 0;
+}
+
+extern void abort (void);
+
+int
+main (int argc, char *argv[])
+{
+ mem = 0;
+ bar (0, 1);
+ bar (1, 1);
+ if (mem != 1)
+ abort ();
+ return 0;
+}
|