/* test_rs6000_sda.cpp */ /* Sample code to test the "sda optimization" in the GCC rs6000 port. */ /* Look at the assembler generated instructions, varying the -G compiler option value. */ /* Comments below assume that -msdata=eabi or -msdata=sysv, with other values of -msdata, no sda efficient addressing should occur. */ int sda_array[2000] __attribute__((section (".sbss"))); char byte_v; short short_v; long long_v; char peripheral_register __attribute__((section (".periph_reg_sect"))); int * function(void) { peripheral_register=0; /* should never use sda efficient addressing */ sda_array[0]=1; /* should always use sda efficient addressing */ sda_array[100]=2; /* should always use sda efficient addressing */ sda_array[1000]=3; /* should always use sda efficient addressing */ return sda_array /* should always use sda efficient address computation */ +byte_v /* should use sda efficient addressing iif -G option >= 1 */ +short_v /* should use sda efficient addressing iif -G option >= 2 */ +long_v; /* should use sda efficient addressing iif -G option >= 4 */ }