gcc: ARC Built-in Functions
1
1 6.59.4 ARC Built-in Functions
1 -----------------------------
1
1 The following built-in functions are provided for ARC targets. The
1 built-ins generate the corresponding assembly instructions. In the
1 examples given below, the generated code often requires an operand or
1 result to be in a register. Where necessary further code will be
1 generated to ensure this is true, but for brevity this is not described
1 in each case.
1
1 _Note:_ Using a built-in to generate an instruction not supported by a
1 target may cause problems. At present the compiler is not guaranteed to
1 detect such misuse, and as a result an internal compiler error may be
1 generated.
1
1 -- Built-in Function: int __builtin_arc_aligned (void *VAL, int
1 ALIGNVAL)
1 Return 1 if VAL is known to have the byte alignment given by
1 ALIGNVAL, otherwise return 0. Note that this is different from
1 __alignof__(*(char *)VAL) >= alignval
1 because __alignof__ sees only the type of the dereference, whereas
1 __builtin_arc_align uses alignment information from the pointer as
1 well as from the pointed-to type. The information available will
1 depend on optimization level.
1
1 -- Built-in Function: void __builtin_arc_brk (void)
1 Generates
1 brk
1
1 -- Built-in Function: unsigned int __builtin_arc_core_read (unsigned
1 int REGNO)
1 The operand is the number of a register to be read. Generates:
1 mov DEST, rREGNO
1 where the value in DEST will be the result returned from the
1 built-in.
1
1 -- Built-in Function: void __builtin_arc_core_write (unsigned int
1 REGNO, unsigned int VAL)
1 The first operand is the number of a register to be written, the
1 second operand is a compile time constant to write into that
1 register. Generates:
1 mov rREGNO, VAL
1
1 -- Built-in Function: int __builtin_arc_divaw (int A, int B)
1 Only available if either '-mcpu=ARC700' or '-meA' is set.
1 Generates:
1 divaw DEST, A, B
1 where the value in DEST will be the result returned from the
1 built-in.
1
1 -- Built-in Function: void __builtin_arc_flag (unsigned int A)
1 Generates
1 flag A
1
1 -- Built-in Function: unsigned int __builtin_arc_lr (unsigned int AUXR)
1 The operand, AUXV, is the address of an auxiliary register and must
1 be a compile time constant. Generates:
1 lr DEST, [AUXR]
1 Where the value in DEST will be the result returned from the
1 built-in.
1
1 -- Built-in Function: void __builtin_arc_mul64 (int A, int B)
1 Only available with '-mmul64'. Generates:
1 mul64 A, B
1
1 -- Built-in Function: void __builtin_arc_mulu64 (unsigned int A,
1 unsigned int B)
1 Only available with '-mmul64'. Generates:
1 mulu64 A, B
1
1 -- Built-in Function: void __builtin_arc_nop (void)
1 Generates:
1 nop
1
1 -- Built-in Function: int __builtin_arc_norm (int SRC)
1 Only valid if the 'norm' instruction is available through the
1 '-mnorm' option or by default with '-mcpu=ARC700'. Generates:
1 norm DEST, SRC
1 Where the value in DEST will be the result returned from the
1 built-in.
1
1 -- Built-in Function: short int __builtin_arc_normw (short int SRC)
1 Only valid if the 'normw' instruction is available through the
1 '-mnorm' option or by default with '-mcpu=ARC700'. Generates:
1 normw DEST, SRC
1 Where the value in DEST will be the result returned from the
1 built-in.
1
1 -- Built-in Function: void __builtin_arc_rtie (void)
1 Generates:
1 rtie
1
1 -- Built-in Function: void __builtin_arc_sleep (int A
1 Generates:
1 sleep A
1
1 -- Built-in Function: void __builtin_arc_sr (unsigned int AUXR,
1 unsigned int VAL)
1 The first argument, AUXV, is the address of an auxiliary register,
1 the second argument, VAL, is a compile time constant to be written
1 to the register. Generates:
1 sr AUXR, [VAL]
1
1 -- Built-in Function: int __builtin_arc_swap (int SRC)
1 Only valid with '-mswap'. Generates:
1 swap DEST, SRC
1 Where the value in DEST will be the result returned from the
1 built-in.
1
1 -- Built-in Function: void __builtin_arc_swi (void)
1 Generates:
1 swi
1
1 -- Built-in Function: void __builtin_arc_sync (void)
1 Only available with '-mcpu=ARC700'. Generates:
1 sync
1
1 -- Built-in Function: void __builtin_arc_trap_s (unsigned int C)
1 Only available with '-mcpu=ARC700'. Generates:
1 trap_s C
1
1 -- Built-in Function: void __builtin_arc_unimp_s (void)
1 Only available with '-mcpu=ARC700'. Generates:
1 unimp_s
1
1 The instructions generated by the following builtins are not considered
1 as candidates for scheduling. They are not moved around by the compiler
1 during scheduling, and thus can be expected to appear where they are put
1 in the C code:
1 __builtin_arc_brk()
1 __builtin_arc_core_read()
1 __builtin_arc_core_write()
1 __builtin_arc_flag()
1 __builtin_arc_lr()
1 __builtin_arc_sleep()
1 __builtin_arc_sr()
1 __builtin_arc_swi()
1