Data Addressing. NXP CodeWarrior Development Studio
Reklama
Reklama
Data Addressing
Table 21-6 lists the floating point data types
Table 21-6. Power Architecture Floating Point Types
float double long double
Type
32 bits
64 bits
64 bits
Size Range
1.17549e-38 to 3.40282e+38
2.22507e-308 to 1.79769e+308
2.22507e-308 to 1.79769e+308
21.2.5 AltiVec™ Data Types
There are vector
data types for use in writing AltiVec-specific code. (See Table 21-7 ). All the types are a constant size, 16 bytes (128 bits). This is due to the AltiVec programming model which is optimized for quantities of this size.
Table 21-7. AltiVec Vector Data Types
Vector Data Type
vector unsigned char vector signed char vector bool char vector unsigned short [int] vector signed short [int] vector bool short [int] vector unsigned long [int] vector signed long [int] vector bool long [int] vector float vector pixel
Contents
16 unsigned char
16 signed char
16 unsigned char
8 unsigned short
8 signed short
8 unsigned short
4 unsigned int
4 signed int
4 unsigned int
4 float
8 unsigned short
PossibleValues
0 to 255
-128 to 127
0 ("false"), 1 ("true")
0 to 65535
-32768 to 32767
0 ("false"), 1 ("true")
0 to 232 - 1
-231 to 231-1
0 ("false"), 1 ("true") any IEEE-754 value
1/5/5/5 pixel
In Table 21-7 , the
[int]
portion of the Vector Data Type is optional.
There are two additional keywords besides pixel
and vector
,
__pixel
and
__vector
.
The bool
keyword is not a reserved word in C unless it is used as an AltiVec vector data type.
21.3 Data Addressing
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
354 Freescale Semiconductor, Inc.
Chapter 21 Power Architecture Code Generation
In absolute addressing, the compiler generates two instructions to fetch the address of a
variable. For example the compiler translates Listing 21-1 on page 355
into the instructions in
Listing 21-1. Source Code
int red; int redsky; void sky()
{
red = 1;
redsky = 2;
}
Listing 21-2. Generated Code
li r3,1 lis r4,red@ha addi r4,r4,red@l stw r3,0(r4) li r5,2 lis r6,redsky@ha addi r6,r6,redsky@l stw r5,0(r6)
Each variable access takes two instructions and a total of four bytes to make a simple assignment. If you set the small data threshold to be at least the size of an int
data type, the compiler generates instructions to fetch variables with one instruction (
Listing 21-3. Fetching variables with one instruction
li r3,1 stw r3,red li r4,2 stw r4,redsky
Because small data sections are limited in size you might not be able to put all of your application data into the small data and small data2 sections. We recommend that you make the threshold as high as possible until the linker reports that you have exceeded the size of the section.
If you do exceed the available small data space, consider using pooled data.
Because the linker can not deadstrip unused pooled data, you should:
1. Check the Generate Link Map and List Unused Objects checkboxes in the
CodeWarrior IDE's EPPC Linker Properties > C/C++ Build > Settings > Tool
Settings > PowerPC Linker -> Output panel.
2. Link and examine the map for data objects that are reported unused.
3. Delete or comment out those used definitions in your source.
4. Select Properties > C/C++ Build > Settings > Tool Settings > PowerPC Compiler
> Processor, check Check the Pool Data checkbox.
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
Freescale Semiconductor, Inc.
355
Pobierz
Reklama