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.
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) >= alignvalbecause __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 operand is the number of a register to be read. Generates:
mov dest, rregnowhere the value in dest will be the result returned from the built-in.
The first operand is the number of a register to be written, the second operand is a compile time constant to write into that register. Generates:
mov rregno, val
Only available if either -mcpu=ARC700 or -meA is set. Generates:
divaw dest, a, bwhere the value in dest will be the result returned from the built-in.
The operand, auxv, is the address of an auxiliary register and must be a compile time constant. Generates:
lr dest, [auxr]Where the value in dest will be the result returned from the built-in.
Only available with -mmul64. Generates:
mul64 a, b
Only available with -mmul64. Generates:
mulu64 a, b
Only valid if the ‘norm’ instruction is available through the -mnorm option or by default with -mcpu=ARC700. Generates:
norm dest, srcWhere the value in dest will be the result returned from the built-in.
Only valid if the ‘normw’ instruction is available through the -mnorm option or by default with -mcpu=ARC700. Generates:
normw dest, srcWhere the value in dest will be the result returned from the built-in.
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]
Only valid with -mswap. Generates:
swap dest, srcWhere the value in dest will be the result returned from the built-in.
Only available with -mcpu=ARC700. Generates:
sync
Only available with -mcpu=ARC700. Generates:
trap_s c
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:
__builtin_arc_brk() __builtin_arc_core_read() __builtin_arc_core_write() __builtin_arc_flag() __builtin_arc_lr() __builtin_arc_sleep() __builtin_arc_sr() __builtin_arc_swi()