<s> from __future__ import print_function , division , absolute_import <EOL> from llvmlite . llvmpy . core import Module , Type , Builder , InlineAsm <EOL> from llvmlite import binding as ll <EOL> from numba . cuda . cudadrv import nvvm <EOL> from numba . cuda . testing import unittest , CUDATestCase <EOL> from numba . cuda . testing import skip_on_cudasim <EOL> @ skip_on_cudasim ( '<STR_LIT>' ) <EOL> class TestCudaInlineAsm ( CUDATestCase ) : <EOL> def test_inline_rsqrt ( self ) : <EOL> mod = Module ( __name__ ) <EOL> fnty = Type . function ( Type . void ( ) , [ Type . pointer ( Type . float ( ) ) ] ) <EOL> fn = mod . add_function ( fnty , '<STR_LIT>' ) <EOL> bldr = Builder ( fn . append_basic_block ( '<STR_LIT>' ) ) <EOL> rsqrt_approx_fnty = Type . function ( Type . float ( ) , [ Type . float ( ) ] ) <EOL> inlineasm = InlineAsm . get ( rsqrt_approx_fnty , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , side_effect = True ) <EOL> val = bldr . load ( fn . args [ <NUM_LIT:0> ] ) <EOL> res = bldr . call ( inlineasm , [ val ] ) <EOL> bldr . store ( res , fn . args [ <NUM_LIT:0> ] ) <EOL> bldr . ret_void ( ) <EOL> nvvm . fix_data_layout ( mod ) <EOL> nvvm . set_cuda_kernel ( fn ) <EOL> nvvmir = str ( mod ) <EOL> ptx = nvvm . llvm_to_ptx ( nvvmir ) <EOL> self . assertTrue ( '<STR_LIT>' in str ( ptx ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
