Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit89b4d77

Browse files
committed
For PowerPC instruction "addi", use constraint "b".
Without "b", a variant of the tas() code miscompiles on macOS 10.4.This may also fix a compilation failure involving macOS 10.1. Today'scompilers have been allocating acceptable registers with or without thischange, but this future-proofs the code by precisely conveying theacceptable registers. Back-patch to 9.4 (all supported versions).Reviewed by Tom Lane.Discussion:https://postgr.es/m/20191009063900.GA4066266@rfd.leadboat.com
1 parentf25968c commit89b4d77

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎src/include/storage/s_lock.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,11 @@ typedef unsigned int slock_t;
452452
#defineTAS_SPIN(lock)(*(lock) ? 1 : TAS(lock))
453453

454454
/*
455+
* The second operand of addi can hold a constant zero or a register number,
456+
* hence constraint "=&b" to avoid allocating r0. "b" stands for "address
457+
* base register"; most operands having this register-or-zero property are
458+
* address bases, e.g. the second operand of lwax.
459+
*
455460
* NOTE: per the Enhanced PowerPC Architecture manual, v1.0 dated 7-May-2002,
456461
* an isync is a sufficient synchronization barrier after a lwarx/stwcx loop.
457462
* On newer machines, we can use lwsync instead for better performance.
@@ -488,7 +493,7 @@ tas(volatile slock_t *lock)
488493
#endif
489494
"li %1,0\n"
490495

491-
:"=&r"(_t),"=r"(_res),"+m"(*lock)
496+
:"=&b"(_t),"=r"(_res),"+m"(*lock)
492497
:"r"(lock)
493498
:"memory","cc");
494499
return_res;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp