github.com/bir3/gocompiler@v0.9.2202/extra/compress/zstd/fse_decoder_amd64.s (about) 1 // Code generated by command: go run gen_fse.go -out ../fse_decoder_amd64.s -pkg=zstd. DO NOT EDIT. 2 3 //go:build !appengine && !noasm && gc && !noasm 4 5 // func buildDtable_asm(s *fseDecoder, ctx *buildDtableAsmContext) int 6 TEXT ·buildDtable_asm(SB), $0-24 7 MOVQ ctx+8(FP), CX 8 MOVQ s+0(FP), DI 9 10 // Load values 11 MOVBQZX 4098(DI), DX 12 XORQ AX, AX 13 BTSQ DX, AX 14 MOVQ (CX), BX 15 MOVQ 16(CX), SI 16 LEAQ -1(AX), R8 17 MOVQ 8(CX), CX 18 MOVWQZX 4096(DI), DI 19 20 // End load values 21 // Init, lay down lowprob symbols 22 XORQ R9, R9 23 JMP init_main_loop_condition 24 25 init_main_loop: 26 MOVWQSX (CX)(R9*2), R10 27 CMPW R10, $-1 28 JNE do_not_update_high_threshold 29 MOVB R9, 1(SI)(R8*8) 30 DECQ R8 31 MOVQ $0x0000000000000001, R10 32 33 do_not_update_high_threshold: 34 MOVW R10, (BX)(R9*2) 35 INCQ R9 36 37 init_main_loop_condition: 38 CMPQ R9, DI 39 JL init_main_loop 40 41 // Spread symbols 42 // Calculate table step 43 MOVQ AX, R9 44 SHRQ $0x01, R9 45 MOVQ AX, R10 46 SHRQ $0x03, R10 47 LEAQ 3(R9)(R10*1), R9 48 49 // Fill add bits values 50 LEAQ -1(AX), R10 51 XORQ R11, R11 52 XORQ R12, R12 53 JMP spread_main_loop_condition 54 55 spread_main_loop: 56 XORQ R13, R13 57 MOVWQSX (CX)(R12*2), R14 58 JMP spread_inner_loop_condition 59 60 spread_inner_loop: 61 MOVB R12, 1(SI)(R11*8) 62 63 adjust_position: 64 ADDQ R9, R11 65 ANDQ R10, R11 66 CMPQ R11, R8 67 JG adjust_position 68 INCQ R13 69 70 spread_inner_loop_condition: 71 CMPQ R13, R14 72 JL spread_inner_loop 73 INCQ R12 74 75 spread_main_loop_condition: 76 CMPQ R12, DI 77 JL spread_main_loop 78 TESTQ R11, R11 79 JZ spread_check_ok 80 MOVQ ctx+8(FP), AX 81 MOVQ R11, 24(AX) 82 MOVQ $+1, ret+16(FP) 83 RET 84 85 spread_check_ok: 86 // Build Decoding table 87 XORQ DI, DI 88 89 build_table_main_table: 90 MOVBQZX 1(SI)(DI*8), CX 91 MOVWQZX (BX)(CX*2), R8 92 LEAQ 1(R8), R9 93 MOVW R9, (BX)(CX*2) 94 MOVQ R8, R9 95 BSRQ R9, R9 96 MOVQ DX, CX 97 SUBQ R9, CX 98 SHLQ CL, R8 99 SUBQ AX, R8 100 MOVB CL, (SI)(DI*8) 101 MOVW R8, 2(SI)(DI*8) 102 CMPQ R8, AX 103 JLE build_table_check1_ok 104 MOVQ ctx+8(FP), CX 105 MOVQ R8, 24(CX) 106 MOVQ AX, 32(CX) 107 MOVQ $+2, ret+16(FP) 108 RET 109 110 build_table_check1_ok: 111 TESTB CL, CL 112 JNZ build_table_check2_ok 113 CMPW R8, DI 114 JNE build_table_check2_ok 115 MOVQ ctx+8(FP), AX 116 MOVQ R8, 24(AX) 117 MOVQ DI, 32(AX) 118 MOVQ $+3, ret+16(FP) 119 RET 120 121 build_table_check2_ok: 122 INCQ DI 123 CMPQ DI, AX 124 JL build_table_main_table 125 MOVQ $+0, ret+16(FP) 126 RET