- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I'm using inline asm and hope to write a 32bits constant which is defined in *.c file into register r2. I have tried the following instruction, but compiler report error: asm("movhi r2, %hiadj(%0)" :: "i" (0x1000000)); asm("addi r2, r2, %lo(%0)" :: "i" (0x1000000)); ERROR: error: invalid `asm': operand number missing after %-letter Anybody help? DavidLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you need an extra '%' :
<span style="color:red">--- asm("movhi r2, %hiadj(%0)" :: "i" (0x1000000));
--- asm("addi r2, r2, %lo(%0)" :: "i" (0x1000000));
+++ asm("movhi r2, %%hiadj(%0)" :: "i" (0x1000000));
+++ asm("addi r2, r2, %%lo(%0)" :: "i" (0x1000000));
</span> Regards, --Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks very much, Scott...
Can you guide me how to find the related information? Thanks again, David- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi David,
> Can you guide me how to find the related information? See the gcc manual. Regards, --Scott
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page