GNU as has "la %r4,8(%r3)" as an alias for "addi %r4,%r3,8", meaning to load the address of the thing at 8(%r3). Our 'la', now 'li32', makes an addis/ori pair to load an immediate 32-bit value. For example, "li32 r4,23456789" loads a big number.
		
			
				
	
	
		
			33 lines
		
	
	
	
		
			640 B
		
	
	
	
		
			ArmAsm
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
	
		
			640 B
		
	
	
	
		
			ArmAsm
		
	
	
	
	
	
| #
 | |
| ! $Source$
 | |
| ! $State$
 | |
| ! $Revision$
 | |
| 
 | |
| #include "powerpc.h"
 | |
| 	
 | |
| .sect .text
 | |
| 
 | |
| ! Converts a 32-bit unsigned integer into a 64-bit double.
 | |
| !
 | |
| ! Stack: ( uint -- double )
 | |
| 
 | |
| .define .cuf8
 | |
| .cuf8:
 | |
| 	addi sp, sp, -4          ! make space for the double
 | |
| 	
 | |
| 	addis r3, r0, 0x4330
 | |
| 	stw r3, 0(sp)            ! set high word to construct a double
 | |
| 	
 | |
| 	lfd f0, 0(sp)            ! load value
 | |
| 	
 | |
| 	li32 r3, pivot
 | |
| 	lfd f1, 0(r3)            ! load pivot value
 | |
| 	fsub f0, f0, f1          ! adjust
 | |
| 	                         
 | |
| 	stfd f0, 0(sp)           ! save value again...
 | |
| 	bclr ALWAYS, 0, 0        ! ...and return 
 | |
| 
 | |
| .sect .rom
 | |
| pivot:
 | |
| 	.data4 0x43300000
 | |
| 	.data4 0x00000000
 |