diff options
Diffstat (limited to 'config/picochip/libgccExtras/clzsi2.asm')
-rw-r--r-- | config/picochip/libgccExtras/clzsi2.asm | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/config/picochip/libgccExtras/clzsi2.asm b/config/picochip/libgccExtras/clzsi2.asm new file mode 100644 index 0000000..c4a0923 --- /dev/null +++ b/config/picochip/libgccExtras/clzsi2.asm @@ -0,0 +1,166 @@ +// picoChip ASM file +//.file "clzsi2.asm" + +.section .text + +.global __clzsi2 +__clzsi2: +_picoMark_FUNCTION_BEGIN= + +// picoChip Function Prologue : &__clzsi2 = 0 bytes + + // What value should be operated on? If the top word is empty + // then count the bits in the bottom word, and add 16. If the + // top word is not empty, then count the bits in the top word. + + // R4 stores the constant 0 + + sub.0 R1,0,r15 \ copy.1 16,r2 + copyeq r0,r1 + copyne 0,r2 + + // R1 now stores value to count, and R2 stores current bit offset. + sbc r1,r0 + asr.0 r1,15,r15 \ add.1 r0,1,r0 + jr (lr) \ copyne 0,r0 +=-> add.0 r0,r2,r0 + +_picoMark_FUNCTION_END= + +// picoChip Function Epilogue : __clzsi2 + +//============================================================================ +// All DWARF information between this marker, and the END OF DWARF +// marker should be included in the source file. Search for +// FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and +// provide the relevent information. Add markers called +// _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the +// function in question. +//============================================================================ + +//============================================================================ +// Frame information. +//============================================================================ + +.section .debug_frame +_picoMark_DebugFrame= + +// Common CIE header. +.unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin +_picoMark_CieBegin= +.unalignedInitLong 0xffffffff +.initByte 0x1 // CIE Version +.ascii 16#0# // CIE Augmentation +.uleb128 0x1 // CIE Code Alignment Factor +.sleb128 2 // CIE Data Alignment Factor +.initByte 0xc // CIE RA Column +.initByte 0xc // DW_CFA_def_cfa +.uleb128 0xd +.uleb128 0x0 +.align 2 +_picoMark_CieEnd= + +// FDE +_picoMark_LSFDE0I900821033007563= +.unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin +_picoMark_FdeBegin= +.unalignedInitLong _picoMark_DebugFrame // FDE CIE offset +.unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location +.unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN +.initByte 0xe // DW_CFA_def_cfa_offset +.uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE +.initByte 0x4 // DW_CFA_advance_loc4 +.unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN +.initByte 0xe // DW_CFA_def_cfa_offset +.uleb128 0x0 +.align 2 +_picoMark_FdeEnd= + +//============================================================================ +// Abbrevation information. +//============================================================================ + +.section .debug_abbrev +_picoMark_ABBREVIATIONS= + +.section .debug_abbrev + .uleb128 0x1 // (abbrev code) + .uleb128 0x11 // (TAG: DW_TAG_compile_unit) + .initByte 0x1 // DW_children_yes + .uleb128 0x10 // (DW_AT_stmt_list) + .uleb128 0x6 // (DW_FORM_data4) + .uleb128 0x12 // (DW_AT_high_pc) + .uleb128 0x1 // (DW_FORM_addr) + .uleb128 0x11 // (DW_AT_low_pc) + .uleb128 0x1 // (DW_FORM_addr) + .uleb128 0x25 // (DW_AT_producer) + .uleb128 0x8 // (DW_FORM_string) + .uleb128 0x13 // (DW_AT_language) + .uleb128 0x5 // (DW_FORM_data2) + .uleb128 0x3 // (DW_AT_name) + .uleb128 0x8 // (DW_FORM_string) +.initByte 0x0 +.initByte 0x0 + + .uleb128 0x2 ;# (abbrev code) + .uleb128 0x2e ;# (TAG: DW_TAG_subprogram) +.initByte 0x0 ;# DW_children_no + .uleb128 0x3 ;# (DW_AT_name) + .uleb128 0x8 ;# (DW_FORM_string) + .uleb128 0x11 ;# (DW_AT_low_pc) + .uleb128 0x1 ;# (DW_FORM_addr) + .uleb128 0x12 ;# (DW_AT_high_pc) + .uleb128 0x1 ;# (DW_FORM_addr) +.initByte 0x0 +.initByte 0x0 + +.initByte 0x0 + +//============================================================================ +// Line information. DwarfLib requires this to be present, but it can +// be empty. +//============================================================================ + +.section .debug_line +_picoMark_LINES= + +//============================================================================ +// Debug Information +//============================================================================ +.section .debug_info + +//Fixed header. +.unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN +_picoMark_DEBUG_INFO_BEGIN= +.unalignedInitWord 0x2 +.unalignedInitLong _picoMark_ABBREVIATIONS +.initByte 0x2 + +// Compile unit information. +.uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit) +.unalignedInitLong _picoMark_LINES +.unalignedInitWord _picoMark_FUNCTION_END +.unalignedInitWord _picoMark_FUNCTION_BEGIN +// Producer is `picoChip' +.ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00# +.unalignedInitWord 0xcafe // ASM language +.ascii 16#0# // Name. DwarfLib expects this to be present. + +.uleb128 0x2 ;# (DIE DW_TAG_subprogram) + +// FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex +// digit is specified using the format 16#XX# +.ascii 16#5F# 16#63# 16#6C# 16#7A# 16#73# 16#69# 16#32# 16#0# // Function name `_clzsi2' +.unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc +.unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc + +.initByte 0x0 // end of compile unit children. + +_picoMark_DEBUG_INFO_END= + +//============================================================================ +// END OF DWARF +//============================================================================ + +.section .endFile +// End of picoChip ASM file |