1ace9bad4SMark Rutlandcat << EOF
2*9257959aSMark Rutland	${int} c = raw_${atomic}_read(v);
3ace9bad4SMark Rutland
4ace9bad4SMark Rutland	do {
5ace9bad4SMark Rutland		if (unlikely(c == u))
6ace9bad4SMark Rutland			break;
7*9257959aSMark Rutland	} while (!raw_${atomic}_try_cmpxchg(v, &c, c + a));
8ace9bad4SMark Rutland
9ace9bad4SMark Rutland	return c;
10ace9bad4SMark RutlandEOF
11