Merge lp:~kwerner/gcc-linaro/lp-681138-4.5 into lp:gcc-linaro/4.5

Proposed by Ken Werner
Status: Merged
Merged at revision: 99464
Proposed branch: lp:~kwerner/gcc-linaro/lp-681138-4.5
Merge into: lp:gcc-linaro/4.5
Diff against target: 165 lines (+68/-12)
3 files modified
ChangeLog.linaro (+12/-0)
gcc/config/arm/arm.c (+40/-4)
gcc/config/arm/sync.md (+16/-8)
To merge this branch: bzr merge lp:~kwerner/gcc-linaro/lp-681138-4.5
Reviewer Review Type Date Requested Status
Linaro Toolchain Developers Pending
Review via email: mp+45707@code.launchpad.net

Description of the change

Fixes LP #681138.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog.linaro'
--- ChangeLog.linaro 2011-01-07 11:49:15 +0000
+++ ChangeLog.linaro 2011-01-10 17:49:33 +0000
@@ -1,3 +1,15 @@
12011-01-10 Ken Werner <ken.werner@de.ibm.com>
2
3 LP: #681138
4 Backport from mainline:
5
6 gcc/
7 * config/arm/sync.md (sync_clobber, sync_t2_reqd): New code attribute.
8 (arm_sync_old_<sync_optab>si, arm_sync_old_<sync_optab><mode>): Use
9 the sync_clobber and sync_t2_reqd code attributes.
10 * config/arm/arm.c (arm_output_sync_loop): Reverse the operation if
11 the t2 argument is NULL.
12
12011-01-07 Andrew Stubbs <ams@codesourcery.com>132011-01-07 Andrew Stubbs <ams@codesourcery.com>
214
3 gcc/15 gcc/
416
=== modified file 'gcc/config/arm/arm.c'
--- gcc/config/arm/arm.c 2011-01-05 18:20:37 +0000
+++ gcc/config/arm/arm.c 2011-01-10 17:49:33 +0000
@@ -23377,10 +23377,46 @@
23377 break;23377 break;
23378 }23378 }
2337923379
23380 arm_output_strex (emit, mode, "", t2, t1, memory);23380 if (t2)
23381 operands[0] = t2;23381 {
23382 arm_output_asm_insn (emit, 0, operands, "teq\t%%0, #0");23382 arm_output_strex (emit, mode, "", t2, t1, memory);
23383 arm_output_asm_insn (emit, 0, operands, "bne\t%sLSYT%%=", LOCAL_LABEL_PREFIX);23383 operands[0] = t2;
23384 arm_output_asm_insn (emit, 0, operands, "teq\t%%0, #0");
23385 arm_output_asm_insn (emit, 0, operands, "bne\t%sLSYT%%=",
23386 LOCAL_LABEL_PREFIX);
23387 }
23388 else
23389 {
23390 /* Use old_value for the return value because for some operations
23391 the old_value can easily be restored. This saves one register. */
23392 arm_output_strex (emit, mode, "", old_value, t1, memory);
23393 operands[0] = old_value;
23394 arm_output_asm_insn (emit, 0, operands, "teq\t%%0, #0");
23395 arm_output_asm_insn (emit, 0, operands, "bne\t%sLSYT%%=",
23396 LOCAL_LABEL_PREFIX);
23397
23398 switch (sync_op)
23399 {
23400 case SYNC_OP_ADD:
23401 arm_output_op3 (emit, "sub", old_value, t1, new_value);
23402 break;
23403
23404 case SYNC_OP_SUB:
23405 arm_output_op3 (emit, "add", old_value, t1, new_value);
23406 break;
23407
23408 case SYNC_OP_XOR:
23409 arm_output_op3 (emit, "eor", old_value, t1, new_value);
23410 break;
23411
23412 case SYNC_OP_NONE:
23413 arm_output_op2 (emit, "mov", old_value, required_value);
23414 break;
23415
23416 default:
23417 gcc_unreachable ();
23418 }
23419 }
2338423420
23385 arm_process_output_memory_barrier (emit, NULL);23421 arm_process_output_memory_barrier (emit, NULL);
23386 arm_output_asm_insn (emit, 1, operands, "%sLSYB%%=:", LOCAL_LABEL_PREFIX);23422 arm_output_asm_insn (emit, 1, operands, "%sLSYB%%=:", LOCAL_LABEL_PREFIX);
2338723423
=== modified file 'gcc/config/arm/sync.md'
--- gcc/config/arm/sync.md 2010-09-13 15:39:11 +0000
+++ gcc/config/arm/sync.md 2011-01-10 17:49:33 +0000
@@ -103,6 +103,18 @@
103 (plus "add")103 (plus "add")
104 (minus "sub")])104 (minus "sub")])
105105
106(define_code_attr sync_clobber [(ior "=&r")
107 (and "=&r")
108 (xor "X")
109 (plus "X")
110 (minus "X")])
111
112(define_code_attr sync_t2_reqd [(ior "4")
113 (and "4")
114 (xor "*")
115 (plus "*")
116 (minus "*")])
117
106(define_expand "sync_<sync_optab>si"118(define_expand "sync_<sync_optab>si"
107 [(match_operand:SI 0 "memory_operand")119 [(match_operand:SI 0 "memory_operand")
108 (match_operand:SI 1 "s_register_operand")120 (match_operand:SI 1 "s_register_operand")
@@ -286,7 +298,6 @@
286 VUNSPEC_SYNC_COMPARE_AND_SWAP))298 VUNSPEC_SYNC_COMPARE_AND_SWAP))
287 (set (match_dup 1) (unspec_volatile:SI [(match_dup 2)]299 (set (match_dup 1) (unspec_volatile:SI [(match_dup 2)]
288 VUNSPEC_SYNC_COMPARE_AND_SWAP))300 VUNSPEC_SYNC_COMPARE_AND_SWAP))
289 (clobber:SI (match_scratch:SI 4 "=&r"))
290 (set (reg:CC CC_REGNUM) (unspec_volatile:CC [(match_dup 1)]301 (set (reg:CC CC_REGNUM) (unspec_volatile:CC [(match_dup 1)]
291 VUNSPEC_SYNC_COMPARE_AND_SWAP))302 VUNSPEC_SYNC_COMPARE_AND_SWAP))
292 ]303 ]
@@ -299,7 +310,6 @@
299 (set_attr "sync_required_value" "2")310 (set_attr "sync_required_value" "2")
300 (set_attr "sync_new_value" "3")311 (set_attr "sync_new_value" "3")
301 (set_attr "sync_t1" "0")312 (set_attr "sync_t1" "0")
302 (set_attr "sync_t2" "4")
303 (set_attr "conds" "clob")313 (set_attr "conds" "clob")
304 (set_attr "predicable" "no")])314 (set_attr "predicable" "no")])
305315
@@ -313,7 +323,6 @@
313 VUNSPEC_SYNC_COMPARE_AND_SWAP)))323 VUNSPEC_SYNC_COMPARE_AND_SWAP)))
314 (set (match_dup 1) (unspec_volatile:NARROW [(match_dup 2)]324 (set (match_dup 1) (unspec_volatile:NARROW [(match_dup 2)]
315 VUNSPEC_SYNC_COMPARE_AND_SWAP))325 VUNSPEC_SYNC_COMPARE_AND_SWAP))
316 (clobber:SI (match_scratch:SI 4 "=&r"))
317 (set (reg:CC CC_REGNUM) (unspec_volatile:CC [(match_dup 1)]326 (set (reg:CC CC_REGNUM) (unspec_volatile:CC [(match_dup 1)]
318 VUNSPEC_SYNC_COMPARE_AND_SWAP))327 VUNSPEC_SYNC_COMPARE_AND_SWAP))
319 ]328 ]
@@ -326,7 +335,6 @@
326 (set_attr "sync_required_value" "2")335 (set_attr "sync_required_value" "2")
327 (set_attr "sync_new_value" "3")336 (set_attr "sync_new_value" "3")
328 (set_attr "sync_t1" "0")337 (set_attr "sync_t1" "0")
329 (set_attr "sync_t2" "4")
330 (set_attr "conds" "clob")338 (set_attr "conds" "clob")
331 (set_attr "predicable" "no")])339 (set_attr "predicable" "no")])
332340
@@ -487,7 +495,7 @@
487 VUNSPEC_SYNC_OLD_OP))495 VUNSPEC_SYNC_OLD_OP))
488 (clobber (reg:CC CC_REGNUM))496 (clobber (reg:CC CC_REGNUM))
489 (clobber (match_scratch:SI 3 "=&r"))497 (clobber (match_scratch:SI 3 "=&r"))
490 (clobber (match_scratch:SI 4 "=&r"))]498 (clobber (match_scratch:SI 4 "<sync_clobber>"))]
491 "TARGET_HAVE_LDREX && TARGET_HAVE_MEMORY_BARRIER"499 "TARGET_HAVE_LDREX && TARGET_HAVE_MEMORY_BARRIER"
492 {500 {
493 return arm_output_sync_insn (insn, operands);501 return arm_output_sync_insn (insn, operands);
@@ -496,7 +504,7 @@
496 (set_attr "sync_memory" "1")504 (set_attr "sync_memory" "1")
497 (set_attr "sync_new_value" "2")505 (set_attr "sync_new_value" "2")
498 (set_attr "sync_t1" "3")506 (set_attr "sync_t1" "3")
499 (set_attr "sync_t2" "4")507 (set_attr "sync_t2" "<sync_t2_reqd>")
500 (set_attr "sync_op" "<sync_optab>")508 (set_attr "sync_op" "<sync_optab>")
501 (set_attr "conds" "clob")509 (set_attr "conds" "clob")
502 (set_attr "predicable" "no")])510 (set_attr "predicable" "no")])
@@ -540,7 +548,7 @@
540 VUNSPEC_SYNC_OLD_OP))548 VUNSPEC_SYNC_OLD_OP))
541 (clobber (reg:CC CC_REGNUM))549 (clobber (reg:CC CC_REGNUM))
542 (clobber (match_scratch:SI 3 "=&r"))550 (clobber (match_scratch:SI 3 "=&r"))
543 (clobber (match_scratch:SI 4 "=&r"))]551 (clobber (match_scratch:SI 4 "<sync_clobber>"))]
544 "TARGET_HAVE_LDREXBHD && TARGET_HAVE_MEMORY_BARRIER"552 "TARGET_HAVE_LDREXBHD && TARGET_HAVE_MEMORY_BARRIER"
545 {553 {
546 return arm_output_sync_insn (insn, operands);554 return arm_output_sync_insn (insn, operands);
@@ -549,7 +557,7 @@
549 (set_attr "sync_memory" "1")557 (set_attr "sync_memory" "1")
550 (set_attr "sync_new_value" "2")558 (set_attr "sync_new_value" "2")
551 (set_attr "sync_t1" "3")559 (set_attr "sync_t1" "3")
552 (set_attr "sync_t2" "4")560 (set_attr "sync_t2" "<sync_t2_reqd>")
553 (set_attr "sync_op" "<sync_optab>")561 (set_attr "sync_op" "<sync_optab>")
554 (set_attr "conds" "clob")562 (set_attr "conds" "clob")
555 (set_attr "predicable" "no")])563 (set_attr "predicable" "no")])

Subscribers

People subscribed via source and target branches