Andes Workshop

It is currently Fri Mar 29, 2024 1:15 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: globe pointer($gp) introduce
PostPosted: Mon Sep 15, 2014 4:08 pm 
Offline

Joined: Thu Apr 03, 2014 10:09 am
Posts: 42
1、globe pointer($gp) define
1.1、It is the address in the middle of data sections.
1.2、Linker places scalar data around it so that they can be accessed efficiently by $gp-based load/store instructions and their addresses can be calculated efficiently by $gp-based add instructions.

2、$gp relative instruction
2.1、swi.gp Rt,[+(imm17s<<2)]
Rt = [imm17s<<2]
The (imm17s << 2) value covers a range of 512K byte region relative to the location pointed to by the GP register.
2.2、ADDI.gp Rt, imm19s
Rt = R29 + SE(imm19s)
The imm19s value covers a range of 512K byte region relative to the location pointed to by the GP register.

3、$gp example at assembly
3.1、Relax optimization
3.1.1、Default is on.
3.1.2、Trun off relax linker option : -mno-relax.
Attachment:
-mno-relax.png
-mno-relax.png [ 326.47 KiB | Viewed 17043 times ]

ex:
example code
Attachment:
mem_test2.zip [58.29 KiB]
Downloaded 1148 times

Relax function
Attachment:
圖片1.jpg
圖片1.jpg [ 10.49 KiB | Viewed 17043 times ]

No relax function
Attachment:
圖片2.jpg
圖片2.jpg [ 14.43 KiB | Viewed 17043 times ]


Top
 Profile Send private message E-mail  
 
 Post subject: Re: globe pointer($gp) introduce
PostPosted: Wed Feb 04, 2015 3:35 pm 
Offline

Joined: Thu Apr 03, 2014 10:09 am
Posts: 42
In AndeSight v210 or BSPv400 , the compiler is implement "cmodel" function.

What is the "cmodel"?
Attachment:
cmodel.jpg
cmodel.jpg [ 209.32 KiB | Viewed 16726 times ]



The cmodel default is medium.

The compiler can not disable the gp instruction at cmodel=medium and cmodel=small.

If don't the gp instruction that the setting c compiler addition "-mcmodel=large" and the linker addition "-mcmodel=large -mno-relax".

The "cmodel" option that the c compiler and linker must be the same.


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group