ObjFW  Check-in [22aea96b79]

Overview
Comment:atomic.h: Use sete instead of the ugly jne.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 22aea96b79d7c75b89387ff49f5a212784d8539fb27a5b4f51ac9368203fb6fe
User & Date: js on 2012-05-30 22:03:24
Other Links: manifest | tags
Context
2012-06-04
22:32
Initial JSON5 support. check-in: 54f80aba7a user: js tags: trunk
2012-05-30
22:03
atomic.h: Use sete instead of the ugly jne. check-in: 22aea96b79 user: js tags: trunk
2012-05-22
12:59
Add -[OFString stringByAppendingPathComponent:]. check-in: 868e1611f4 user: js tags: trunk
Changes

Modified src/atomic.h from [0e0a7c1a99] to [874337cdfb].

635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
	int32_t r;

	__asm__ (
	    "xorl	%0, %0\n\t"
	    "lock\n\t"
	    "cmpxchg	%2, %3\n\t"
	    "jne	0\n\t"
	    "incl	%0\n"
	    "0:"
	    : "=&r"(r)
	    : "a"(o), "r"(n), "m"(*p)
	);

	return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
	return __sync_bool_compare_and_swap(p, o, n);







|
|
<







635
636
637
638
639
640
641
642
643

644
645
646
647
648
649
650
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
	int32_t r;

	__asm__ (
	    "xorl	%0, %0\n\t"
	    "lock\n\t"
	    "cmpxchg	%2, %3\n\t"
	    "sete	%b0\n\t"
	    "movzbl	%b0, %0"

	    : "=&r"(r)
	    : "a"(o), "r"(n), "m"(*p)
	);

	return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
	return __sync_bool_compare_and_swap(p, o, n);
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
	int r;

	__asm__ (
	    "xorl	%0, %0\n\t"
	    "lock\n\t"
	    "cmpxchg	%2, %3\n\t"
	    "jne	0\n\t"
	    "incl	%0\n"
	    "0:"
	    : "=&r"(r)
	    : "a"(o), "r"(n), "m"(*p)
	);

	return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
	return __sync_bool_compare_and_swap(p, o, n);







|
|
<







666
667
668
669
670
671
672
673
674

675
676
677
678
679
680
681
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
	int r;

	__asm__ (
	    "xorl	%0, %0\n\t"
	    "lock\n\t"
	    "cmpxchg	%2, %3\n\t"
	    "sete	%b0\n\t"
	    "movzbl	%b0, %0"

	    : "=&r"(r)
	    : "a"(o), "r"(n), "m"(*p)
	);

	return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
	return __sync_bool_compare_and_swap(p, o, n);
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
	int r;

	__asm__ (
	    "xorl	%0, %0\n\t"
	    "lock\n\t"
	    "cmpxchg	%2, %3\n\t"
	    "jne	0\n\t"
	    "incl	%0\n"
	    "0:"
	    : "=&r"(r)
	    : "a"(o), "r"(n), "m"(*p)
	);

	return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
	return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
	return OSAtomicCompareAndSwapPtrBarrier(o, n, p);
#endif
}







|
|
<











697
698
699
700
701
702
703
704
705

706
707
708
709
710
711
712
713
714
715
716
#elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
	int r;

	__asm__ (
	    "xorl	%0, %0\n\t"
	    "lock\n\t"
	    "cmpxchg	%2, %3\n\t"
	    "sete	%b0\n\t"
	    "movzbl	%b0, %0"

	    : "=&r"(r)
	    : "a"(o), "r"(n), "m"(*p)
	);

	return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
	return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
	return OSAtomicCompareAndSwapPtrBarrier(o, n, p);
#endif
}