6.58.4 ARC Built-in Functions

The following built-in functions are provided for ARC targets. The
built-ins generate the corresponding assembly instructions. In the
examples given below, the generated code often requires an operand or
result to be in a register. Where necessary further code will be
generated to ensure this is true, but for brevity this is not
described in each case.

Note: Using a built-in to generate an instruction not supported
by a target may cause problems. At present the compiler is not
guaranteed to detect such misuse, and as a result an internal compiler
error may be generated.

Built-in Function: int__builtin_arc_aligned(void *val, int alignval)

Return 1 if val is known to have the byte alignment given
by alignval, otherwise return 0.
Note that this is different from

__alignof__(*(char *)val) >= alignval

because __alignof__ sees only the type of the dereference, whereas
__builtin_arc_align uses alignment information from the pointer
as well as from the pointed-to type.
The information available will depend on optimization level.

The first argument, auxv, is the address of an auxiliary
register, the second argument, val, is a compile time constant
to be written to the register. Generates:

sr auxr, [val]

Built-in Function: int__builtin_arc_swap(int src)

Only valid with -mswap. Generates:

swap dest, src

Where the value in dest will be the result returned from the
built-in.

Built-in Function: void__builtin_arc_swi(void)

Generates:

swi

Built-in Function: void__builtin_arc_sync(void)

Only available with -mcpu=ARC700. Generates:

sync

Built-in Function: void__builtin_arc_trap_s(unsigned int c)

Only available with -mcpu=ARC700. Generates:

trap_s c

Built-in Function: void__builtin_arc_unimp_s(void)

Only available with -mcpu=ARC700. Generates:

unimp_s

The instructions generated by the following builtins are not
considered as candidates for scheduling. They are not moved around by
the compiler during scheduling, and thus can be expected to appear
where they are put in the C code: