package float32 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/float32.x" fn __std__max__32_0(x: bits[32] id=1, y: bits[32] id=2) -> bits[32] { ugt.5: bits[1] = ugt(x, y, id=5, pos=[(0,93,71)]) S: bits[1] = literal(value=0, id=3, pos=[(0,93,11)]) N: bits[32] = literal(value=32, id=4, pos=[(0,93,20)]) ret sel.6: bits[32] = sel(ugt.5, cases=[y, x], id=6, pos=[(0,93,68)]) } fn __std__signed_max_value__8_7() -> bits[8] { literal.9: bits[8] = literal(value=1, id=9, pos=[(0,47,6)]) N_MINUS_ONE: bits[32] = literal(value=7, id=8, pos=[(0,46,32)]) shll.10: bits[8] = shll(literal.9, N_MINUS_ONE, id=10, pos=[(0,47,6)]) literal.11: bits[8] = literal(value=1, id=11, pos=[(0,47,32)]) sub.12: bits[8] = sub(shll.10, literal.11, id=12, pos=[(0,47,6)]) N: bits[32] = literal(value=8, id=7, pos=[(0,46,24)]) ret sign_ext.13: bits[8] = sign_ext(sub.12, new_bit_count=8, id=13) } fn __apfloat__exponent_bias__8_23(f: (bits[1], bits[8], bits[23]) id=14) -> bits[8] { invoke.17: bits[8] = invoke(to_apply=__std__signed_max_value__8_7, id=17, pos=[(1,221,25)]) EXP_SZ: bits[32] = literal(value=8, id=15, pos=[(1,220,21)]) FRACTION_SZ: bits[32] = literal(value=23, id=16, pos=[(1,220,34)]) ret sign_ext.18: bits[8] = sign_ext(invoke.17, new_bit_count=8, id=18) } fn __apfloat__unbiased_exponent__8_23(f: (bits[1], bits[8], bits[23]) id=19) -> bits[8] { f_bexp: bits[8] = tuple_index(f, index=1, id=23, pos=[(1,266,6)]) zero_ext.24: bits[8] = zero_ext(f_bexp, new_bit_count=8, id=24) bias: bits[8] = invoke(f, to_apply=__apfloat__exponent_bias__8_23, id=22, pos=[(1,265,28)]) EXP_SZ: bits[32] = literal(value=8, id=20, pos=[(1,263,25)]) FRACTION_SZ: bits[32] = literal(value=23, id=21, pos=[(1,263,38)]) ret sub.25: bits[8] = sub(zero_ext.24, bias, id=25, pos=[(1,266,6)]) } fn __std__mask_bits__8() -> bits[8] { literal.27: bits[8] = literal(value=0, id=27, pos=[(0,835,41)]) X: bits[32] = literal(value=8, id=26, pos=[(0,835,17)]) ret not.28: bits[8] = not(literal.27, id=28, pos=[(0,835,40)]) } fn __apfloat__is_inf__8_23(x: (bits[1], bits[8], bits[23]) id=29) -> bits[1] { x_bexp: bits[8] = tuple_index(x, index=1, id=32, pos=[(1,96,6)]) invoke.33: bits[8] = invoke(to_apply=__std__mask_bits__8, id=33, pos=[(1,96,29)]) x_fraction: bits[23] = tuple_index(x, index=2, id=35, pos=[(1,96,44)]) literal.36: bits[23] = literal(value=0, id=36, pos=[(1,96,57)]) eq.34: bits[1] = eq(x_bexp, invoke.33, id=34, pos=[(1,96,6)]) eq.37: bits[1] = eq(x_fraction, literal.36, id=37, pos=[(1,96,44)]) EXP_SZ: bits[32] = literal(value=8, id=30, pos=[(1,95,14)]) FRACTION_SZ: bits[32] = literal(value=23, id=31, pos=[(1,95,27)]) ret and.38: bits[1] = and(eq.34, eq.37, id=38, pos=[(1,96,6)]) } fn __apfloat__is_nan__8_23(x: (bits[1], bits[8], bits[23]) id=39) -> bits[1] { x_bexp: bits[8] = tuple_index(x, index=1, id=42, pos=[(1,71,6)]) invoke.43: bits[8] = invoke(to_apply=__std__mask_bits__8, id=43, pos=[(1,71,29)]) x_fraction: bits[23] = tuple_index(x, index=2, id=45, pos=[(1,71,44)]) literal.46: bits[23] = literal(value=0, id=46, pos=[(1,71,57)]) eq.44: bits[1] = eq(x_bexp, invoke.43, id=44, pos=[(1,71,6)]) ne.47: bits[1] = ne(x_fraction, literal.46, id=47, pos=[(1,71,44)]) EXP_SZ: bits[32] = literal(value=8, id=40, pos=[(1,70,14)]) FRACTION_SZ: bits[32] = literal(value=23, id=41, pos=[(1,70,27)]) ret and.48: bits[1] = and(eq.44, ne.47, id=48, pos=[(1,71,6)]) } fn __apfloat__to_signed_or_unsigned_int__8_23_1_32(x: (bits[1], bits[8], bits[23]) id=49) -> bits[32] { x_fraction: bits[23] = tuple_index(x, index=2, id=75, pos=[(1,2646,21)]) literal.77: bits[24] = literal(value=1, id=77, pos=[(1,2646,55)]) FRACTION_SZ: bits[32] = literal(value=23, id=53, pos=[(1,2626,79)]) exp: bits[8] = invoke(x, to_apply=__apfloat__unbiased_exponent__8_23, id=74, pos=[(1,2642,31)]) zero_ext.76: bits[24] = zero_ext(x_fraction, new_bit_count=24, id=76) shll.78: bits[24] = shll(literal.77, FRACTION_SZ, id=78, pos=[(1,2646,55)]) sign_ext.104: bits[32] = sign_ext(exp, new_bit_count=32, id=104) zero_ext.105: bits[32] = zero_ext(FRACTION_SZ, new_bit_count=32, id=105) or.79: bits[24] = or(zero_ext.76, shll.78, id=79, pos=[(1,2646,21)]) effective_exp: bits[32] = sub(sign_ext.104, zero_ext.105, id=106, pos=[(1,2664,29)]) RESULT_SZ: bits[32] = literal(value=32, id=50, pos=[(1,2626,29)]) literal.112: bits[32] = literal(value=0, id=112, pos=[(1,2667,34)]) fraction: bits[32] = zero_ext(or.79, new_bit_count=32, id=80) sign_ext.114: bits[32] = sign_ext(effective_exp, new_bit_count=32, id=114) neg.109: bits[32] = neg(effective_exp, id=109, pos=[(1,2666,26)]) zero_ext.81: bits[32] = zero_ext(RESULT_SZ, new_bit_count=32, id=81) literal.82: bits[32] = literal(value=1, id=82, pos=[(1,2649,56)]) literal.107: bits[32] = literal(value=0, id=107, pos=[(1,2665,27)]) sgt.113: bits[1] = sgt(effective_exp, literal.112, id=113, pos=[(1,2667,18)]) shll.115: bits[32] = shll(fraction, sign_ext.114, id=115, pos=[(1,2668,13)]) sign_ext.110: bits[32] = sign_ext(neg.109, new_bit_count=32, id=110) literal.64: bits[32] = literal(value=1, id=64, pos=[(1,2637,47)]) RESULT_SIGNED: bits[1] = literal(value=1, id=51, pos=[(1,2626,45)]) zero_ext.84: bits[32] = zero_ext(RESULT_SZ, new_bit_count=32, id=84) sub.83: bits[32] = sub(zero_ext.81, literal.82, id=83, pos=[(1,2649,37)]) literal.101: bits[8] = literal(value=0, id=101, pos=[(1,2658,21)]) slt.108: bits[1] = slt(effective_exp, literal.107, id=108, pos=[(1,2665,11)]) sel.116: bits[32] = sel(sgt.113, cases=[fraction, shll.115], id=116, pos=[(1,2667,15)]) shrl.111: bits[32] = shrl(fraction, sign_ext.110, id=111, pos=[(1,2666,13)]) literal.69: bits[32] = literal(value=1, id=69, pos=[(1,2639,9)]) literal.63: bits[32] = literal(value=1, id=63, pos=[(1,2637,9)]) sub.65: bits[32] = sub(RESULT_SZ, literal.64, id=65, pos=[(1,2637,35)]) literal.58: bits[32] = literal(value=1, id=58, pos=[(1,2632,47)]) sign_ext.86: bits[32] = sign_ext(exp, new_bit_count=32, id=86) max_exp: bits[32] = sel(RESULT_SIGNED, cases=[zero_ext.84, sub.83], id=85, pos=[(1,2649,18)]) literal.98: bits[8] = literal(value=0, id=98, pos=[(1,2656,20)]) eq.102: bits[1] = eq(exp, literal.101, id=102, pos=[(1,2658,14)]) sel.117: bits[32] = sel(slt.108, cases=[sel.116, shrl.111], id=117, pos=[(1,2665,8)]) literal.103: bits[32] = literal(value=1, id=103, pos=[(1,2659,8)]) shll.70: bits[32] = shll(literal.69, RESULT_SZ, id=70, pos=[(1,2639,9)]) literal.71: bits[32] = literal(value=1, id=71, pos=[(1,2639,47)]) shll.66: bits[32] = shll(literal.63, sub.65, id=66, pos=[(1,2637,9)]) literal.67: bits[32] = literal(value=1, id=67, pos=[(1,2637,57)]) literal.57: bits[32] = literal(value=1, id=57, pos=[(1,2632,9)]) sub.59: bits[32] = sub(RESULT_SZ, literal.58, id=59, pos=[(1,2632,35)]) exp_oob: bits[1] = sge(sign_ext.86, max_exp, id=87, pos=[(1,2650,18)]) invoke.88: bits[1] = invoke(x, to_apply=__apfloat__is_inf__8_23, id=88, pos=[(1,2651,37)]) not.90: bits[1] = not(RESULT_SIGNED, id=90, pos=[(1,2651,45)]) x_sign: bits[1] = tuple_index(x, index=0, id=91, pos=[(1,2651,64)]) slt.99: bits[1] = slt(exp, literal.98, id=99, pos=[(1,2656,14)]) sel.118: bits[32] = sel(eq.102, cases=[sel.117, literal.103], id=118, pos=[(1,2658,11)]) literal.100: bits[32] = literal(value=0, id=100, pos=[(1,2657,8)]) sub.72: bits[32] = sub(shll.70, literal.71, id=72, pos=[(1,2639,9)]) sub.68: bits[32] = sub(shll.66, literal.67, id=68, pos=[(1,2637,9)]) literal.61: bits[32] = literal(value=0, id=61, pos=[(1,2634,8)]) shll.60: bits[32] = shll(literal.57, sub.59, id=60, pos=[(1,2632,9)]) or.89: bits[1] = or(exp_oob, invoke.88, id=89, pos=[(1,2651,20)]) and.92: bits[1] = and(not.90, x_sign, id=92, pos=[(1,2651,45)]) invoke.96: bits[1] = invoke(x, to_apply=__apfloat__is_nan__8_23, id=96, pos=[(1,2654,20)]) sel.119: bits[32] = sel(slt.99, cases=[sel.118, literal.100], id=119, pos=[(1,2656,11)]) literal.97: bits[32] = literal(value=0, id=97, pos=[(1,2655,8)]) x_sign__1: bits[1] = tuple_index(x, index=0, id=94, pos=[(1,2653,12)]) INT_MAX: bits[32] = sel(RESULT_SIGNED, cases=[sub.72, sub.68], id=73, pos=[(1,2636,20)]) INT_MIN: bits[32] = sel(RESULT_SIGNED, cases=[literal.61, shll.60], id=62, pos=[(1,2631,20)]) or.93: bits[1] = or(or.89, and.92, id=93, pos=[(1,2651,20)]) sel.120: bits[32] = sel(invoke.96, cases=[sel.119, literal.97], id=120, pos=[(1,2654,11)]) sel.95: bits[32] = sel(x_sign__1, cases=[INT_MAX, INT_MIN], id=95, pos=[(1,2653,8)]) result: bits[32] = sel(or.93, cases=[sel.120, sel.95], id=121, pos=[(1,2651,17)]) x_sign__2: bits[1] = tuple_index(x, index=0, id=123, pos=[(1,2679,26)]) result__1: bits[32] = zero_ext(result, new_bit_count=32, id=122) not.124: bits[1] = not(x_sign__2, id=124, pos=[(1,2679,24)]) neg.125: bits[32] = neg(result__1, id=125, pos=[(1,2679,50)]) literal.54: bits[32] = literal(value=1, id=54, pos=[(1,2628,45)]) result__2: bits[32] = sel(not.124, cases=[neg.125, result__1], id=126, pos=[(1,2679,21)]) WIDE_FRACTION: bits[32] = add(FRACTION_SZ, literal.54, id=55, pos=[(1,2628,31)]) zero_ext.128: bits[32] = zero_ext(result, new_bit_count=32, id=128) sign_ext.127: bits[32] = sign_ext(result__2, new_bit_count=32, id=127) EXP_SZ: bits[32] = literal(value=8, id=52, pos=[(1,2626,66)]) MAX_FRACTION_SZ: bits[32] = invoke(RESULT_SZ, WIDE_FRACTION, to_apply=__std__max__32_0, id=56, pos=[(1,2629,41)]) ret sel.129: bits[32] = sel(RESULT_SIGNED, cases=[zero_ext.128, sign_ext.127], id=129, pos=[(1,2676,4)]) } fn __apfloat__to_int__8_23_32(x: (bits[1], bits[8], bits[23]) id=130) -> bits[32] { EXP_SZ: bits[32] = literal(value=8, id=131, pos=[(1,2696,14)]) FRACTION_SZ: bits[32] = literal(value=23, id=132, pos=[(1,2696,27)]) RESULT_SZ: bits[32] = literal(value=32, id=133, pos=[(1,2696,45)]) ret invoke.134: bits[32] = invoke(x, to_apply=__apfloat__to_signed_or_unsigned_int__8_23_1_32, id=134, pos=[(1,2698,29)]) } top fn __float32__to_int32(x: (bits[1], bits[8], bits[23]) id=135) -> bits[32] { F32_EXP_SZ: bits[32] = literal(value=8, id=136, pos=[(2,18,23)]) F32_FRACTION_SZ: bits[32] = literal(value=23, id=137, pos=[(2,19,28)]) ret invoke.138: bits[32] = invoke(x, to_apply=__apfloat__to_int__8_23_32, id=138, pos=[(2,105,48)]) }