Created
March 21, 2017 04:18
-
-
Save mvduin/db10c09436f21f3e72e25e3f26a91e32 to your computer and use it in GitHub Desktop.
clpru code output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; boilerplate and compiler spam removed for readability | |
.global ||_Z6istruei|| | |
||_Z6istruei||: | |
LDI r0.b0, 0x00 | |
QBEQ ||$C$L4||, r14, 0x00 | |
LDI r0.b0, 0x01 | |
||$C$L4||: | |
MOV r14.b0, r0.b0 | |
JMP r3.w2 | |
.global ||_Z5bit31j|| | |
||_Z5bit31j||: | |
LSR r14, r14, 0x1f | |
JMP r3.w2 | |
.global ||_Z4bit3j|| | |
||_Z4bit3j||: | |
LSR r0, r14, 0x03 | |
AND r14.b0, r0.b0, 0x01 | |
JMP r3.w2 | |
.global ||_Z3shrt|| | |
||_Z3shrt||: | |
MOV r0, r14.w0 | |
LSR r14, r0, 0x01 | |
JMP r3.w2 | |
.global ||_Z3shrs|| | |
||_Z3shrs||: | |
LSR r14.w0, r14.w0, 0x01 | |
QBBC ||$C$L5||, r14.w0, 0x0e | |
LDI r0.w0, 0x8000 | |
OR r14.w0, r14.w0, r0.w0 | |
||$C$L5||: | |
JMP r3.w2 | |
.global ||_Z3shrj|| | |
||_Z3shrj||: | |
LSR r14, r14, 0x01 | |
JMP r3.w2 | |
.global ||_Z3shri|| | |
||_Z3shri||: | |
LSR r14, r14, 0x01 | |
QBBC ||$C$L6||, r14, 0x1e | |
FILL &r0, 4 | |
LSL r0, r0, 0x1f | |
OR r14, r14, r0 | |
||$C$L6||: | |
JMP r3.w2 | |
.global ||_Z3shrh|| | |
||_Z3shrh||: | |
MOV r0, r14.b0 | |
LSR r14, r0, 0x01 | |
JMP r3.w2 | |
.global ||_Z3shra|| | |
||_Z3shra||: | |
LSR r14.b0, r14.b0, 0x01 | |
QBBC ||$C$L7||, r14.b0, 0x06 | |
OR r14.b0, r14.b0, 0x80 | |
||$C$L7||: | |
JMP r3.w2 | |
.global ||_Z3lt3t|| | |
||_Z3lt3t||: | |
LDI r0.b0, 0x00 | |
QBLE ||$C$L8||, r14.w0, 0x03 | |
LDI r0.b0, 0x01 | |
||$C$L8||: | |
MOV r14.b0, r0.b0 | |
JMP r3.w2 | |
.global ||_Z3lt3s|| | |
||_Z3lt3s||: | |
LDI r0.w0, 0x03 | |
XOR r14.b1, r14.b1, 0x80 | |
LDI r0.b2, 0x00 | |
XOR r0.b1, r0.b1, 0x80 | |
QBLE ||$C$L9||, r14.w0, r0.w0 | |
LDI r0.b2, 0x01 | |
||$C$L9||: | |
MOV r14.b0, r0.b2 | |
JMP r3.w2 | |
.global ||_Z3lt3i|| | |
||_Z3lt3i||: | |
LDI r0, 0x0003 | |
XOR r14.b3, r14.b3, 0x80 | |
LDI r1.b0, 0x00 | |
XOR r0.b3, r0.b3, 0x80 | |
QBLE ||$C$L10||, r14, r0 | |
LDI r1.b0, 0x01 | |
||$C$L10||: | |
MOV r14.b0, r1.b0 | |
JMP r3.w2 | |
.global ||_Z3lt0i|| | |
||_Z3lt0i||: | |
LDI r0, 0x0000 | |
XOR r14.b3, r14.b3, 0x80 | |
LDI r1.b0, 0x00 | |
XOR r0.b3, r0.b3, 0x80 | |
QBLE ||$C$L11||, r14, r0 | |
LDI r1.b0, 0x01 | |
||$C$L11||: | |
MOV r14.b0, r1.b0 | |
JMP r3.w2 | |
.global ||_Z3geqjj|| | |
||_Z3geqjj||: | |
LDI r0.b0, 0x00 | |
QBLT ||$C$L12||, r15, r14 | |
LDI r0.b0, 0x01 | |
||$C$L12||: | |
MOV r14.b0, r0.b0 | |
JMP r3.w2 | |
.global ||_Z3geqii|| | |
||_Z3geqii||: | |
XOR r15.b3, r15.b3, 0x80 | |
XOR r14.b3, r14.b3, 0x80 | |
LDI r0.b0, 0x00 | |
QBLT ||$C$L13||, r15, r14 | |
LDI r0.b0, 0x01 | |
||$C$L13||: | |
MOV r14.b0, r0.b0 | |
JMP r3.w2 | |
.global ||_Z3fooPt|| | |
||_Z3fooPt||: | |
LBBO &r0.w0, r14, 0, 2 | |
ADD r0, r0.w0, 0x01 | |
LSR r0, r0, 0x01 | |
QBBC ||$C$L14||, r0, 0x1e | |
FILL &r1, 4 | |
LSL r1, r1, 0x1f | |
OR r0, r0, r1 | |
||$C$L14||: | |
SBBO &r0.w0, r14, 0, 2 | |
JMP r3.w2 | |
.global ||_Z2ltjj|| | |
||_Z2ltjj||: | |
LDI r0.b0, 0x00 | |
QBGE ||$C$L15||, r15, r14 | |
LDI r0.b0, 0x01 | |
||$C$L15||: | |
MOV r14.b0, r0.b0 | |
JMP r3.w2 | |
.global ||_Z2ltii|| | |
||_Z2ltii||: | |
XOR r15.b3, r15.b3, 0x80 | |
XOR r14.b3, r14.b3, 0x80 | |
LDI r0.b0, 0x00 | |
QBGE ||$C$L16||, r15, r14 | |
LDI r0.b0, 0x01 | |
||$C$L16||: | |
MOV r14.b0, r0.b0 | |
JMP r3.w2 | |
.global ||_Z11const_bit31v|| | |
||_Z11const_bit31v||: | |
LDI r14.w2, 0x8000 | |
LDI r14.w0, 0 | |
JMP r3.w2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool istrue( int a ) | |
{ | |
return a; | |
} | |
bool lt( unsigned a, unsigned b ) | |
{ | |
return a < b; | |
} | |
bool lt( int a, int b ) | |
{ | |
return a < b; | |
} | |
bool geq( unsigned a, unsigned b ) | |
{ | |
return a >= b; | |
} | |
bool geq( int a, int b ) | |
{ | |
return a >= b; | |
} | |
bool lt0( int a ) { return a < 0; } | |
bool lt3( int a ) { return a < 3; } | |
bool lt3( int16_t a ) { return a < 3; } | |
bool lt3( uint16_t a ) { return a < 3; } | |
bool bit3( unsigned a ) { return a >> 3 & 1; } | |
bool bit31( unsigned a ) { return a >> 31 & 1; } | |
int32_t shr( int32_t a ) { return a >> 1; } | |
int16_t shr( int16_t a ) { return a >> 1; } | |
int8_t shr( int8_t a ) { return a >> 1; } | |
uint32_t shr( uint32_t a ) { return a >> 1; } | |
uint16_t shr( uint16_t a ) { return a >> 1; } | |
uint8_t shr( uint8_t a ) { return a >> 1; } | |
void foo( uint16_t *x ) | |
{ | |
*x = ( *x + 1 ) >> 1; | |
} | |
unsigned const_bit31() { return 0x80000000; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment