package hfloat16 file_number 0 "/inputs/subtree/xls/dslx/stdlib/std.x" file_number 1 "/inputs/subtree/xls/dslx/stdlib/apfloat.x" file_number 2 "/inputs/subtree/xls/dslx/stdlib/hfloat16.x" fn __std__mask_bits__5() -> bits[5] { literal.2: bits[5] = literal(value=0, id=2, pos=[(0,835,41)]) X: bits[32] = literal(value=5, id=1, pos=[(0,835,17)]) ret not.3: bits[5] = not(literal.2, id=3, pos=[(0,835,40)]) } fn __apfloat__tag__5_10(input_float: (bits[1], bits[5], bits[10]) id=4) -> bits[3] { input_float_bexp: bits[5] = tuple_index(input_float, index=1, id=8, pos=[(1,40,22)]) input_float_fraction: bits[10] = tuple_index(input_float, index=2, id=9, pos=[(1,40,40)]) tuple.10: (bits[5], bits[10]) = tuple(input_float_bexp, input_float_fraction, id=10, pos=[(1,40,10)]) EXPR_MASK: bits[5] = invoke(to_apply=__std__mask_bits__5, id=7, pos=[(1,39,36)]) tuple_index.40: bits[5] = tuple_index(tuple.10, index=0, id=40) tuple_index.31: bits[5] = tuple_index(tuple.10, index=0, id=31) literal.23: bits[5] = literal(value=0, id=23, pos=[(1,42,9)]) tuple_index.22: bits[5] = tuple_index(tuple.10, index=0, id=22) literal.13: bits[5] = literal(value=0, id=13, pos=[(1,41,9)]) tuple_index.12: bits[5] = tuple_index(tuple.10, index=0, id=12) literal.39: bits[1] = literal(value=1, id=39) eq.41: bits[1] = eq(EXPR_MASK, tuple_index.40, id=41) literal.30: bits[1] = literal(value=1, id=30) eq.32: bits[1] = eq(EXPR_MASK, tuple_index.31, id=32) literal.35: bits[10] = literal(value=0, id=35, pos=[(1,43,20)]) tuple_index.34: bits[10] = tuple_index(tuple.10, index=1, id=34) literal.21: bits[1] = literal(value=1, id=21) eq.24: bits[1] = eq(literal.23, tuple_index.22, id=24) literal.11: bits[1] = literal(value=1, id=11) eq.14: bits[1] = eq(literal.13, tuple_index.12, id=14) literal.17: bits[10] = literal(value=0, id=17, pos=[(1,41,23)]) tuple_index.16: bits[10] = tuple_index(tuple.10, index=1, id=16) and.42: bits[1] = and(literal.39, eq.41, id=42) literal.44: bits[1] = literal(value=1, id=44, pos=[(1,44,20)]) and.33: bits[1] = and(literal.30, eq.32, id=33) eq.36: bits[1] = eq(literal.35, tuple_index.34, id=36) and.25: bits[1] = and(literal.21, eq.24, id=25) literal.27: bits[1] = literal(value=1, id=27, pos=[(1,42,23)]) and.15: bits[1] = and(literal.11, eq.14, id=15) eq.18: bits[1] = eq(literal.17, tuple_index.16, id=18) literal.47: bits[1] = literal(value=1, id=47) literal.49: bits[1] = literal(value=1, id=49, pos=[(1,45,9)]) and.45: bits[1] = and(and.42, literal.44, id=45) and.37: bits[1] = and(and.33, eq.36, id=37) and.28: bits[1] = and(and.25, literal.27, id=28) and.19: bits[1] = and(and.15, eq.18, id=19) and.50: bits[1] = and(literal.47, literal.49, id=50) literal.52: bits[1] = literal(value=1, id=52, pos=[(1,45,12)]) concat.55: bits[4] = concat(and.45, and.37, and.28, and.19, id=55) literal.20: bits[3] = literal(value=3, id=20, pos=[(1,41,45)]) literal.29: bits[3] = literal(value=2, id=29, pos=[(1,42,29)]) literal.38: bits[3] = literal(value=1, id=38, pos=[(1,43,42)]) literal.46: bits[3] = literal(value=0, id=46, pos=[(1,44,26)]) literal.54: bits[3] = literal(value=4, id=54, pos=[(1,45,18)]) EXP_SZ: bits[32] = literal(value=5, id=5, pos=[(1,38,11)]) FRACTION_SZ: bits[32] = literal(value=10, id=6, pos=[(1,38,24)]) tuple_index.26: bits[10] = tuple_index(tuple.10, index=1, id=26) tuple_index.43: bits[10] = tuple_index(tuple.10, index=1, id=43) tuple_index.48: bits[5] = tuple_index(tuple.10, index=0, id=48) tuple_index.51: bits[10] = tuple_index(tuple.10, index=1, id=51) and.53: bits[1] = and(and.50, literal.52, id=53) ret priority_sel.56: bits[3] = priority_sel(concat.55, cases=[literal.20, literal.29, literal.38, literal.46], default=literal.54, id=56) } fn __apfloat__qnan__5_10() -> (bits[1], bits[5], bits[10]) { FRACTION_SZ: bits[32] = literal(value=10, id=58, pos=[(1,50,25)]) literal.63: bits[32] = literal(value=1, id=63, pos=[(1,54,57)]) sub.64: bits[32] = sub(FRACTION_SZ, literal.63, id=64, pos=[(1,54,43)]) invoke.60: bits[5] = invoke(to_apply=__std__mask_bits__5, id=60, pos=[(1,53,28)]) literal.62: bits[10] = literal(value=1, id=62, pos=[(1,54,18)]) bit_slice.65: bits[10] = bit_slice(sub.64, start=0, width=10, id=65) literal.59: bits[1] = literal(value=0, id=59, pos=[(1,52,14)]) zero_ext.61: bits[5] = zero_ext(invoke.60, new_bit_count=5, id=61) shll.66: bits[10] = shll(literal.62, bit_slice.65, id=66, pos=[(1,54,18)]) EXP_SZ: bits[32] = literal(value=5, id=57, pos=[(1,50,12)]) ret tuple.67: (bits[1], bits[5], bits[10]) = tuple(literal.59, zero_ext.61, shll.66, id=67, pos=[(1,51,33)]) } fn __apfloat__inf__5_10(sign: bits[1] id=68) -> (bits[1], bits[5], bits[10]) { invoke.71: bits[5] = invoke(to_apply=__std__mask_bits__5, id=71, pos=[(1,78,28)]) literal.72: bits[10] = literal(value=0, id=72, pos=[(1,79,18)]) EXP_SZ: bits[32] = literal(value=5, id=69, pos=[(1,75,11)]) FRACTION_SZ: bits[32] = literal(value=10, id=70, pos=[(1,75,24)]) ret tuple.73: (bits[1], bits[5], bits[10]) = tuple(sign, invoke.71, literal.72, id=73, pos=[(1,76,33)]) } fn __apfloat__zero__5_10(sign: bits[1] id=74) -> (bits[1], bits[5], bits[10]) { literal.77: bits[5] = literal(value=0, id=77, pos=[(1,131,47)]) literal.78: bits[10] = literal(value=0, id=78, pos=[(1,131,73)]) EXP_SZ: bits[32] = literal(value=5, id=75, pos=[(1,130,12)]) FRACTION_SZ: bits[32] = literal(value=10, id=76, pos=[(1,130,25)]) ret tuple.79: (bits[1], bits[5], bits[10]) = tuple(sign, literal.77, literal.78, id=79, pos=[(1,131,33)]) } fn __std__signed_max_value__5_4() -> bits[5] { literal.82: bits[5] = literal(value=1, id=82, pos=[(0,47,6)]) N_MINUS_ONE: bits[32] = literal(value=4, id=81, pos=[(0,46,32)]) shll.83: bits[5] = shll(literal.82, N_MINUS_ONE, id=83, pos=[(0,47,6)]) literal.84: bits[5] = literal(value=1, id=84, pos=[(0,47,32)]) sub.85: bits[5] = sub(shll.83, literal.84, id=85, pos=[(0,47,6)]) N: bits[32] = literal(value=5, id=80, pos=[(0,46,24)]) ret sign_ext.86: bits[5] = sign_ext(sub.85, new_bit_count=5, id=86) } fn __apfloat__bias__5(unbiased_exponent: bits[5] id=87) -> bits[5] { BIAS: bits[5] = invoke(to_apply=__std__signed_max_value__5_4, id=89, pos=[(1,343,38)]) add.90: bits[5] = add(unbiased_exponent, BIAS, id=90, pos=[(1,344,5)]) EXP_SZ: bits[32] = literal(value=5, id=88, pos=[(1,342,12)]) ret sign_ext.91: bits[5] = sign_ext(add.90, new_bit_count=5, id=91) } fn __apfloat__has_fractional_part__5_10(f: (bits[1], bits[5], bits[10]) id=92) -> bits[1] { FRACTION_SZ: bits[32] = literal(value=10, id=94, pos=[(1,4191,40)]) bit_slice.96: bits[5] = bit_slice(FRACTION_SZ, start=0, width=5, id=96) f_bexp: bits[5] = tuple_index(f, index=1, id=95, pos=[(1,4192,5)]) invoke.97: bits[5] = invoke(bit_slice.96, to_apply=__apfloat__bias__5, id=97, pos=[(1,4192,17)]) EXP_SZ: bits[32] = literal(value=5, id=93, pos=[(1,4191,27)]) ret ult.98: bits[1] = ult(f_bexp, invoke.97, id=98, pos=[(1,4192,5)]) } fn __apfloat__has_negative_exponent__5_10(f: (bits[1], bits[5], bits[10]) id=99) -> bits[1] { literal.103: bits[5] = literal(value=0, id=103, pos=[(1,4219,18)]) f_bexp: bits[5] = tuple_index(f, index=1, id=102, pos=[(1,4219,5)]) invoke.104: bits[5] = invoke(literal.103, to_apply=__apfloat__bias__5, id=104, pos=[(1,4219,17)]) EXP_SZ: bits[32] = literal(value=5, id=100, pos=[(1,4217,29)]) FRACTION_SZ: bits[32] = literal(value=10, id=101, pos=[(1,4217,42)]) ret ult.105: bits[1] = ult(f_bexp, invoke.104, id=105, pos=[(1,4219,5)]) } fn __apfloat__exponent_bias__5_10(f: (bits[1], bits[5], bits[10]) id=106) -> bits[5] { invoke.109: bits[5] = invoke(to_apply=__std__signed_max_value__5_4, id=109, pos=[(1,221,25)]) EXP_SZ: bits[32] = literal(value=5, id=107, pos=[(1,220,21)]) FRACTION_SZ: bits[32] = literal(value=10, id=108, pos=[(1,220,34)]) ret sign_ext.110: bits[5] = sign_ext(invoke.109, new_bit_count=5, id=110) } fn __apfloat__unbiased_exponent__5_10(f: (bits[1], bits[5], bits[10]) id=111) -> bits[5] { f_bexp: bits[5] = tuple_index(f, index=1, id=115, pos=[(1,266,6)]) zero_ext.116: bits[5] = zero_ext(f_bexp, new_bit_count=5, id=116) bias: bits[5] = invoke(f, to_apply=__apfloat__exponent_bias__5_10, id=114, pos=[(1,265,28)]) EXP_SZ: bits[32] = literal(value=5, id=112, pos=[(1,263,25)]) FRACTION_SZ: bits[32] = literal(value=10, id=113, pos=[(1,263,38)]) ret sub.117: bits[5] = sub(zero_ext.116, bias, id=117, pos=[(1,266,6)]) } fn __std__mask_bits__10() -> bits[10] { literal.119: bits[10] = literal(value=0, id=119, pos=[(0,835,41)]) X: bits[32] = literal(value=10, id=118, pos=[(0,835,17)]) ret not.120: bits[10] = not(literal.119, id=120, pos=[(0,835,40)]) } fn __apfloat__round_down_no_sign_positive_exp__5_10(f: (bits[1], bits[5], bits[10]) id=121) -> (bits[1], bits[5], bits[10]) { exp: bits[5] = invoke(f, to_apply=__apfloat__unbiased_exponent__5_10, id=124, pos=[(1,4272,31)]) invoke.125: bits[10] = invoke(to_apply=__std__mask_bits__10, id=125, pos=[(1,4274,40)]) sign_ext.126: bits[32] = sign_ext(exp, new_bit_count=32, id=126) fractional_mask: bits[10] = shrl(invoke.125, sign_ext.126, id=127, pos=[(1,4274,40)]) f_fraction: bits[10] = tuple_index(f, index=2, id=128, pos=[(1,4276,29)]) not.129: bits[10] = not(fractional_mask, id=129, pos=[(1,4276,41)]) f_sign: bits[1] = tuple_index(f, index=0, id=131, pos=[(1,4277,21)]) f_bexp: bits[5] = tuple_index(f, index=1, id=132, pos=[(1,4277,35)]) fraction_integral: bits[10] = and(f_fraction, not.129, id=130, pos=[(1,4276,29)]) EXP_SZ: bits[32] = literal(value=5, id=122, pos=[(1,4269,35)]) FRACTION_SZ: bits[32] = literal(value=10, id=123, pos=[(1,4269,48)]) ret tuple.133: (bits[1], bits[5], bits[10]) = tuple(f_sign, f_bexp, fraction_integral, id=133, pos=[(1,4277,12)]) } fn __apfloat__trunc__5_10(f: (bits[1], bits[5], bits[10]) id=134) -> (bits[1], bits[5], bits[10]) { f_sign__2: bits[1] = tuple_index(f, index=0, id=153, pos=[(1,4706,43)]) literal.145: bits[3] = literal(value=3, id=145, pos=[(1,4701,8)]) invoke.137: bits[3] = invoke(f, to_apply=__apfloat__tag__5_10, id=137, pos=[(1,4698,13)]) literal.141: bits[3] = literal(value=1, id=141, pos=[(1,4700,8)]) literal.138: bits[3] = literal(value=0, id=138, pos=[(1,4699,8)]) invoke.150: bits[1] = invoke(f, to_apply=__apfloat__has_fractional_part__5_10, id=150, pos=[(1,4703,35)]) invoke.152: bits[1] = invoke(f, to_apply=__apfloat__has_negative_exponent__5_10, id=152, pos=[(1,4705,43)]) invoke.155: (bits[1], bits[5], bits[10]) = invoke(f, to_apply=__apfloat__round_down_no_sign_positive_exp__5_10, id=155, pos=[(1,4708,47)]) invoke.154: (bits[1], bits[5], bits[10]) = invoke(f_sign__2, to_apply=__apfloat__zero__5_10, id=154, pos=[(1,4706,20)]) eq.146: bits[1] = eq(literal.145, invoke.137, id=146) eq.142: bits[1] = eq(literal.141, invoke.137, id=142) eq.139: bits[1] = eq(literal.138, invoke.137, id=139) f_sign: bits[1] = tuple_index(f, index=0, id=143, pos=[(1,4700,58)]) f_sign__1: bits[1] = tuple_index(f, index=0, id=147, pos=[(1,4701,55)]) not.151: bits[1] = not(invoke.150, id=151, pos=[(1,4703,15)]) sel.156: (bits[1], bits[5], bits[10]) = sel(invoke.152, cases=[invoke.155, invoke.154], id=156, pos=[(1,4705,19)]) concat.158: bits[3] = concat(eq.146, eq.142, eq.139, id=158) invoke.140: (bits[1], bits[5], bits[10]) = invoke(to_apply=__apfloat__qnan__5_10, id=140, pos=[(1,4699,31)]) invoke.144: (bits[1], bits[5], bits[10]) = invoke(f_sign, to_apply=__apfloat__inf__5_10, id=144, pos=[(1,4700,35)]) invoke.148: (bits[1], bits[5], bits[10]) = invoke(f_sign__1, to_apply=__apfloat__zero__5_10, id=148, pos=[(1,4701,32)]) sel.157: (bits[1], bits[5], bits[10]) = sel(not.151, cases=[sel.156, f], id=157, pos=[(1,4703,12)]) EXP_SZ: bits[32] = literal(value=5, id=135, pos=[(1,4695,13)]) FRACTION_SZ: bits[32] = literal(value=10, id=136, pos=[(1,4695,26)]) literal.149: bits[1] = literal(value=1, id=149, pos=[(1,4702,8)]) ret priority_sel.159: (bits[1], bits[5], bits[10]) = priority_sel(concat.158, cases=[invoke.140, invoke.144, invoke.148], default=sel.157, id=159) } top fn __hfloat16__trunc(f: (bits[1], bits[5], bits[10]) id=160) -> (bits[1], bits[5], bits[10]) { ret invoke.161: (bits[1], bits[5], bits[10]) = invoke(f, to_apply=__apfloat__trunc__5_10, id=161, pos=[(2,136,46)]) }