o
    2g                  
   @  sn  U d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
mZ ddlmZmZ ddlmZ ddlmZ ddlmZmZ dd	lmZ G d
d deZee	jeddee	jeddee	jeddee	jeddee	jeddee	jedddZde d< d3ddZ!edd4d!d"Z"ed#d4d$d%Z#ed&d4d'd(Z$ed)d4d*d+Z%ed,d4d-d.Z&ed/d4d0d1Z'd2S )5z4Convert tagged int primitive ops to lower-level ops.    )annotations)
NamedTuple)Assign
BasicBlockBranchComparisonOpRegisterValue)bool_rprimitiveis_short_int_rprimitive)LowLevelIRBuilder)lower_primitive_op)
int_equal_int_less_than_)CFunctionDescriptionc                   @  s.   e Zd ZU ded< ded< ded< ded< dS )	IntComparisonOpDescriptionintbinary_op_variantr   c_func_descriptionboolc_func_negatedc_func_swap_operandsN)__name__
__module____qualname____annotations__ r   r   K/home/garg/my-data/venv/lib/python3.10/site-packages/mypyc/lower/int_ops.pyr      s
   
 r   FT)==!=<<=>>=z%dict[str, IntComparisonOpDescription]int_comparison_op_mappingselfr   lhsr	   rhsopstrliner   returnc                 C  s  t |js
t |jr|dv rd}n
t |jot |j}|r)| ||t| d |S t| \}}}}	tt}
t t t }}}| j||dd}|dv rX| t	|||t	j
 n&t }| t	|||t	j
 | | | j||dd}| t	|||t	j
 | | |	r||g}n||g}| |||}|r| |d|}n|}| t|
|| | | | | | ||||}| t|
|| | | |
S )zACompare two tagged integers using given operator (value context).)r   r   Tr   )negatednot)r   typecomparison_opr$   r   r
   r   check_tagged_short_intaddr   BOOLactivate_blockcall_cunary_opr   gotogoto_and_activate)r%   r&   r'   r(   r*   quickop_typec_func_descnegate_resultswap_opresultshort_int_block	int_blockout	check_lhs	short_lhs	check_rhsargscallcall_resulteqr   r   r   compare_tagged)   s>   





rH   int_eqbuilderrD   list[Value]c                 C     t | |d |d d|S )Nr      r   rH   rJ   rD   r*   r   r   r   lower_int_eqV      rP   int_nec                 C  rL   )Nr   rM   r   rN   rO   r   r   r   lower_int_ne[   rQ   rS   int_ltc                 C  rL   )Nr   rM   r    rN   rO   r   r   r   lower_int_lt`   rQ   rU   int_lec                 C  rL   )Nr   rM   r!   rN   rO   r   r   r   lower_int_lee   rQ   rW   int_gtc                 C  rL   )Nr   rM   r"   rN   rO   r   r   r   lower_int_gtj   rQ   rY   int_gec                 C  rL   )Nr   rM   r#   rN   rO   r   r   r   lower_int_geo   rQ   r[   N)r%   r   r&   r	   r'   r	   r(   r)   r*   r   r+   r	   )rJ   r   rD   rK   r*   r   r+   r	   )(__doc__
__future__r   typingr   mypyc.ir.opsr   r   r   r   r   r	   mypyc.ir.rtypesr
   r   mypyc.irbuild.ll_builderr   mypyc.lower.registryr   mypyc.primitives.int_opsr   r   mypyc.primitives.registryr   r   EQNEQSLTSLESGTSGEr$   r   rH   rP   rS   rU   rW   rY   r[   r   r   r   r   <module>   s<     



-