/*
Extra notes on what Maverick instruction actually do.

Parameters are:
	mvfxN for 32-bit integer operations
	mvdxN for 64-bit integer operations

cftruncs32	zeroes the top 32 bits of its destination register
cfabs32		zeroes the top 32 bits of its destination register
cfneg32		sign-extends the top 32 bits of its destination
cfrshl32	sign-extends the top 32 bits;
		when shifting right (count is -ve) the top bits get copies of
		the top bit of the source operand (ie the shift is arithmetic)
cfsh32		sign-extends the top 32 bits and is arithmetic
cfsh64		is arithmetic (duplicates the top bit when shifting right)
 */

union {
	unsigned long long ll;
	double d;
	struct {
		float f0, f1;
	} f;
	struct {
		long l0, l1;
	} l;
} u;

float f = 42.0;
		
main(int argc, char **argv){
	u.ll = 0xfedcba9886543210ULL;	/* garbage */

	asm("ldr	r0, =f");
	asm("ldr	r1, =u");
	asm("mov	r2, #-4");

	asm("cfldr64	mvdx0, [r1]");	/* Load garbage */

	asm("cfsh64	mvdx0, mvdx0, #-4");

	/* Store bit pattern into our union */
	asm("nop");
	asm("cfstr64	mvdx0, [r1]");

	printf("%x %x\n", u.l.l1, u.l.l0);
}
