Forum Discussion
Altera_Forum
Honored Contributor
21 years agoUnnecessary instructions
Hello, it's my first post. I have question about GCC generated code. We can find several unnecessary instructions. --- sample code --- unsigned short uh; uh = IORD_16DIRECT(base,ofst)...
Altera_Forum
Honored Contributor
21 years agoDon't use the IORD_16DIRECT ... it's a macro that expands to
the builtin function __builtin_ldhuio (see io.h). It's the builtin that (apparently) adds the extra instruction. If the extra instruction bothers you, you can always try something like:#define CACHE_BYPASS(addr) ((addr)|0x80000000)# define ADDR 0x09000024
...
unsigned short uh = *(volatile unsigned short*)CACHE_BYPASS(ADDR);
printf ("%04x\n",uh); Regards, --Scott