1.\" $NetBSD: __insn_barrier.3,v 1.4 2017/11/13 09:11:16 wiz Exp $ 2.\" 3.\" Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi> 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25.\" POSSIBILITY OF SUCH DAMAGE. 26.\" 27.Dd January 2, 2011 28.Dt __INSN_BARRIER 3 29.Os 30.Sh NAME 31.Nm __insn_barrier 32.Nd compiler reorder barrier 33.Sh SYNOPSIS 34.In sys/cdefs.h 35.Ft void 36.Fn __insn_barrier 37.Sh DESCRIPTION 38The 39.Fn __insn_barrier 40macro prevents GCC from moving code across the barrier. 41In other words, the compiler is not allowed to reorder read and write 42commands below the barrier with the code preceding the barrier. 43Like with the 44.Em volatile 45type qualifier, 46.Fn __insn_barrier 47may be necessary in some corner cases to prevent the compiler 48from misoptimizing. 49.Sh SEE ALSO 50.Xr gcc 1 , 51.Xr cdefs 3 , 52.Xr membar_ops 3 53.Rs 54.%A Paul E. McKenney 55.%T Memory Barriers: a Hardware View for Software Hackers 56.%D June 7, 2010 57.%U http://www.rdrop.com/users/paulmck/scalability/paper/whymb.2010.06.07c.pdf 58.Re 59.Sh HISTORY 60The 61.Fn __insn_barrier 62macro first appeared in 63.Nx 2.0 . 64