package bfloat16 file_number 0 "/inputs/subtree/xls/dslx/stdlib/apfloat.x" file_number 1 "/inputs/subtree/xls/dslx/stdlib/std.x" file_number 2 "/inputs/subtree/xls/dslx/stdlib/bfloat16.x" fn __apfloat__is_zero_or_subnormal__8_7(x: (bits[1], bits[8], bits[7]) id=1) -> bits[1] { x_bexp: bits[8] = tuple_index(x, index=1, id=4, pos=[(0,804,5)]) literal.5: bits[8] = literal(value=0, id=5, pos=[(0,804,14)]) EXP_SZ: bits[32] = literal(value=8, id=2, pos=[(0,802,28)]) FRACTION_SZ: bits[32] = literal(value=7, id=3, pos=[(0,802,41)]) ret eq.6: bits[1] = eq(x_bexp, literal.5, id=6, pos=[(0,804,5)]) } fn __std__umul__8_8_16(x: bits[8] id=7, y: bits[8] id=8) -> bits[16] { zero_ext.12: bits[16] = zero_ext(x, new_bit_count=16, id=12) zero_ext.13: bits[16] = zero_ext(y, new_bit_count=16, id=13) N: bits[32] = literal(value=8, id=9, pos=[(1,223,12)]) M: bits[32] = literal(value=8, id=10, pos=[(1,223,20)]) R: bits[32] = literal(value=16, id=11, pos=[(1,223,28)]) ret umul.14: bits[16] = umul(zero_ext.12, zero_ext.13, id=14, pos=[(1,224,5)]) } fn __std__mask_bits__8() -> bits[8] { literal.16: bits[8] = literal(value=0, id=16, pos=[(1,835,41)]) X: bits[32] = literal(value=8, id=15, pos=[(1,835,17)]) ret not.17: bits[8] = not(literal.16, id=17, pos=[(1,835,40)]) } fn __std__msb__16_0(x: bits[16] id=18) -> bits[1] { zero_ext.21: bits[16] = zero_ext(x, new_bit_count=16, id=21) S: bits[1] = literal(value=0, id=19, pos=[(1,357,11)]) N: bits[32] = literal(value=16, id=20, pos=[(1,357,20)]) ret bit_slice.22: bits[1] = bit_slice(zero_ext.21, start=15, width=1, id=22, pos=[(1,357,61)]) } fn __apfloat__is_inf__8_7(x: (bits[1], bits[8], bits[7]) id=23) -> bits[1] { x_bexp: bits[8] = tuple_index(x, index=1, id=26, pos=[(0,96,6)]) invoke.27: bits[8] = invoke(to_apply=__std__mask_bits__8, id=27, pos=[(0,96,29)]) x_fraction: bits[7] = tuple_index(x, index=2, id=29, pos=[(0,96,44)]) literal.30: bits[7] = literal(value=0, id=30, pos=[(0,96,57)]) eq.28: bits[1] = eq(x_bexp, invoke.27, id=28, pos=[(0,96,6)]) eq.31: bits[1] = eq(x_fraction, literal.30, id=31, pos=[(0,96,44)]) EXP_SZ: bits[32] = literal(value=8, id=24, pos=[(0,95,14)]) FRACTION_SZ: bits[32] = literal(value=7, id=25, pos=[(0,95,27)]) ret and.32: bits[1] = and(eq.28, eq.31, id=32, pos=[(0,96,6)]) } fn __std__signed_max_value__10_9() -> bits[10] { literal.35: bits[10] = literal(value=1, id=35, pos=[(1,47,6)]) N_MINUS_ONE: bits[32] = literal(value=9, id=34, pos=[(1,46,32)]) shll.36: bits[10] = shll(literal.35, N_MINUS_ONE, id=36, pos=[(1,47,6)]) literal.37: bits[10] = literal(value=1, id=37, pos=[(1,47,32)]) sub.38: bits[10] = sub(shll.36, literal.37, id=38, pos=[(1,47,6)]) N: bits[32] = literal(value=10, id=33, pos=[(1,46,24)]) ret sign_ext.39: bits[10] = sign_ext(sub.38, new_bit_count=10, id=39) } fn __apfloat__is_nan__8_7(x: (bits[1], bits[8], bits[7]) id=40) -> bits[1] { x_bexp: bits[8] = tuple_index(x, index=1, id=43, pos=[(0,71,6)]) invoke.44: bits[8] = invoke(to_apply=__std__mask_bits__8, id=44, pos=[(0,71,29)]) x_fraction: bits[7] = tuple_index(x, index=2, id=46, pos=[(0,71,44)]) literal.47: bits[7] = literal(value=0, id=47, pos=[(0,71,57)]) eq.45: bits[1] = eq(x_bexp, invoke.44, id=45, pos=[(0,71,6)]) ne.48: bits[1] = ne(x_fraction, literal.47, id=48, pos=[(0,71,44)]) EXP_SZ: bits[32] = literal(value=8, id=41, pos=[(0,70,14)]) FRACTION_SZ: bits[32] = literal(value=7, id=42, pos=[(0,70,27)]) ret and.49: bits[1] = and(eq.45, ne.48, id=49, pos=[(0,71,6)]) } fn __apfloat__raw_mul__8_7_7_10_16(x: (bits[1], bits[8], bits[7]) id=50, y: (bits[1], bits[8], bits[7]) id=51) -> (bits[1], bits[1], bits[10], bits[16]) { literal.60: bits[1] = literal(value=1, id=60, pos=[(0,3430,24)]) x_fraction: bits[7] = tuple_index(x, index=2, id=61, pos=[(0,3430,33)]) literal.63: bits[1] = literal(value=1, id=63, pos=[(0,3431,24)]) y_fraction: bits[7] = tuple_index(y, index=2, id=64, pos=[(0,3431,33)]) x_bexp: bits[8] = tuple_index(x, index=1, id=73, pos=[(0,3444,16)]) y_bexp: bits[8] = tuple_index(y, index=1, id=75, pos=[(0,3444,45)]) invoke.69: bits[8] = invoke(to_apply=__std__mask_bits__8, id=69, pos=[(0,3443,29)]) invoke.57: bits[1] = invoke(x, to_apply=__apfloat__is_zero_or_subnormal__8_7, id=57, pos=[(0,3427,40)]) invoke.58: bits[1] = invoke(y, to_apply=__apfloat__is_zero_or_subnormal__8_7, id=58, pos=[(0,3427,67)]) x_significand: bits[8] = concat(literal.60, x_fraction, id=62, pos=[(0,3430,24)]) y_significand: bits[8] = concat(literal.63, y_fraction, id=65, pos=[(0,3431,24)]) zero_ext.74: bits[10] = zero_ext(x_bexp, new_bit_count=10, id=74) zero_ext.76: bits[10] = zero_ext(y_bexp, new_bit_count=10, id=76) zero_ext.70: bits[10] = zero_ext(invoke.69, new_bit_count=10, id=70) literal.71: bits[10] = literal(value=1, id=71, pos=[(0,3443,61)]) has_0_arg: bits[1] = or(invoke.57, invoke.58, id=59, pos=[(0,3427,40)]) invoke.67: bits[16] = invoke(x_significand, y_significand, to_apply=__std__umul__8_8_16, id=67, pos=[(0,3435,61)]) literal.66: bits[16] = literal(value=0, id=66, pos=[(0,3435,23)]) add.77: bits[10] = add(zero_ext.74, zero_ext.76, id=77, pos=[(0,3444,16)]) bias: bits[10] = shra(zero_ext.70, literal.71, id=72, pos=[(0,3443,29)]) full_product: bits[16] = sel(has_0_arg, cases=[invoke.67, literal.66], id=68, pos=[(0,3435,8)]) invoke.100: bits[1] = invoke(x, to_apply=__apfloat__is_inf__8_7, id=100, pos=[(0,3484,28)]) invoke.101: bits[1] = invoke(y, to_apply=__apfloat__is_inf__8_7, id=101, pos=[(0,3484,41)]) exp: bits[10] = sub(add.77, bias, id=78, pos=[(0,3444,16)]) literal.79: bits[10] = literal(value=0, id=79, pos=[(0,3453,29)]) in_upper_binade: bits[1] = invoke(full_product, to_apply=__std__msb__16_0, id=81, pos=[(0,3459,34)]) literal.82: bits[1] = literal(value=1, id=82, pos=[(0,3460,90)]) invoke.97: bits[1] = invoke(x, to_apply=__apfloat__is_nan__8_7, id=97, pos=[(0,3483,28)]) invoke.98: bits[1] = invoke(y, to_apply=__apfloat__is_nan__8_7, id=98, pos=[(0,3483,41)]) has_inf_arg: bits[1] = or(invoke.100, invoke.101, id=102, pos=[(0,3484,28)]) invoke.90: bits[1] = invoke(x, to_apply=__apfloat__is_inf__8_7, id=90, pos=[(0,3477,31)]) invoke.91: bits[1] = invoke(y, to_apply=__apfloat__is_inf__8_7, id=91, pos=[(0,3477,44)]) exp__1: bits[10] = sel(has_0_arg, cases=[exp, literal.79], id=80, pos=[(0,3453,14)]) zero_ext.85: bits[10] = zero_ext(in_upper_binade, new_bit_count=10, id=85) shll.83: bits[16] = shll(full_product, literal.82, id=83, pos=[(0,3460,74)]) has_nan_arg: bits[1] = or(invoke.97, invoke.98, id=99, pos=[(0,3483,28)]) and.103: bits[1] = and(has_0_arg, has_inf_arg, id=103, pos=[(0,3485,40)]) x_sign: bits[1] = tuple_index(x, index=0, id=87, pos=[(0,3467,23)]) y_sign: bits[1] = tuple_index(y, index=0, id=88, pos=[(0,3467,33)]) is_operand_inf: bits[1] = or(invoke.90, invoke.91, id=92, pos=[(0,3477,31)]) result_exp: bits[10] = add(exp__1, zero_ext.85, id=86, pos=[(0,3464,14)]) invoke.93: bits[10] = invoke(to_apply=__std__signed_max_value__10_9, id=93, pos=[(0,3478,62)]) result_fraction: bits[16] = sel(in_upper_binade, cases=[shll.83, full_product], id=84, pos=[(0,3460,30)]) literal.95: bits[16] = literal(value=0, id=95, pos=[(0,3479,46)]) is_result_nan: bits[1] = or(has_nan_arg, and.103, id=104, pos=[(0,3485,24)]) result_sign: bits[1] = ne(x_sign, y_sign, id=89, pos=[(0,3467,23)]) result_exp__1: bits[10] = sel(is_operand_inf, cases=[result_exp, invoke.93], id=94, pos=[(0,3478,21)]) result_fraction__1: bits[16] = sel(is_operand_inf, cases=[result_fraction, literal.95], id=96, pos=[(0,3479,26)]) EXP_SZ: bits[32] = literal(value=8, id=52, pos=[(0,3422,5)]) FRACTION_SZ_X: bits[32] = literal(value=7, id=53, pos=[(0,3422,18)]) FRACTION_SZ_Y: bits[32] = literal(value=7, id=54, pos=[(0,3422,38)]) SIGNED_EXP: bits[32] = literal(value=10, id=55, pos=[(0,3422,58)]) WIDE_FRACTION: bits[32] = literal(value=16, id=56, pos=[(0,3423,5)]) ret tuple.105: (bits[1], bits[1], bits[10], bits[16]) = tuple(is_result_nan, result_sign, result_exp__1, result_fraction__1, id=105, pos=[(0,3487,42)]) } fn __std__unsigned_max_value__8_9() -> bits[8] { literal.108: bits[9] = literal(value=1, id=108, pos=[(1,81,6)]) N: bits[32] = literal(value=8, id=106, pos=[(1,80,26)]) shll.109: bits[9] = shll(literal.108, N, id=109, pos=[(1,81,6)]) literal.110: bits[9] = literal(value=1, id=110, pos=[(1,81,31)]) sub.111: bits[9] = sub(shll.109, literal.110, id=111, pos=[(1,81,6)]) N_PLUS_ONE: bits[32] = literal(value=9, id=107, pos=[(1,80,34)]) ret bit_slice.112: bits[8] = bit_slice(sub.111, start=0, width=8, id=112) } fn __apfloat__qnan__8_15() -> (bits[1], bits[8], bits[15]) { FRACTION_SZ: bits[32] = literal(value=15, id=114, pos=[(0,50,25)]) literal.119: bits[32] = literal(value=1, id=119, pos=[(0,54,57)]) sub.120: bits[32] = sub(FRACTION_SZ, literal.119, id=120, pos=[(0,54,43)]) invoke.116: bits[8] = invoke(to_apply=__std__mask_bits__8, id=116, pos=[(0,53,28)]) literal.118: bits[15] = literal(value=1, id=118, pos=[(0,54,18)]) bit_slice.121: bits[15] = bit_slice(sub.120, start=0, width=15, id=121) literal.115: bits[1] = literal(value=0, id=115, pos=[(0,52,14)]) zero_ext.117: bits[8] = zero_ext(invoke.116, new_bit_count=8, id=117) shll.122: bits[15] = shll(literal.118, bit_slice.121, id=122, pos=[(0,54,18)]) EXP_SZ: bits[32] = literal(value=8, id=113, pos=[(0,50,12)]) ret tuple.123: (bits[1], bits[8], bits[15]) = tuple(literal.115, zero_ext.117, shll.122, id=123, pos=[(0,51,33)]) } fn __apfloat__inf__8_15(sign: bits[1] id=124) -> (bits[1], bits[8], bits[15]) { invoke.127: bits[8] = invoke(to_apply=__std__mask_bits__8, id=127, pos=[(0,78,28)]) literal.128: bits[15] = literal(value=0, id=128, pos=[(0,79,18)]) EXP_SZ: bits[32] = literal(value=8, id=125, pos=[(0,75,11)]) FRACTION_SZ: bits[32] = literal(value=15, id=126, pos=[(0,75,24)]) ret tuple.129: (bits[1], bits[8], bits[15]) = tuple(sign, invoke.127, literal.128, id=129, pos=[(0,76,33)]) } fn __apfloat__zero__8_15(sign: bits[1] id=130) -> (bits[1], bits[8], bits[15]) { literal.133: bits[8] = literal(value=0, id=133, pos=[(0,131,47)]) literal.134: bits[15] = literal(value=0, id=134, pos=[(0,131,73)]) EXP_SZ: bits[32] = literal(value=8, id=131, pos=[(0,130,12)]) FRACTION_SZ: bits[32] = literal(value=15, id=132, pos=[(0,130,25)]) ret tuple.135: (bits[1], bits[8], bits[15]) = tuple(sign, literal.133, literal.134, id=135, pos=[(0,131,33)]) } fn __apfloat__full_precision_mul__8_15_7_7(x: (bits[1], bits[8], bits[7]) id=136, y: (bits[1], bits[8], bits[7]) id=137) -> (bits[1], bits[8], bits[15]) { raw_product: (bits[1], bits[1], bits[10], bits[16]) = invoke(x, y, to_apply=__apfloat__raw_mul__8_7_7_10_16, id=144, pos=[(0,3510,29)]) raw_product_bexp__2: bits[10] = tuple_index(raw_product, index=2, id=159, pos=[(0,3530,29)]) raw_product_fraction: bits[16] = tuple_index(raw_product, index=3, id=161, pos=[(0,3531,33)]) special_exp: bits[8] = invoke(to_apply=__std__unsigned_max_value__8_9, id=145, pos=[(0,3515,45)]) raw_product_bexp__1: bits[10] = tuple_index(raw_product, index=2, id=153, pos=[(0,3522,25)]) literal.154: bits[10] = literal(value=0, id=154, pos=[(0,3522,34)]) raw_product_sign__2: bits[1] = tuple_index(raw_product, index=1, id=158, pos=[(0,3529,29)]) bit_slice.160: bits[8] = bit_slice(raw_product_bexp__2, start=0, width=8, id=160) bit_slice.162: bits[15] = bit_slice(raw_product_fraction, start=0, width=15, id=162) raw_product_sign__1: bits[1] = tuple_index(raw_product, index=1, id=156, pos=[(0,3524,45)]) raw_product_bexp: bits[10] = tuple_index(raw_product, index=2, id=148, pos=[(0,3519,25)]) zero_ext.149: bits[10] = zero_ext(special_exp, new_bit_count=10, id=149) sle.155: bits[1] = sle(raw_product_bexp__1, literal.154, id=155, pos=[(0,3522,25)]) tuple.163: (bits[1], bits[8], bits[15]) = tuple(raw_product_sign__2, bit_slice.160, bit_slice.162, id=163, pos=[(0,3528,37)]) invoke.157: (bits[1], bits[8], bits[15]) = invoke(raw_product_sign__1, to_apply=__apfloat__zero__8_15, id=157, pos=[(0,3524,12)]) raw_product_sign: bits[1] = tuple_index(raw_product, index=1, id=151, pos=[(0,3521,44)]) sge.150: bits[1] = sge(raw_product_bexp, zero_ext.149, id=150, pos=[(0,3519,25)]) sel.164: (bits[1], bits[8], bits[15]) = sel(sle.155, cases=[tuple.163, invoke.157], id=164, pos=[(0,3522,11)]) invoke.152: (bits[1], bits[8], bits[15]) = invoke(raw_product_sign, to_apply=__apfloat__inf__8_15, id=152, pos=[(0,3521,11)]) EXP_SZ: bits[32] = literal(value=8, id=138, pos=[(0,3498,5)]) literal.142: bits[32] = literal(value=2, id=142, pos=[(0,3506,32)]) raw_product_is_nan: bits[1] = tuple_index(raw_product, index=0, id=146, pos=[(0,3516,18)]) sel.165: (bits[1], bits[8], bits[15]) = sel(sge.150, cases=[sel.164, invoke.152], id=165, pos=[(0,3519,11)]) invoke.147: (bits[1], bits[8], bits[15]) = invoke(to_apply=__apfloat__qnan__8_15, id=147, pos=[(0,3518,12)]) FRACTION_SZ_X: bits[32] = literal(value=7, id=139, pos=[(0,3498,18)]) FRACTION_SZ_Y: bits[32] = literal(value=7, id=140, pos=[(0,3498,38)]) FRACTION_SZ: bits[32] = literal(value=15, id=141, pos=[(0,3499,5)]) SIGNED_EXP: bits[32] = add(EXP_SZ, literal.142, id=143, pos=[(0,3506,23)]) ret sel.166: (bits[1], bits[8], bits[15]) = sel(raw_product_is_nan, cases=[sel.165, invoke.147], id=166, pos=[(0,3516,4)]) } top fn __bfloat16__full_precision_mul(x: (bits[1], bits[8], bits[7]) id=167, y: (bits[1], bits[8], bits[7]) id=168) -> (bits[1], bits[8], bits[15]) { ret invoke.169: (bits[1], bits[8], bits[15]) = invoke(x, y, to_apply=__apfloat__full_precision_mul__8_15_7_7, id=169, pos=[(2,169,31)]) }