o
    ik                     @   s   d dl Z d dlZd dlmZ d dlZd dlmZmZ d dl	m
Z
mZ d dlmZ dZer8d dlmZ edd	 ee  d
kdG dd deZedkrTe  dS dS )    N)types)override_env_configTestCase)compile_isolatedFlags)FastMathOptionsF)binding z--debug-only=loop-vectorizex86_64zx86_64 only testc                   @   sB   e Zd ZdZdddZdd Zejddid	d
d Zdd Z	dS )TestVectorizationzP
    Tests to assert that code which should vectorize does indeed vectorize
    Fc              	   C   s   t dd< t dd& t }t||_d|_t|||d}|j W  d    W  d    S 1 s4w   Y  W d    d S 1 sDw   Y  d S )NZNUMBA_CPU_NAMEzskylake-avx512ZNUMBA_CPU_FEATURESr	   T)flags)r   r   r   fastmathZnrtr   libraryZget_llvm_str)selffuncZ
args_tupler   _flagsZjitted r   m/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/numba/tests/test_vectorization.pygen_ir   s   
RzTestVectorization.gen_irc                 C   sB   dd }| j |tjd d d fdd}| d| | d| d S )Nc                 S   s$   d}t | D ]}|| 7 }q|S )Nr   )npZnditeritem)xaccvr   r   r   do_sum!   s   z2TestVectorization.test_nditer_loop.<locals>.do_sum   Tr   vector.bodyllvm.loop.isvectorized)r   r   float64assertIn)r   r   llvm_irr   r   r   test_nditer_loop   s   z"TestVectorization.test_nditer_loopZNUMBA_SLP_VECTORIZE1)envvarsc                 C   sD   dd }t j}| j||fd |d d d f dd}| d| d S )Nc                 S   sD   | | |  |d< |||  |d< | | |  |d< |||  |d< d S )Nr   r         r   )Za1Za2b1b2Ar   r   r   foo2   s   z'TestVectorization.test_slp.<locals>.foo   r   Tr   z
2 x double)r   r   r   r    )r   r*   tyr!   r   r   r   test_slp-   s   &zTestVectorization.test_slpc                 C   s>   dd }| j |ttjfdd}| d| | d| d S )Nc                 S   s    d}| D ]	}|t |7 }q|S )Ng        )r   sqrt)lstr   r   r   r   r   sum_sqrt_listC   s   z@TestVectorization.test_instcombine_effect.<locals>.sum_sqrt_listTr   r   r   )r   r   ZListTyper   r    )r   r0   r!   r   r   r   test_instcombine_effect<   s   z)TestVectorization.test_instcombine_effectN)F)
__name__
__module____qualname____doc__r   r"   r   Zrun_test_in_subprocessr-   r1   r   r   r   r   r      s    


r   __main__)platformnumpyr   Znumbar   ZunittestZnumba.tests.supportr   r   Znumba.core.compilerr   r   Znumba.core.cpu_optionsr   _DEBUGZllvmliter   llvmZ
set_optionZskipIfmachiner   r2   mainr   r   r   r   <module>   s     >