Skip to content

Commit

Permalink
libast: Fix detection of GCC 4.1+ 64/32-bit atomic operations model
Browse files Browse the repository at this point in the history
This fix to the atomic scalar operations feature tests is from OpenSUSE:
https://build.opensuse.org/package/view_file/shells/ksh/ksh93-aso.dif
  • Loading branch information
McDutchie committed Feb 2, 2021
1 parent 69e18de commit e2c2753
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib/libast/features/aso
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ if aso note{ gcc 4.1+ 64 bit memory atomic operations model }end link{
int main()
{
uint64_t i = 0;
return __sync_fetch_and_add(&i,7);
uint32_t j = 0;
uint16_t l = 0;
uint8_t m = 0;
return __sync_fetch_and_add(&i,7)+__sync_fetch_and_add(&j,7)+__sync_fetch_and_add(&l,7)+__sync_fetch_and_add(&m,7);
}
}end && {
#define _aso_cas8(p,o,n) __sync_val_compare_and_swap(p,o,n)
Expand All @@ -31,7 +34,9 @@ elif aso note{ gcc 4.1+ 32 bit memory atomic operations model }end link{
int main()
{
uint32_t i = 0;
return __sync_fetch_and_add(&i,7);
uint16_t j = 0;
uint8_t l = 0;
return __sync_fetch_and_add(&i,7)+__sync_fetch_and_add(&j,7)+__sync_fetch_and_add(&l,7);
}
}end && {
#define _aso_cas8(p,o,n) __sync_val_compare_and_swap(p,o,n)
Expand Down

0 comments on commit e2c2753

Please sign in to comment.