FR-V Built-in Functions¶
GCC provides many FR-V-specific built-in functions. In general,
these functions are intended to be compatible with those described
by FR-V Family, Softune C/C++ Compiler Manual (V6), Fujitsu
Semiconductor. The two exceptions are __MDUNPACKH and
__MBTOHE, the GCC forms of which pass 128-bit values by
pointer rather than by value.
Most of the functions are named after specific FR-V instructions. Such functions are said to be ‘directly mapped’ and are summarized here in tabular form.
Argument Types¶
The arguments to the built-in functions can be divided into three groups: register numbers, compile-time constants and run-time values. In order to make this classification clear at a glance, the arguments and return values are given the following pseudo types:
Pseudo type |
Real C type |
Constant? |
Description |
|---|---|---|---|
|
|
No |
an unsigned halfword |
|
|
No |
an unsigned word |
|
|
No |
a signed word |
|
|
No |
an unsigned doubleword |
|
|
No |
a signed doubleword |
|
|
Yes |
an integer constant |
|
|
Yes |
an ACC register number |
|
|
Yes |
an IACC register number |
These pseudo types are not defined by GCC, they are simply a notational convenience used in this manual.
Arguments of type uh, uw1, sw1, uw2
and sw2 are evaluated at run time. They correspond to
register operands in the underlying FR-V instructions.
const arguments represent immediate operands in the underlying
FR-V instructions. They must be compile-time constants.
acc arguments are evaluated at compile time and specify the number
of an accumulator register. For example, an acc argument of 2
selects the ACC2 register.
iacc arguments are similar to acc arguments but specify the
number of an IACC register. See see other-built-in-functions
for more details.
Directly-Mapped Integer Functions¶
The functions listed below map directly to FR-V I-type instructions.
Function prototype |
Example usage |
Assembly output |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Directly-Mapped Media Functions¶
The functions listed below map directly to FR-V M-type instructions.
Function prototype |
Example usage |
Assembly output |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Raw Read/Write Functions¶
This sections describes built-in functions related to read and write
instructions to access memory. These functions generate
membar instructions to flush the I/O load and stores where
appropriate, as described in Fujitsu’s manual described above.
unsigned char __builtin_read8 (void *data)unsigned short __builtin_read16 (void *data)unsigned long __builtin_read32 (void *data)
unsigned long long __builtin_read64 (void *data)
void __builtin_write8 (void *data, unsigned char datum)void __builtin_write16 (void *data, unsigned short datum)void __builtin_write32 (void *data, unsigned long datum)void __builtin_write64 (void *data, unsigned long long datum).. _other-built-in-functions:
Other Built-in Functions¶
This section describes built-in functions that are not named after a specific FR-V instruction.
sw2 __IACCreadll (iacc reg)Return the full 64-bit value of IACC0. The
regargument is reserved for future expansion and must be 0.sw1 __IACCreadl (iacc reg)Return the value of IACC0H if
regis 0 and IACC0L ifregis 1. Other values ofregare rejected as invalid.void __IACCsetll (iacc reg, sw2 x)Set the full 64-bit value of IACC0 to
x. Theregargument is reserved for future expansion and must be 0.void __IACCsetl (iacc reg, sw1 x)Set IACC0H to
xifregis 0 and IACC0L toxifregis 1. Other values ofregare rejected as invalid.void __data_prefetch0 (const void *x)Use the
dcplinstruction to load the contents of addressxinto the data cache.void __data_prefetch (const void *x)Use the
nldubinstruction to load the contents of addressxinto the data cache. The instruction is issued in slot I1.