/* * Test whether cfsh32 by constant 32 bits really does do a left shift * and gove result of 0, or wraps to a right shift by 32 result 0xffffffff * * cc -mcpu=ep9312 -mfpu=maverick and -mfloat-abi=softfp if using EABI. */ #include #include unsigned long i32; main() { i32 = 0xdeadb0diUL; /* somethine with top bit set */ cfsh32x32(); fputs("Left shift using cfsh32 by 32 places ", stdout); switch (i32) { case 0x00000000: puts("is ok"); break; case 0xffffffff: puts("shifts right"); break; default: printf("gives 0x%08lx\n", i32); break; } exit(0); } cfsh32x32() { asm("ldr r3, =i32"); /* r3 = &i32 */ asm("cfldr32 mvfx0, [r3]"); /* c0 = i32 */ asm("cfsh32 mvfx0,mvfx0,#32"); /* shift 32 places left */ asm("cfstr32 mvfx0, [r3]"); /* store back in i32 */ }