require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_ATOMIC_H_)) {
    eval 'sub _ATOMIC_H_ () {1;}' unless defined(&_ATOMIC_H_);
    unless(defined(&_LOCORE)) {
	eval 'sub i386_atomic_testset_ul {
	    local($ptr,$val) = @_;
    	    eval q({  &__asm__  &volatile (\\"xchgl %0,(%2)\\" :\\"=r\\" ($val):\\"0\\" ($val),\\"r\\" ($ptr)); $val; });
	}' unless defined(&i386_atomic_testset_ul);
	eval 'sub i386_atomic_testset_i {
	    local($ptr,$val) = @_;
    	    eval q({  &__asm__  &volatile (\\"xchgl %0,(%2)\\" :\\"=r\\" ($val):\\"0\\" ($val),\\"r\\" ($ptr)); $val; });
	}' unless defined(&i386_atomic_testset_i);
	eval 'sub i386_atomic_setbits_l {
	    local($ptr,$bits) = @_;
    	    eval q({  &__asm  &__volatile(\\"lock ; orl %1,%0\\" : \\"=m\\" (*$ptr) : \\"ir\\" ($bits)); });
	}' unless defined(&i386_atomic_setbits_l);
	eval 'sub i386_atomic_clearbits_l {
	    local($ptr,$bits) = @_;
    	    eval q({ $bits = ~$bits;  &__asm  &__volatile(\\"lock ; and %1,%0\\" : \\"=m\\" (*$ptr) : \\"ir\\" ($bits)); });
	}' unless defined(&i386_atomic_clearbits_l);
    }
}
1;
