<s> if ( argc == <NUM_LIT> ) return NULL ; return argv [ argc - <NUM_LIT> ] ;


<s> inline bool vgpr_1reg_mode_p ( machine_mode mode ) { if ( VECTOR_MODE_P ( mode ) ) mode = GET_MODE_INNER ( mode ) ;

return ( mode == SImode || mode == SFmode || mode == HImode || mode == HFmode || mode == QImode || mode == BImode ) ;


<s> inline bool vgpr_vector_mode_p ( machine_mode mode ) {


<s> inline bool sgpr_1reg_mode_p ( machine_mode mode ) {

return ( mode == SImode || mode == SFmode || mode == HImode || mode == QImode || mode == BImode ) ;


<s> return ( mode == SImode || mode == SFmode || mode == HImode || mode == QImode || mode == BImode ) ;


<s> return ( mode == SImode || mode == SFmode || mode == HImode || mode == QImode || mode == V64QImode || mode == V64HImode || mode == V64SImode || mode == V64HFmode || mode == V64SFmode || mode == BImode ) ;


<s> inline bool vgpr_2reg_mode_p ( machine_mode mode ) { return ( mode == DImode || mode == DFmode || mode == V64DImode || mode == V64DFmode ) ;


<s> inline bool vgpr_vector_mode_p ( machine_mode mode ) { return ( mode == V64QImode || mode == V64HImode || mode == V64SImode || mode == V64DImode || mode == V64HFmode || mode == V64SFmode || mode == V64DFmode ) ;


return ( mode == V64QImode || mode == V64HImode || mode == V64SImode || mode == V64DImode || mode == V64HFmode || mode == V64SFmode || mode == V64DFmode ) ;


<s> struct argdata { int64_t argv_data [ kernel_argc ] ; char strings [ args_size ] ; } * args = device_malloc ( sizeof ( struct argdata ) , kernargs_region ) ; size_t heap_size = <NUM_LIT> * <NUM_LIT> * <NUM_LIT> ; struct heap * heap = device_malloc ( heap_size , heap_region ) ; XHSA ( hsa_fns . hsa_memory_assign_agent_fn ( heap , device , HSA_ACCESS_PERMISSION_RW ) , <STR_LIT> ) ; void * stack = device_malloc ( stack_size , heap_region ) ; kernargs -> args . argc = kernel_argc ; kernargs -> args . argv = ( int64_t ) args -> argv_data ; kernargs -> abi . out_ptr = ( int64_t ) & kernargs -> output_data ; kernargs -> output_data . return_value = <NUM_LIT> ; kernargs -> output_data . next_output = <NUM_LIT> ; for ( unsigned i = <NUM_LIT> ; i < ( sizeof ( kernargs -> output_data . queue ) / sizeof ( kernargs -> output_data . queue [ <NUM_LIT> ] ) ) ; i ++ ) kernargs -> output_data . queue [ i ] . written = <NUM_LIT> ; kernargs -> output_data . consumed = <NUM_LIT> ; int offset = <NUM_LIT> ; for ( int i = <NUM_LIT> ; i < kernel_argc ; i ++ ) { size_t arg_len = strlen ( kernel_argv [ i ] ) + <NUM_LIT> ; args -> argv_data [ i ] = ( int64_t ) & args -> strings [ offset ] ; memcpy ( & args -> strings [ offset ] , kernel_argv [ i ] , arg_len + <NUM_LIT> ) ; offset += arg_len ; } kernargs -> abi . heap_ptr = ( int64_t ) heap ; hsa_fns . hsa_memory_copy_fn ( & heap -> size , & heap_size , sizeof ( heap_size ) ) ; kernargs -> abi . arena_ptr = <NUM_LIT> ; kernargs -> abi . stack_ptr = ( int64_t ) stack ; kernargs -> abi . stack_size_per_thread = stack_size ; run ( init_array_kernel , kernargs ) ; run ( main_kernel , kernargs ) ; unsigned int return_value = ( unsigned int ) kernargs -> output_data . return_value ; run ( fini_array_kernel , kernargs ) ; unsigned int upper = ( return_value & ~ <NUM_LIT> ) >> <NUM_LIT> ; if ( upper == <NUM_LIT> ) { printf ( <STR_LIT> ) ; return_value = <NUM_LIT> ; } else if ( upper == <NUM_LIT> ) ; else if ( upper == <NUM_LIT> ) ;

else printf ( <STR_LIT> <STR_LIT> , return_value ) ;


<s> static void * device_malloc ( size_t size ) { void * result ; XHSA ( hsa_fns . hsa_memory_allocate_fn ( kernargs_region , size , & result ) , <STR_LIT> ) ; return result ;


<s> XHSA ( hsa_fns . hsa_memory_allocate_fn ( kernargs_region , size , & result ) , <STR_LIT> ) ; return result ;


<s> hsa_fns . hsa_region_get_info_fn ( region , HSA_REGION_INFO_SEGMENT , & segment ) ; if ( HSA_REGION_SEGMENT_GLOBAL != segment ) return HSA_STATUS_SUCCESS ; hsa_region_global_flag_t flags ; hsa_fns . hsa_region_get_info_fn ( region , HSA_REGION_INFO_GLOBAL_FLAGS , & flags ) ; if ( flags & HSA_REGION_GLOBAL_FLAG_KERNARG ) { kernargs_region = region ; return HSA_STATUS_INFO_BREAK ;


<s> if ( HSA_REGION_SEGMENT_GLOBAL != segment ) return HSA_STATUS_SUCCESS ; hsa_region_global_flag_t flags ; hsa_fns . hsa_region_get_info_fn ( region , HSA_REGION_INFO_GLOBAL_FLAGS , & flags ) ;

if ( flags & HSA_REGION_GLOBAL_FLAG_KERNARG ) {


<s> XHSA ( hsa_fns . hsa_queue_create_fn ( device , queue_size , HSA_QUEUE_TYPE_SINGLE , NULL , NULL , UINT32_MAX , UINT32_MAX , & queue ) , <STR_LIT> ) ;

XHSA_CMP ( hsa_fns . hsa_agent_iterate_regions_fn ( device , get_kernarg_region , NULL ) , status == HSA_STATUS_SUCCESS || status == HSA_STATUS_INFO_BREAK , <STR_LIT> ) ;


<s> XHSA ( hsa_fns . hsa_agent_get_info_fn ( device , HSA_AGENT_INFO_QUEUE_MAX_SIZE , & queue_size ) , <STR_LIT> ) ; XHSA ( hsa_fns . hsa_queue_create_fn ( device , queue_size , HSA_QUEUE_TYPE_SINGLE , NULL , NULL , UINT32_MAX , UINT32_MAX , & queue ) , <STR_LIT> ) ; XHSA_CMP ( hsa_fns . hsa_agent_iterate_regions_fn ( device , get_kernarg_region , NULL ) , status == HSA_STATUS_SUCCESS || status == HSA_STATUS_INFO_BREAK , <STR_LIT> ) ;


<s> for ( int i = <NUM_LIT> ; i < image -> e_shnum ; i ++ ) if ( sections [ i ] . sh_type == SHT_DYNSYM ) { dynsym = & sections [ i ] ; break ; } for ( int i = <NUM_LIT> ; i < image -> e_shnum ; i ++ ) { if ( sections [ i ] . sh_type == SHT_RELA ) for ( size_t offset = <NUM_LIT> ; offset < sections [ i ] . sh_size ; offset += sections [ i ] . sh_entsize ) { Elf64_Rela * reloc = ( Elf64_Rela * ) ( ( char * ) image + sections [ i ] . sh_offset + offset ) ; Elf64_Sym * sym = ( dynsym ? ( Elf64_Sym * ) ( ( char * ) image + dynsym -> sh_offset + ( dynsym -> sh_entsize * ELF64_R_SYM ( reloc -> r_info ) ) ) : NULL ) ; int64_t S = ( sym ? sym -> st_value : <NUM_LIT> ) ; int64_t P = reloc -> r_offset + load_offset ; int64_t A = reloc -> r_addend ; int64_t B = load_offset ; int64_t V , size ; switch ( ELF64_R_TYPE ( reloc -> r_info ) ) { case R_AMDGPU_ABS32_LO : V = ( S + A ) & <NUM_LIT> ; size = <NUM_LIT> ; break ; case R_AMDGPU_ABS32_HI : V = ( S + A ) >> <NUM_LIT> ; size = <NUM_LIT> ; break ; case R_AMDGPU_ABS64 : V = S + A ; size = <NUM_LIT> ; break ; case R_AMDGPU_REL32 : V = S + A - P ; size = <NUM_LIT> ; break ; case R_AMDGPU_REL64 : V = S + A ; size = <NUM_LIT> ; break ; case R_AMDGPU_ABS32 : V = S + A ; size = <NUM_LIT> ; break ; case R_AMDGPU_REL32_LO : V = ( S + A - P ) & <NUM_LIT> ; size = <NUM_LIT> ; break ; case R_AMDGPU_REL32_HI : V = ( S + A - P ) >> <NUM_LIT> ; size = <NUM_LIT> ; break ; case R_AMDGPU_RELATIVE64 : V = B + A ; size = <NUM_LIT> ; break ; default : fprintf ( stderr , <STR_LIT> ) ; exit ( <NUM_LIT> ) ; } XHSA ( hsa_fns . hsa_memory_copy_fn ( ( void * ) P , & V , size ) , <STR_LIT> ) ;


<s> kernargs -> out_ptr = ( int64_t ) & kernargs -> output_data ; kernargs -> output_data . return_value = <NUM_LIT> ; kernargs -> output_data . next_output = <NUM_LIT> ; for ( unsigned i = <NUM_LIT> ; i < ( sizeof ( kernargs -> output_data . queue ) / sizeof ( kernargs -> output_data . queue [ <NUM_LIT> ] ) ) ; i ++ ) kernargs -> output_data . queue [ i ] . written = <NUM_LIT> ; kernargs -> output_data . consumed = <NUM_LIT> ; int offset = <NUM_LIT> ; for ( int i = <NUM_LIT> ; i < kernel_argc ; i ++ ) { size_t arg_len = strlen ( kernel_argv [ i ] ) + <NUM_LIT> ; args -> argv_data [ i ] = ( int64_t ) & args -> strings [ offset ] ; memcpy ( & args -> strings [ offset ] , kernel_argv [ i ] , arg_len + <NUM_LIT> ) ; offset += arg_len ; } kernargs -> heap_ptr = ( int64_t ) & kernargs -> heap ; kernargs -> heap . size = heap_size ; run ( kernargs ) ; unsigned int return_value = ( unsigned int ) kernargs -> output_data . return_value ; unsigned int upper = ( return_value & ~ <NUM_LIT> ) >> <NUM_LIT> ; if ( upper == <NUM_LIT> ) printf ( <STR_LIT> ) ; else if ( upper == <NUM_LIT> ) ; else if ( upper == <NUM_LIT> ) ; else printf ( <STR_LIT> <STR_LIT> , return_value ) ; if ( upper == <NUM_LIT> ) { unsigned int signal = ( return_value >> <NUM_LIT> ) & <NUM_LIT> ; if ( signal == SIGABRT ) printf ( <STR_LIT> ) ; else if ( signal != <NUM_LIT> ) printf ( <STR_LIT> ) ;


<s> header |= HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE ; header |= HSA_PACKET_TYPE_KERNEL_DISPATCH << HSA_PACKET_HEADER_TYPE ; __atomic_store_n ( ( uint32_t * ) dispatch_packet , header | ( dispatch_packet -> setup << <NUM_LIT> ) , __ATOMIC_RELEASE ) ; if ( debug ) fprintf ( stderr , <STR_LIT> ) ; hsa_fns . hsa_queue_store_write_index_relaxed_fn ( queue , index + <NUM_LIT> ) ; hsa_fns . hsa_signal_store_relaxed_fn ( queue -> doorbell_signal , index ) ; while ( hsa_fns . hsa_signal_wait_relaxed_fn ( signal , HSA_SIGNAL_CONDITION_LT , <NUM_LIT> , <NUM_LIT> , HSA_WAIT_STATE_ACTIVE ) != <NUM_LIT> ) {


<s> void * result ; XHSA ( hsa_fns . hsa_memory_allocate_fn ( region , size , & result ) , <STR_LIT> ) ;


<s> static void * device_malloc ( size_t size , hsa_region_t region ) { void * result ; XHSA ( hsa_fns . hsa_memory_allocate_fn ( region , size , & result ) , <STR_LIT> ) ; return result ;


<s> static hsa_status_t get_heap_region ( hsa_region_t region , void * data __attribute__ ( ( unused ) ) ) {

return get_memory_region ( region , & heap_region , HSA_REGION_GLOBAL_FLAG_COARSE_GRAINED ) ;


<s> static hsa_status_t get_kernarg_region ( hsa_region_t region , void * data __attribute__ ( ( unused ) ) ) { return get_memory_region ( region , & kernargs_region , HSA_REGION_GLOBAL_FLAG_KERNARG ) ;


<s> static hsa_status_t get_kernarg_region ( hsa_region_t region , void * data __attribute__ ( ( unused ) ) ) {

return get_memory_region ( region , & kernargs_region , HSA_REGION_GLOBAL_FLAG_KERNARG ) ;


<s> unsigned int limit = ( sizeof ( kernargs -> output_data . queue ) / sizeof ( kernargs -> output_data . queue [ <NUM_LIT> ] ) ) ; unsigned int from = __atomic_load_n ( & kernargs -> output_data . consumed , __ATOMIC_ACQUIRE ) ; unsigned int to = kernargs -> output_data . next_output ; if ( from > to ) { if ( final ) printf ( <STR_LIT> ) ; return ; } unsigned int i ; for ( i = from ; i < to ; i ++ ) { struct printf_data * data = & kernargs -> output_data . queue [ i % limit ] ; if ( ! data -> written && ! final ) break ; switch ( data -> type ) { case <NUM_LIT> : printf ( <STR_LIT> , data -> msg , data -> ivalue ) ; break ; case <NUM_LIT> : printf ( <STR_LIT> , data -> msg , data -> dvalue ) ; break ; case <NUM_LIT> : printf ( <STR_LIT> , data -> msg , data -> text ) ;


<s> if ( final ) printf ( <STR_LIT> ) ; return ; } unsigned int i ; for ( i = from ; i < to ; i ++ ) { struct printf_data * data = & kernargs -> output_data . queue [ i % limit ] ; if ( ! data -> written && ! final ) break ; switch ( data -> type ) { case <NUM_LIT> : printf ( <STR_LIT> , data -> msg , data -> ivalue ) ; break ; case <NUM_LIT> : printf ( <STR_LIT> , data -> msg , data -> dvalue ) ; break ; case <NUM_LIT> :

printf ( <STR_LIT> , data -> msg , data -> text ) ;


<s> static void hsa_fatal ( const char * str , hsa_status_t status ) { const char * hsa_error_msg ; hsa_fns . hsa_status_string_fn ( status , & hsa_error_msg ) ; fprintf ( stderr , <STR_LIT> , str , hsa_error_msg ) ;


<s> const char * hsa_error_msg ; hsa_fns . hsa_status_string_fn ( status , & hsa_error_msg ) ; fprintf ( stderr , <STR_LIT> , str , hsa_error_msg ) ;


<s> init_hsa_runtime_functions ( ) ; XHSA ( hsa_fns . hsa_init_fn ( ) , <STR_LIT> ) ; XHSA_CMP ( hsa_fns . hsa_iterate_agents_fn ( get_gpu_agent , NULL ) , status == HSA_STATUS_SUCCESS || status == HSA_STATUS_INFO_BREAK , <STR_LIT> ) ; uint32_t queue_size = <NUM_LIT> ;

XHSA ( hsa_fns . hsa_agent_get_info_fn ( device , HSA_AGENT_INFO_QUEUE_MAX_SIZE , & queue_size ) , <STR_LIT> ) ;


<s> fprintf ( stderr , <STR_LIT> <STR_LIT> , HSA_RUNTIME_LIB ) ; exit ( <NUM_LIT> ) ; }


fprintf ( stderr , <STR_LIT> HSA_RUNTIME_LIB <STR_LIT> ) ;


<s> } int kernel_argc = argc - kernel_arg ; char * * kernel_argv = & argv [ kernel_arg ] ; init_device ( ) ; load_image ( kernel_argv [ <NUM_LIT> ] ) ; size_t args_size = <NUM_LIT> ; for ( int i = <NUM_LIT> ; i < kernel_argc ; i ++ ) args_size += strlen ( kernel_argv [ i ] ) + <NUM_LIT> ; struct kernargs * kernargs = device_malloc ( sizeof ( * kernargs ) , kernargs_region ) ; struct argdata { int64_t argv_data [ kernel_argc ] ; char strings [ args_size ] ; } * args = device_malloc ( sizeof ( struct argdata ) , kernargs_region ) ; size_t heap_size = <NUM_LIT> * <NUM_LIT> * <NUM_LIT> ; struct heap * heap = device_malloc ( heap_size , heap_region ) ; XHSA ( hsa_fns . hsa_memory_assign_agent_fn ( heap , device , HSA_ACCESS_PERMISSION_RW ) , <STR_LIT> ) ; kernargs -> argc = kernel_argc ; kernargs -> argv = ( int64_t ) args -> argv_data ; kernargs -> out_ptr = ( int64_t ) & kernargs -> output_data ; kernargs -> output_data . return_value = <NUM_LIT> ; kernargs -> output_data . next_output = <NUM_LIT> ; for ( unsigned i = <NUM_LIT> ; i < ( sizeof ( kernargs -> output_data . queue ) / sizeof ( kernargs -> output_data . queue [ <NUM_LIT> ] ) ) ; i ++ ) kernargs -> output_data . queue [ i ] . written = <NUM_LIT> ; kernargs -> output_data . consumed = <NUM_LIT> ; int offset = <NUM_LIT> ; for ( int i = <NUM_LIT> ; i < kernel_argc ; i ++ ) { size_t arg_len = strlen ( kernel_argv [ i ] ) + <NUM_LIT> ; args -> argv_data [ i ] = ( int64_t ) & args -> strings [ offset ] ; memcpy ( & args -> strings [ offset ] , kernel_argv [ i ] , arg_len + <NUM_LIT> ) ; offset += arg_len ; } kernargs -> heap_ptr = ( int64_t ) heap ; hsa_fns . hsa_memory_copy_fn ( & heap -> size , & heap_size , sizeof ( heap_size ) ) ; run ( init_array_kernel , kernargs ) ; run ( main_kernel , kernargs ) ; unsigned int return_value = ( unsigned int ) kernargs -> output_data . return_value ; run ( fini_array_kernel , kernargs ) ; unsigned int upper = ( return_value & ~ <NUM_LIT> ) >> <NUM_LIT> ; if ( upper == <NUM_LIT> ) { printf ( <STR_LIT> ) ;


<s> else if ( ! strcmp ( argv [ i ] , <STR_LIT> ) ) { version ( argv [ <NUM_LIT> ] ) ; return <NUM_LIT> ; } else if ( ! strcmp ( argv [ i ] , <STR_LIT> ) ) debug = true ; else if ( argv [ i ] [ <NUM_LIT> ] == '-' ) { usage ( argv [ <NUM_LIT> ] ) ; return <NUM_LIT> ; } else { kernel_arg = i ; break ; } } if ( ! kernel_arg ) { usage ( argv [ <NUM_LIT> ] ) ; return <NUM_LIT> ; } int kernel_argc = argc - kernel_arg ; char * * kernel_argv = & argv [ kernel_arg ] ; init_device ( ) ; load_image ( kernel_argv [ <NUM_LIT> ] ) ; size_t args_size = <NUM_LIT> ; for ( int i = <NUM_LIT> ; i < kernel_argc ; i ++ ) args_size += strlen ( kernel_argv [ i ] ) + <NUM_LIT> ; struct kernargs * kernargs = device_malloc ( sizeof ( * kernargs ) , kernargs_region ) ; struct argdata { int64_t argv_data [ kernel_argc ] ; char strings [ args_size ] ; } * args = device_malloc ( sizeof ( struct argdata ) , kernargs_region ) ; size_t heap_size = <NUM_LIT> * <NUM_LIT> * <NUM_LIT> ; struct heap * heap = device_malloc ( heap_size , heap_region ) ; XHSA ( hsa_fns . hsa_memory_assign_agent_fn ( heap , device , HSA_ACCESS_PERMISSION_RW ) , <STR_LIT> ) ;


<s> char * buffer ; FILE * stream = fopen ( filename , <STR_LIT> ) ; if ( ! stream ) { perror ( filename ) ; exit ( <NUM_LIT> ) ; } if ( ! fseek ( stream , <NUM_LIT> , SEEK_END ) ) { long s = ftell ( stream ) ; if ( s >= <NUM_LIT> ) alloc = s + <NUM_LIT> ; fseek ( stream , <NUM_LIT> , SEEK_SET ) ; }


<s> size_t alloc = <NUM_LIT> ; size_t base = <NUM_LIT> ; char * buffer ; FILE * stream = fopen ( filename , <STR_LIT> ) ; if ( ! stream ) { perror ( filename ) ; exit ( <NUM_LIT> ) ; } if ( ! fseek ( stream , <NUM_LIT> , SEEK_END ) ) { long s = ftell ( stream ) ; if ( s >= <NUM_LIT> ) alloc = s + <NUM_LIT> ; fseek ( stream , <NUM_LIT> , SEEK_SET ) ; } buffer = malloc ( alloc ) ; for ( ; ; ) { size_t n = fread ( buffer + base , <NUM_LIT> , alloc - base - <NUM_LIT> , stream ) ; if ( ! n ) break ; base += n ; if ( base + <NUM_LIT> == alloc ) {


<s> header |= HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_ACQUIRE_FENCE_SCOPE ; header |= HSA_FENCE_SCOPE_SYSTEM << HSA_PACKET_HEADER_RELEASE_FENCE_SCOPE ; header |= HSA_PACKET_TYPE_KERNEL_DISPATCH << HSA_PACKET_HEADER_TYPE ; __atomic_store_n ( ( uint32_t * ) dispatch_packet , header | ( dispatch_packet -> setup << <NUM_LIT> ) , __ATOMIC_RELEASE ) ; if ( debug ) fprintf ( stderr , <STR_LIT> ) ; hsa_fns . hsa_queue_store_write_index_relaxed_fn ( queue , index + <NUM_LIT> ) ; hsa_fns . hsa_signal_store_relaxed_fn ( queue -> doorbell_signal , index ) ; while ( hsa_fns . hsa_signal_wait_relaxed_fn ( signal , HSA_SIGNAL_CONDITION_LT , <NUM_LIT> , <NUM_LIT> , HSA_WAIT_STATE_ACTIVE ) != <NUM_LIT> ) { usleep ( <NUM_LIT> ) ; gomp_print_output ( kernargs , false ) ;


if ( debug ) fprintf ( stderr , <STR_LIT> ) ;


<s> static void version ( const char * progname ) {

printf ( <STR_LIT> VERSION_STRING <STR_LIT> , progname ) ;


<s> printf ( <STR_LIT> VERSION_STRING <STR_LIT> , progname ) ;


<s> tree var_type = build_qualified_type ( type , ( TYPE_QUALS ( type ) | ENCODE_QUAL_ADDR_SPACE ( ADDR_SPACE_LDS ) ) ) ; if ( machfun -> reduc_decls && offset < machfun -> reduc_decls -> length ( ) && ( existing_decl = ( * machfun -> reduc_decls ) [ offset ] ) ) { gcc_assert ( TREE_TYPE ( existing_decl ) == var_type ) ; return existing_decl ; } else { char name [ <NUM_LIT> ] ; sprintf ( name , <STR_LIT> , offset ) ; tree decl = create_tmp_var_raw ( var_type , name ) ; DECL_CONTEXT ( decl ) = NULL_TREE ; TREE_STATIC ( decl ) = <NUM_LIT> ; varpool_node :: finalize_decl ( decl ) ; vec_safe_grow_cleared ( machfun -> reduc_decls , offset + <NUM_LIT> , true ) ;

( * machfun -> reduc_decls ) [ offset ] = decl ;


<s> char name [ <NUM_LIT> ] ; sprintf ( name , <STR_LIT> , offset ) ; tree decl = create_tmp_var_raw ( var_type , name ) ; DECL_CONTEXT ( decl ) = NULL_TREE ; TREE_STATIC ( decl ) = <NUM_LIT> ; varpool_node :: finalize_decl ( decl ) ; vec_safe_grow_cleared ( machfun -> reduc_decls , offset + <NUM_LIT> , true ) ; ( * machfun -> reduc_decls ) [ offset ] = decl ;


<s> virtual unsigned int execute ( function * ) { return execute_omp_gcn ( ) ;


<s> } else if ( decl_id == team_num_id ) { if ( dump_file && ( dump_flags & TDF_DETAILS ) ) fprintf ( dump_file , <STR_LIT> , IDENTIFIER_POINTER ( decl_id ) ) ; tree fn = targetm . builtin_decl ( GCN_BUILTIN_OMP_DIM_POS , <NUM_LIT> ) ; tree fnarg = build_zero_cst ( unsigned_type_node ) ; gimple * stmt = gimple_build_call ( fn , <NUM_LIT> , fnarg ) ; gimple_call_set_lhs ( stmt , lhs ) ; gsi_replace ( & gsi , stmt , true ) ; todo |= TODO_update_ssa ; } } } return todo ;


<s> virtual bool gate ( function * ) { return flag_openmp ;


<s> if ( ! v ) { tree name = get_identifier ( <STR_LIT> ) ; tree type = build_qualified_type ( unsigned_type_node , TYPE_QUAL_VOLATILE ) ; v = build_decl ( BUILTINS_LOCATION , VAR_DECL , name , type ) ; global_lock_var = v ; DECL_ARTIFICIAL ( v ) = <NUM_LIT> ; DECL_EXTERNAL ( v ) = <NUM_LIT> ; TREE_STATIC ( v ) = <NUM_LIT> ; TREE_PUBLIC ( v ) = <NUM_LIT> ; TREE_USED ( v ) = <NUM_LIT> ; mark_addressable ( v ) ;


<s> void gcn_goacc_adjust_gangprivate_decl ( tree var ) { tree type = TREE_TYPE ( var ) ; tree lds_type = build_qualified_type ( type , TYPE_QUALS_NO_ADDR_SPACE ( type ) | ENCODE_QUAL_ADDR_SPACE ( ADDR_SPACE_LDS ) ) ; machine_function * machfun = cfun -> machine ; TREE_TYPE ( var ) = lds_type ; TREE_STATIC ( var ) = <NUM_LIT> ;


<s> TREE_TYPE ( var ) = lds_type ; TREE_STATIC ( var ) = <NUM_LIT> ; lhd_set_decl_assembler_name ( var ) ; varpool_node :: finalize_decl ( var ) ; if ( machfun ) machfun -> use_flat_addressing = true ;


<s> TYPE_ADDR_SPACE ( type ) = ADDR_SPACE_LDS ; if ( ! sender ) type = build_pointer_type ( type ) ; tree decl = create_tmp_var_raw ( type , name ) ; if ( sender ) { DECL_CONTEXT ( decl ) = NULL_TREE ; TREE_STATIC ( decl ) = <NUM_LIT> ; } if ( sender ) varpool_node :: finalize_decl ( decl ) ; return decl ;


<s> tree gcn_goacc_adjust_propagation_record ( tree record_type , bool sender , const char * name ) { tree type = record_type ; TYPE_ADDR_SPACE ( type ) = ADDR_SPACE_LDS ;

if ( ! sender ) type = build_pointer_type ( type ) ;


if ( record_type == char_type_node ) offset = <NUM_LIT> ;


<s> if ( TREE_CODE ( type ) == REFERENCE_TYPE ) type = TREE_TYPE ( type ) ; tree var_type = build_qualified_type ( type , ( TYPE_QUALS ( type ) | ENCODE_QUAL_ADDR_SPACE ( ADDR_SPACE_LDS ) ) ) ; gcc_assert ( offset < ( machfun -> reduction_limit - machfun -> reduction_base ) ) ; tree ptr_type = build_pointer_type ( var_type ) ; tree addr = build_int_cst ( ptr_type , machfun -> reduction_base + offset ) ; return build_simple_mem_ref ( addr ) ;


<s> gimple_stmt_iterator gsi = gsi_for_stmt ( call ) ; tree lhs = gimple_call_lhs ( call ) ; tree ref_to_res = gimple_call_arg ( call , <NUM_LIT> ) ; tree var = gimple_call_arg ( call , <NUM_LIT> ) ; int level = TREE_INT_CST_LOW ( gimple_call_arg ( call , <NUM_LIT> ) ) ; enum tree_code op = ( enum tree_code ) TREE_INT_CST_LOW ( gimple_call_arg ( call , <NUM_LIT> ) ) ; gimple_seq seq = NULL ; tree r = NULL_TREE ; ; push_gimplify_context ( true ) ; tree accum = NULL_TREE ; if ( level == GOMP_DIM_WORKER ) { tree var_type = TREE_TYPE ( var ) ; tree offset = gimple_call_arg ( call , <NUM_LIT> ) ; tree decl = gcn_goacc_get_worker_red_decl ( var_type , TREE_INT_CST_LOW ( offset ) ) ; accum = build_fold_addr_expr ( decl ) ; } else if ( integer_zerop ( ref_to_res ) ) r = var ;


<s> static void gcn_goacc_reduction_init ( gcall * call ) { gimple_stmt_iterator gsi = gsi_for_stmt ( call ) ; tree lhs = gimple_call_lhs ( call ) ; tree var = gimple_call_arg ( call , <NUM_LIT> ) ; int level = TREE_INT_CST_LOW ( gimple_call_arg ( call , <NUM_LIT> ) ) ; enum tree_code rcode = ( enum tree_code ) TREE_INT_CST_LOW ( gimple_call_arg ( call , <NUM_LIT> ) ) ; tree init = omp_reduction_init_op ( gimple_location ( call ) , rcode , TREE_TYPE ( var ) ) ; gimple_seq seq = NULL ; push_gimplify_context ( true ) ; if ( level == GOMP_DIM_GANG ) { tree ref_to_res = gimple_call_arg ( call , <NUM_LIT> ) ;

if ( integer_zerop ( ref_to_res ) ) init = var ;


<s> gimple_seq seq = NULL ; push_gimplify_context ( true ) ; if ( level == GOMP_DIM_GANG ) { tree ref_to_res = gimple_call_arg ( call , <NUM_LIT> ) ; if ( integer_zerop ( ref_to_res ) ) init = var ; } if ( lhs ) gimplify_assign ( lhs , init , & seq ) ;


<s> if ( ! integer_zerop ( ref_to_res ) ) var = build_simple_mem_ref ( ref_to_res ) ; } if ( level == GOMP_DIM_WORKER ) { tree var_type = TREE_TYPE ( var ) ; tree offset = gimple_call_arg ( call , <NUM_LIT> ) ; tree decl = gcn_goacc_get_worker_red_decl ( var_type , TREE_INT_CST_LOW ( offset ) ) ;

gimplify_assign ( decl , var , & seq ) ;


<s> } if ( level != GOMP_DIM_GANG ) { tree ref_to_res = gimple_call_arg ( call , <NUM_LIT> ) ; if ( ! integer_zerop ( ref_to_res ) ) gimplify_assign ( build_simple_mem_ref ( ref_to_res ) , var , & seq ) ; } if ( lhs ) gimplify_assign ( lhs , unshare_expr ( var ) , & seq ) ; pop_gimplify_context ( NULL ) ; gsi_replace_with_seq ( & gsi , seq , true ) ;


<s> var = decl ; } if ( level != GOMP_DIM_GANG ) { tree ref_to_res = gimple_call_arg ( call , <NUM_LIT> ) ; if ( ! integer_zerop ( ref_to_res ) ) gimplify_assign ( build_simple_mem_ref ( ref_to_res ) , var , & seq ) ; }

if ( lhs ) gimplify_assign ( lhs , unshare_expr ( var ) , & seq ) ;


<s> static tree gcn_reduction_update ( location_t loc , gimple_stmt_iterator * gsi , tree ptr , tree var , tree_code op ) {


<s> pass_omp_gcn ( gcc :: context * ctxt ) : gimple_opt_pass ( pass_data_omp_gcn , ctxt ) {