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__mask_bits__8() -> bits[8] { literal.2: bits[8] = literal(value=0, id=2, pos=[(0,835,41)]) X: bits[32] = literal(value=8, id=1, pos=[(0,835,17)]) ret not.3: bits[8] = not(literal.2, id=3, pos=[(0,835,40)]) } fn __apfloat__tag__8_23(input_float: (bits[1], bits[8], bits[23]) id=4) -> bits[3] { input_float_bexp: bits[8] = tuple_index(input_float, index=1, id=8, pos=[(1,40,22)]) input_float_fraction: bits[23] = tuple_index(input_float, index=2, id=9, pos=[(1,40,40)]) tuple.10: (bits[8], bits[23]) = tuple(input_float_bexp, input_float_fraction, id=10, pos=[(1,40,10)]) EXPR_MASK: bits[8] = invoke(to_apply=__std__mask_bits__8, id=7, pos=[(1,39,36)]) tuple_index.40: bits[8] = tuple_index(tuple.10, index=0, id=40) tuple_index.31: bits[8] = tuple_index(tuple.10, index=0, id=31) literal.23: bits[8] = literal(value=0, id=23, pos=[(1,42,9)]) tuple_index.22: bits[8] = tuple_index(tuple.10, index=0, id=22) literal.13: bits[8] = literal(value=0, id=13, pos=[(1,41,9)]) tuple_index.12: bits[8] = 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[23] = literal(value=0, id=35, pos=[(1,43,20)]) tuple_index.34: bits[23] = 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[23] = literal(value=0, id=17, pos=[(1,41,23)]) tuple_index.16: bits[23] = 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=8, id=5, pos=[(1,38,11)]) FRACTION_SZ: bits[32] = literal(value=23, id=6, pos=[(1,38,24)]) tuple_index.26: bits[23] = tuple_index(tuple.10, index=1, id=26) tuple_index.43: bits[23] = tuple_index(tuple.10, index=1, id=43) tuple_index.48: bits[8] = tuple_index(tuple.10, index=0, id=48) tuple_index.51: bits[23] = 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__8_23() -> (bits[1], bits[8], bits[23]) { FRACTION_SZ: bits[32] = literal(value=23, 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[8] = invoke(to_apply=__std__mask_bits__8, id=60, pos=[(1,53,28)]) literal.62: bits[23] = literal(value=1, id=62, pos=[(1,54,18)]) bit_slice.65: bits[23] = bit_slice(sub.64, start=0, width=23, id=65) literal.59: bits[1] = literal(value=0, id=59, pos=[(1,52,14)]) zero_ext.61: bits[8] = zero_ext(invoke.60, new_bit_count=8, id=61) shll.66: bits[23] = shll(literal.62, bit_slice.65, id=66, pos=[(1,54,18)]) EXP_SZ: bits[32] = literal(value=8, id=57, pos=[(1,50,12)]) ret tuple.67: (bits[1], bits[8], bits[23]) = tuple(literal.59, zero_ext.61, shll.66, id=67, pos=[(1,51,33)]) } fn __apfloat__inf__8_23(sign: bits[1] id=68) -> (bits[1], bits[8], bits[23]) { invoke.71: bits[8] = invoke(to_apply=__std__mask_bits__8, id=71, pos=[(1,78,28)]) literal.72: bits[23] = literal(value=0, id=72, pos=[(1,79,18)]) EXP_SZ: bits[32] = literal(value=8, id=69, pos=[(1,75,11)]) FRACTION_SZ: bits[32] = literal(value=23, id=70, pos=[(1,75,24)]) ret tuple.73: (bits[1], bits[8], bits[23]) = tuple(sign, invoke.71, literal.72, id=73, pos=[(1,76,33)]) } fn __apfloat__zero__8_23(sign: bits[1] id=74) -> (bits[1], bits[8], bits[23]) { literal.77: bits[8] = literal(value=0, id=77, pos=[(1,131,47)]) literal.78: bits[23] = literal(value=0, id=78, pos=[(1,131,73)]) EXP_SZ: bits[32] = literal(value=8, id=75, pos=[(1,130,12)]) FRACTION_SZ: bits[32] = literal(value=23, id=76, pos=[(1,130,25)]) ret tuple.79: (bits[1], bits[8], bits[23]) = tuple(sign, literal.77, literal.78, id=79, pos=[(1,131,33)]) } fn __std__signed_max_value__8_7() -> bits[8] { literal.82: bits[8] = literal(value=1, id=82, pos=[(0,47,6)]) N_MINUS_ONE: bits[32] = literal(value=7, id=81, pos=[(0,46,32)]) shll.83: bits[8] = shll(literal.82, N_MINUS_ONE, id=83, pos=[(0,47,6)]) literal.84: bits[8] = literal(value=1, id=84, pos=[(0,47,32)]) sub.85: bits[8] = sub(shll.83, literal.84, id=85, pos=[(0,47,6)]) N: bits[32] = literal(value=8, id=80, pos=[(0,46,24)]) ret sign_ext.86: bits[8] = sign_ext(sub.85, new_bit_count=8, id=86) } fn __apfloat__bias__8(unbiased_exponent: bits[8] id=87) -> bits[8] { BIAS: bits[8] = invoke(to_apply=__std__signed_max_value__8_7, id=89, pos=[(1,343,38)]) add.90: bits[8] = add(unbiased_exponent, BIAS, id=90, pos=[(1,344,5)]) EXP_SZ: bits[32] = literal(value=8, id=88, pos=[(1,342,12)]) ret sign_ext.91: bits[8] = sign_ext(add.90, new_bit_count=8, id=91) } fn __apfloat__has_fractional_part__8_23(f: (bits[1], bits[8], bits[23]) id=92) -> bits[1] { FRACTION_SZ: bits[32] = literal(value=23, id=94, pos=[(1,4187,40)]) bit_slice.96: bits[8] = bit_slice(FRACTION_SZ, start=0, width=8, id=96) f_bexp: bits[8] = tuple_index(f, index=1, id=95, pos=[(1,4188,5)]) invoke.97: bits[8] = invoke(bit_slice.96, to_apply=__apfloat__bias__8, id=97, pos=[(1,4188,17)]) EXP_SZ: bits[32] = literal(value=8, id=93, pos=[(1,4187,27)]) ret ult.98: bits[1] = ult(f_bexp, invoke.97, id=98, pos=[(1,4188,5)]) } fn __apfloat__has_negative_exponent__8_23(f: (bits[1], bits[8], bits[23]) id=99) -> bits[1] { literal.103: bits[8] = literal(value=0, id=103, pos=[(1,4215,18)]) f_bexp: bits[8] = tuple_index(f, index=1, id=102, pos=[(1,4215,5)]) invoke.104: bits[8] = invoke(literal.103, to_apply=__apfloat__bias__8, id=104, pos=[(1,4215,17)]) EXP_SZ: bits[32] = literal(value=8, id=100, pos=[(1,4213,29)]) FRACTION_SZ: bits[32] = literal(value=23, id=101, pos=[(1,4213,42)]) ret ult.105: bits[1] = ult(f_bexp, invoke.104, id=105, pos=[(1,4215,5)]) } fn __std__mask_bits__7() -> bits[7] { literal.107: bits[7] = literal(value=0, id=107, pos=[(0,835,41)]) X: bits[32] = literal(value=7, id=106, pos=[(0,835,17)]) ret not.108: bits[7] = not(literal.107, id=108, pos=[(0,835,40)]) } fn __apfloat__one__8_23(sign: bits[1] id=109) -> (bits[1], bits[8], bits[23]) { invoke.114: bits[7] = invoke(to_apply=__std__mask_bits__7, id=114, pos=[(1,150,28)]) EXP_SZ: bits[32] = literal(value=8, id=110, pos=[(1,146,11)]) literal.112: bits[32] = literal(value=1, id=112, pos=[(1,147,34)]) zero_ext.115: bits[8] = zero_ext(invoke.114, new_bit_count=8, id=115) literal.116: bits[23] = literal(value=0, id=116, pos=[(1,151,18)]) FRACTION_SZ: bits[32] = literal(value=23, id=111, pos=[(1,146,24)]) MASK_SZ: bits[32] = sub(EXP_SZ, literal.112, id=113, pos=[(1,147,25)]) ret tuple.117: (bits[1], bits[8], bits[23]) = tuple(sign, zero_ext.115, literal.116, id=117, pos=[(1,148,33)]) } fn __apfloat__exponent_bias__8_23(f: (bits[1], bits[8], bits[23]) id=118) -> bits[8] { invoke.121: bits[8] = invoke(to_apply=__std__signed_max_value__8_7, id=121, pos=[(1,221,25)]) EXP_SZ: bits[32] = literal(value=8, id=119, pos=[(1,220,21)]) FRACTION_SZ: bits[32] = literal(value=23, id=120, pos=[(1,220,34)]) ret sign_ext.122: bits[8] = sign_ext(invoke.121, new_bit_count=8, id=122) } fn __apfloat__unbiased_exponent__8_23(f: (bits[1], bits[8], bits[23]) id=123) -> bits[8] { f_bexp: bits[8] = tuple_index(f, index=1, id=127, pos=[(1,266,6)]) zero_ext.128: bits[8] = zero_ext(f_bexp, new_bit_count=8, id=128) bias: bits[8] = invoke(f, to_apply=__apfloat__exponent_bias__8_23, id=126, pos=[(1,265,28)]) EXP_SZ: bits[32] = literal(value=8, id=124, pos=[(1,263,25)]) FRACTION_SZ: bits[32] = literal(value=23, id=125, pos=[(1,263,38)]) ret sub.129: bits[8] = sub(zero_ext.128, bias, id=129, pos=[(1,266,6)]) } fn __std__mask_bits__23() -> bits[23] { literal.131: bits[23] = literal(value=0, id=131, pos=[(0,835,41)]) X: bits[32] = literal(value=23, id=130, pos=[(0,835,17)]) ret not.132: bits[23] = not(literal.131, id=132, pos=[(0,835,40)]) } fn __apfloat__round_up_no_sign_positive_exp__8_23(f: (bits[1], bits[8], bits[23]) id=133) -> (bits[1], bits[8], bits[23]) { exp: bits[8] = invoke(f, to_apply=__apfloat__unbiased_exponent__8_23, id=136, pos=[(1,4234,31)]) invoke.137: bits[23] = invoke(to_apply=__std__mask_bits__23, id=137, pos=[(1,4236,40)]) sign_ext.138: bits[32] = sign_ext(exp, new_bit_count=32, id=138) f_fraction: bits[23] = tuple_index(f, index=2, id=140, pos=[(1,4255,9)]) fractional_mask: bits[23] = shrl(invoke.137, sign_ext.138, id=139, pos=[(1,4236,40)]) zero_ext.141: bits[24] = zero_ext(f_fraction, new_bit_count=24, id=141) zero_ext.142: bits[24] = zero_ext(fractional_mask, new_bit_count=24, id=142) fraction_up: bits[24] = add(zero_ext.141, zero_ext.142, id=143, pos=[(1,4255,9)]) FRACTION_SZ: bits[32] = literal(value=23, id=135, pos=[(1,4231,46)]) dynamic_bit_slice.145: bits[1] = dynamic_bit_slice(fraction_up, FRACTION_SZ, width=1, id=145, pos=[(1,4258,46)]) literal.148: bits[24] = literal(value=0, id=148, pos=[(1,4260,40)]) f_bexp: bits[8] = tuple_index(f, index=1, id=144, pos=[(1,4258,27)]) zero_ext.146: bits[8] = zero_ext(dynamic_bit_slice.145, new_bit_count=8, id=146) dynamic_bit_slice.149: bits[23] = dynamic_bit_slice(fraction_up, literal.148, width=23, id=149, pos=[(1,4260,39)]) not.150: bits[23] = not(fractional_mask, id=150, pos=[(1,4260,62)]) f_sign: bits[1] = tuple_index(f, index=0, id=152, pos=[(1,4261,21)]) bexp_with_carry: bits[8] = add(f_bexp, zero_ext.146, id=147, pos=[(1,4258,27)]) fraction_integral: bits[23] = and(dynamic_bit_slice.149, not.150, id=151, pos=[(1,4260,39)]) EXP_SZ: bits[32] = literal(value=8, id=134, pos=[(1,4231,33)]) ret tuple.153: (bits[1], bits[8], bits[23]) = tuple(f_sign, bexp_with_carry, fraction_integral, id=153, pos=[(1,4261,12)]) } fn __apfloat__round_down_no_sign_positive_exp__8_23(f: (bits[1], bits[8], bits[23]) id=154) -> (bits[1], bits[8], bits[23]) { exp: bits[8] = invoke(f, to_apply=__apfloat__unbiased_exponent__8_23, id=157, pos=[(1,4268,31)]) invoke.158: bits[23] = invoke(to_apply=__std__mask_bits__23, id=158, pos=[(1,4270,40)]) sign_ext.159: bits[32] = sign_ext(exp, new_bit_count=32, id=159) fractional_mask: bits[23] = shrl(invoke.158, sign_ext.159, id=160, pos=[(1,4270,40)]) f_fraction: bits[23] = tuple_index(f, index=2, id=161, pos=[(1,4272,29)]) not.162: bits[23] = not(fractional_mask, id=162, pos=[(1,4272,41)]) f_sign: bits[1] = tuple_index(f, index=0, id=164, pos=[(1,4273,21)]) f_bexp: bits[8] = tuple_index(f, index=1, id=165, pos=[(1,4273,35)]) fraction_integral: bits[23] = and(f_fraction, not.162, id=163, pos=[(1,4272,29)]) EXP_SZ: bits[32] = literal(value=8, id=155, pos=[(1,4265,35)]) FRACTION_SZ: bits[32] = literal(value=23, id=156, pos=[(1,4265,48)]) ret tuple.166: (bits[1], bits[8], bits[23]) = tuple(f_sign, f_bexp, fraction_integral, id=166, pos=[(1,4273,12)]) } fn __apfloat__floor_with_denorms__8_23(f: (bits[1], bits[8], bits[23]) id=167) -> (bits[1], bits[8], bits[23]) { f_sign__3: bits[1] = tuple_index(f, index=0, id=194, pos=[(1,4503,23)]) literal.195: bits[1] = literal(value=1, id=195, pos=[(1,4503,32)]) f_sign__2: bits[1] = tuple_index(f, index=0, id=186, pos=[(1,4496,20)]) literal.187: bits[1] = literal(value=0, id=187, pos=[(1,4496,29)]) literal.191: bits[1] = literal(value=0, id=191, pos=[(1,4501,46)]) literal.189: bits[1] = literal(value=1, id=189, pos=[(1,4498,45)]) eq.196: bits[1] = eq(f_sign__3, literal.195, id=196, pos=[(1,4503,23)]) invoke.198: (bits[1], bits[8], bits[23]) = invoke(f, to_apply=__apfloat__round_down_no_sign_positive_exp__8_23, id=198, pos=[(1,4508,47)]) invoke.197: (bits[1], bits[8], bits[23]) = invoke(f, to_apply=__apfloat__round_up_no_sign_positive_exp__8_23, id=197, pos=[(1,4505,45)]) ne.188: bits[1] = ne(f_sign__2, literal.187, id=188, pos=[(1,4496,20)]) invoke.192: (bits[1], bits[8], bits[23]) = invoke(literal.191, to_apply=__apfloat__zero__8_23, id=192, pos=[(1,4501,24)]) invoke.190: (bits[1], bits[8], bits[23]) = invoke(literal.189, to_apply=__apfloat__one__8_23, id=190, pos=[(1,4498,23)]) literal.178: bits[3] = literal(value=3, id=178, pos=[(1,4491,8)]) invoke.170: bits[3] = invoke(f, to_apply=__apfloat__tag__8_23, id=170, pos=[(1,4488,13)]) literal.174: bits[3] = literal(value=1, id=174, pos=[(1,4490,8)]) literal.171: bits[3] = literal(value=0, id=171, pos=[(1,4489,8)]) invoke.183: bits[1] = invoke(f, to_apply=__apfloat__has_fractional_part__8_23, id=183, pos=[(1,4493,35)]) invoke.185: bits[1] = invoke(f, to_apply=__apfloat__has_negative_exponent__8_23, id=185, pos=[(1,4495,43)]) sel.199: (bits[1], bits[8], bits[23]) = sel(eq.196, cases=[invoke.198, invoke.197], id=199, pos=[(1,4503,19)]) sel.193: (bits[1], bits[8], bits[23]) = sel(ne.188, cases=[invoke.192, invoke.190], id=193, pos=[(1,4496,16)]) eq.179: bits[1] = eq(literal.178, invoke.170, id=179) eq.175: bits[1] = eq(literal.174, invoke.170, id=175) eq.172: bits[1] = eq(literal.171, invoke.170, id=172) f_sign: bits[1] = tuple_index(f, index=0, id=176, pos=[(1,4490,58)]) f_sign__1: bits[1] = tuple_index(f, index=0, id=180, pos=[(1,4491,55)]) not.184: bits[1] = not(invoke.183, id=184, pos=[(1,4493,15)]) sel.200: (bits[1], bits[8], bits[23]) = sel(invoke.185, cases=[sel.199, sel.193], id=200, pos=[(1,4495,19)]) concat.202: bits[3] = concat(eq.179, eq.175, eq.172, id=202) invoke.173: (bits[1], bits[8], bits[23]) = invoke(to_apply=__apfloat__qnan__8_23, id=173, pos=[(1,4489,31)]) invoke.177: (bits[1], bits[8], bits[23]) = invoke(f_sign, to_apply=__apfloat__inf__8_23, id=177, pos=[(1,4490,35)]) invoke.181: (bits[1], bits[8], bits[23]) = invoke(f_sign__1, to_apply=__apfloat__zero__8_23, id=181, pos=[(1,4491,32)]) sel.201: (bits[1], bits[8], bits[23]) = sel(not.184, cases=[sel.200, f], id=201, pos=[(1,4493,12)]) EXP_SZ: bits[32] = literal(value=8, id=168, pos=[(1,4485,26)]) FRACTION_SZ: bits[32] = literal(value=23, id=169, pos=[(1,4485,39)]) literal.182: bits[1] = literal(value=1, id=182, pos=[(1,4492,8)]) ret priority_sel.203: (bits[1], bits[8], bits[23]) = priority_sel(concat.202, cases=[invoke.173, invoke.177, invoke.181], default=sel.201, id=203) } top fn __float32__floor_with_denorms(f: (bits[1], bits[8], bits[23]) id=204) -> (bits[1], bits[8], bits[23]) { ret invoke.205: (bits[1], bits[8], bits[23]) = invoke(f, to_apply=__apfloat__floor_with_denorms__8_23, id=205, pos=[(2,455,70)]) }