<s> case 'N' : loongarch_print_int_branch_condition ( file , reverse_condition ( code ) , letter ) ; break ; case 'F' : loongarch_print_float_branch_condition ( file , code , letter ) ; break ; case 'W' : loongarch_print_float_branch_condition ( file , reverse_condition ( code ) , letter ) ; break ; case 'T' : case 't' : { int truth = ( code == NE ) == ( letter == 'T' ) ; fputc ( <STR_LIT> [ truth * <NUM_LIT> + FCC_REG_P ( REGNO ( XEXP ( op , <NUM_LIT> ) ) ) ] , file ) ; } break ; case 'Y' : if ( code == CONST_INT && UINTVAL ( op ) < ARRAY_SIZE ( loongarch_fp_conditions ) ) fputs ( loongarch_fp_conditions [ UINTVAL ( op ) ] , file ) ; else output_operand_lossage ( <STR_LIT> , letter ) ; break ; case 'Z' : loongarch_print_operand ( file , op , <NUM_LIT> ) ; fputc ( ',' , file ) ; break ; case 'A' : if ( loongarch_memmodel_needs_rel_acq_fence ( ( enum memmodel ) INTVAL ( op ) ) ) fputs ( <STR_LIT> , file ) ; break ; case 'G' : if ( loongarch_memmodel_needs_release_fence ( ( enum memmodel ) INTVAL ( op ) ) ) fputs ( <STR_LIT> , file ) ; break ; case 'i' : if ( code != REG ) fputs ( <STR_LIT> , file ) ; break ; default : switch ( code ) { case REG : { unsigned int regno = REGNO ( op ) ; if ( letter && letter != 'z' ) output_operand_lossage ( <STR_LIT> , letter ) ; fprintf ( file , <STR_LIT> , reg_names [ regno ] ) ; } break ; case MEM : if ( letter == 'D' ) output_address ( GET_MODE ( op ) , plus_constant ( Pmode , XEXP ( op , <NUM_LIT> ) , <NUM_LIT> ) ) ; else if ( letter == 'b' ) { gcc_assert ( REG_P ( XEXP ( op , <NUM_LIT> ) ) ) ; loongarch_print_operand ( file , XEXP ( op , <NUM_LIT> ) , <NUM_LIT> ) ; } else if ( letter && letter != 'z' ) output_operand_lossage ( <STR_LIT> , letter ) ; else output_address ( GET_MODE ( op ) , XEXP ( op , <NUM_LIT> ) ) ; break ; default :

if ( letter == 'z' && op == CONST0_RTX ( GET_MODE ( op ) ) ) fputs ( reg_names [ GP_REG_FIRST ] , file ) ;


<s> struct loongarch_address_info addr ; if ( loongarch_classify_address ( & addr , x , word_mode , true ) ) switch ( addr . type ) { case ADDRESS_REG : fprintf ( file , <STR_LIT> , reg_names [ REGNO ( addr . reg ) ] ) ; loongarch_print_operand ( file , addr . offset , <NUM_LIT> ) ; return ; case ADDRESS_REG_REG : fprintf ( file , <STR_LIT> , reg_names [ REGNO ( addr . reg ) ] , reg_names [ REGNO ( addr . offset ) ] ) ; return ; case ADDRESS_CONST_INT : fprintf ( file , <STR_LIT> , reg_names [ GP_REG_FIRST ] ) ;


<s> fprintf ( file , <STR_LIT> , reg_names [ GP_REG_FIRST ] ) ; output_addr_const ( file , x ) ; return ; case ADDRESS_SYMBOLIC : output_addr_const ( file , loongarch_strip_unspec_address ( x ) ) ; return ; } if ( CONST_INT_P ( x ) ) output_addr_const ( file , x ) ; else gcc_unreachable ( ) ;


<s> case '.' : fputs ( reg_names [ GP_REG_FIRST + <NUM_LIT> ] , file ) ; break ; case '$' : fputs ( reg_names [ STACK_POINTER_REGNUM ] , file ) ; break ; default : gcc_unreachable ( ) ;


<s> return loongarch_print_operand_punct [ code ] ;


<s> int unsignedp ; if ( type != NULL_TREE ) return promote_mode ( type , mode , punsignedp ) ;


<s> int loongarch_regno_mode_ok_for_base_p ( int regno , machine_mode mode ATTRIBUTE_UNUSED , bool strict_p ) { if ( ! HARD_REGISTER_NUM_P ( regno ) ) { if ( ! strict_p ) return true ; regno = reg_renumber [ regno ] ; }

if ( regno == ARG_POINTER_REGNUM || regno == FRAME_POINTER_REGNUM ) return true ;


<s> if ( ! HARD_REGISTER_NUM_P ( regno ) ) { if ( ! strict_p ) return true ; regno = reg_renumber [ regno ] ; } if ( regno == ARG_POINTER_REGNUM || regno == FRAME_POINTER_REGNUM ) return true ; return GP_REG_P ( regno ) ;


dwarf = alloc_reg_note ( REG_CFA_RESTORE , reg , dwarf ) ;


<s> static bool loongarch_return_in_memory ( const_tree type , const_tree fndecl ATTRIBUTE_UNUSED ) { CUMULATIVE_ARGS args ; cumulative_args_t cum = pack_cumulative_args ( & args ) ; memset ( & args , <NUM_LIT> , sizeof ( args ) ) ; function_arg_info arg ( const_cast < tree > ( type ) , true ) ;

return loongarch_pass_by_reference ( cum , arg ) ;


<s> pattern = copy_insn ( pattern ) ; loongarch_rewrite_small_data_1 ( & pattern ) ; return pattern ;


<s> rtx * loc = * iter ; if ( MEM_P ( * loc ) ) { loongarch_rewrite_small_data_1 ( & XEXP ( * loc , <NUM_LIT> ) ) ;


<s> return ( GET_MODE_SIZE ( mode ) <= g_switch_value ) ;


<s> return true ; } case SQRT : case MOD : if ( float_mode_p ) { * total = loongarch_fp_div_cost ( mode ) ; return false ; } case UDIV : case UMOD : if ( ! speed ) { * total = COSTS_N_INSNS ( loongarch_idiv_insns ( mode ) ) ; } else if ( mode == DImode ) * total = loongarch_cost -> int_div_di ; else * total = loongarch_cost -> int_div_si ; return false ; case SIGN_EXTEND : * total = loongarch_sign_extend_cost ( XEXP ( x , <NUM_LIT> ) ) ; return false ; case ZERO_EXTEND : * total = loongarch_zero_extend_cost ( XEXP ( x , <NUM_LIT> ) ) ; return false ; case TRUNCATE : if ( ( GET_CODE ( XEXP ( x , <NUM_LIT> ) ) == ASHIFTRT || GET_CODE ( XEXP ( x , <NUM_LIT> ) ) == LSHIFTRT ) && CONST_INT_P ( XEXP ( XEXP ( x , <NUM_LIT> ) , <NUM_LIT> ) ) && ( ( INTVAL ( XEXP ( XEXP ( x , <NUM_LIT> ) , <NUM_LIT> ) ) == <NUM_LIT> && GET_MODE ( XEXP ( x , <NUM_LIT> ) ) == DImode ) || ( TARGET_64BIT && INTVAL ( XEXP ( XEXP ( x , <NUM_LIT> ) , <NUM_LIT> ) ) == <NUM_LIT> && GET_MODE ( XEXP ( x , <NUM_LIT> ) ) == TImode ) ) && GET_CODE ( XEXP ( XEXP ( x , <NUM_LIT> ) , <NUM_LIT> ) ) == MULT && ( ( GET_CODE ( XEXP ( XEXP ( XEXP ( x , <NUM_LIT> ) , <NUM_LIT> ) , <NUM_LIT> ) ) == SIGN_EXTEND && GET_CODE ( XEXP ( XEXP ( XEXP ( x , <NUM_LIT> ) , <NUM_LIT> ) , <NUM_LIT> ) ) == SIGN_EXTEND ) || ( GET_CODE ( XEXP ( XEXP ( XEXP ( x , <NUM_LIT> ) , <NUM_LIT> ) , <NUM_LIT> ) ) == ZERO_EXTEND && ( GET_CODE ( XEXP ( XEXP ( XEXP ( x , <NUM_LIT> ) , <NUM_LIT> ) , <NUM_LIT> ) ) == ZERO_EXTEND ) ) ) ) { if ( ! speed ) * total = COSTS_N_INSNS ( <NUM_LIT> ) + <NUM_LIT> ; else if ( mode == DImode ) * total = loongarch_cost -> int_mult_di ; else * total = loongarch_cost -> int_mult_si ; for ( int i = <NUM_LIT> ; i < <NUM_LIT> ; ++ i ) { rtx op = XEXP ( XEXP ( XEXP ( x , <NUM_LIT> ) , <NUM_LIT> ) , i ) ; if ( TARGET_64BIT && GET_CODE ( op ) == ZERO_EXTEND && GET_MODE ( op ) == DImode ) * total += rtx_cost ( op , DImode , MULT , i , speed ) ; else * total += rtx_cost ( XEXP ( op , <NUM_LIT> ) , VOIDmode , GET_CODE ( op ) , <NUM_LIT> , speed ) ; } return true ; } return false ; case FLOAT : case UNSIGNED_FLOAT : case FIX : case FLOAT_EXTEND : case FLOAT_TRUNCATE : * total = loongarch_cost -> fp_add ; return false ;


<s> static unsigned loongarch_save_libcall_count ( unsigned mask ) {

for ( unsigned n = GP_REG_LAST ; n > GP_REG_FIRST ; n -- ) if ( BITSET_P ( mask , n ) ) return CALLEE_SAVED_REG_NUMBER ( n ) + <NUM_LIT> ;


<s> for ( unsigned n = GP_REG_LAST ; n > GP_REG_FIRST ; n -- ) if ( BITSET_P ( mask , n ) ) return CALLEE_SAVED_REG_NUMBER ( n ) + <NUM_LIT> ; abort ( ) ;


loongarch_set_frame_expr ( loongarch_frame_set ( mem , reg ) ) ;


<s> loongarch_set_frame_expr ( loongarch_frame_set ( mem , reg ) ) ;


<s> bool might_clobber = crtl -> saves_all_registers || df_regs_ever_live_p ( regno ) ; if ( call_saved && might_clobber ) return true ; if ( regno == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed ) return true ; if ( regno == RETURN_ADDR_REGNUM && crtl -> calls_eh_return ) return true ; return false ;


<s> static bool loongarch_scalar_mode_supported_p ( scalar_mode mode ) { if ( ALL_FIXED_POINT_MODE_P ( mode ) && GET_MODE_PRECISION ( mode ) <= <NUM_LIT> * BITS_PER_WORD ) return true ;

return default_scalar_mode_supported_p ( mode ) ;


<s> int regno ; regno = true_regnum ( x ) ; if ( reg_class_subset_p ( rclass , FP_REGS ) ) { if ( regno < <NUM_LIT> || ( MEM_P ( x ) && ( GET_MODE_SIZE ( mode ) == <NUM_LIT> || GET_MODE_SIZE ( mode ) == <NUM_LIT> ) ) ) return NO_REGS ; if ( GP_REG_P ( regno ) || x == CONST0_RTX ( mode ) ) return NO_REGS ; if ( CONSTANT_P ( x ) && ! targetm . cannot_force_const_mem ( mode , x ) ) return NO_REGS ; if ( FP_REG_P ( regno ) && loongarch_mode_ok_for_mov_fmt_p ( mode ) ) return NO_REGS ;


<s> static section * loongarch_select_rtx_section ( machine_mode mode , rtx x , unsigned HOST_WIDE_INT align ) { if ( loongarch_rtx_constant_in_small_data_p ( mode ) ) return get_named_section ( NULL , <STR_LIT> , <NUM_LIT> ) ;

return default_elf_select_rtx_section ( mode , x , align ) ;


<s> if ( loongarch_rtx_constant_in_small_data_p ( mode ) ) return get_named_section ( NULL , <STR_LIT> , <NUM_LIT> ) ;


<s> loongarch_function_arg_advance ( pack_cumulative_args ( & local_cum ) , arg ) ; gp_saved = MAX_ARGS_IN_REGISTERS - local_cum . num_gprs ; if ( ! no_rtl && gp_saved > <NUM_LIT> ) { rtx ptr = plus_constant ( Pmode , virtual_incoming_args_rtx , REG_PARM_STACK_SPACE ( cfun -> decl ) - gp_saved * UNITS_PER_WORD ) ; rtx mem = gen_frame_mem ( BLKmode , ptr ) ; set_mem_alias_set ( mem , get_varargs_alias_set ( ) ) ; move_block_from_reg ( local_cum . num_gprs + GP_ARG_FIRST , mem , gp_saved ) ; } if ( REG_PARM_STACK_SPACE ( cfun -> decl ) == <NUM_LIT> ) cfun -> machine -> varargs_size = gp_saved * UNITS_PER_WORD ;


<s> rtx insn ; insn = get_last_insn ( ) ; RTX_FRAME_RELATED_P ( insn ) = <NUM_LIT> ;

REG_NOTES ( insn ) = alloc_EXPR_LIST ( REG_FRAME_RELATED_EXPR , frame_pattern , REG_NOTES ( insn ) ) ;


<s> case MODE_VECTOR_FLOAT : if ( TARGET_HARD_FLOAT ) return loongarch_set_reg_reg_piece_cost ( mode , UNITS_PER_HWFPVALUE ) ; default : return loongarch_set_reg_reg_piece_cost ( mode , UNITS_PER_WORD ) ; }


<s> return loongarch_set_reg_reg_piece_cost ( mode , GET_MODE_SIZE ( CCmode ) ) ; case MODE_FLOAT : case MODE_COMPLEX_FLOAT : case MODE_VECTOR_FLOAT : if ( TARGET_HARD_FLOAT ) return loongarch_set_reg_reg_piece_cost ( mode , UNITS_PER_HWFPVALUE ) ; default : return loongarch_set_reg_reg_piece_cost ( mode , UNITS_PER_WORD ) ; }


<s> static int loongarch_set_reg_reg_piece_cost ( machine_mode mode , unsigned int units ) {

return COSTS_N_INSNS ( ( GET_MODE_SIZE ( mode ) + units - <NUM_LIT> ) / units ) ;


<s> else slot_address = loongarch_add_offset ( scratch , stack_pointer_rtx , cfun -> machine -> frame . gp_sp_offset ) ; loongarch_emit_move ( gen_frame_mem ( GET_MODE ( address ) , slot_address ) , address ) ;


<s> if ( frame_pointer_needed ) slot_address = loongarch_add_offset ( scratch , hard_frame_pointer_rtx , - UNITS_PER_WORD ) ; else slot_address = loongarch_add_offset ( scratch , stack_pointer_rtx , cfun -> machine -> frame . gp_sp_offset ) ; loongarch_emit_move ( gen_frame_mem ( GET_MODE ( address ) , slot_address ) , address ) ;


<s> bool loongarch_signed_immediate_p ( unsigned HOST_WIDE_INT x , int bits , int shift = <NUM_LIT> ) {

x += <NUM_LIT> << ( bits + shift - <NUM_LIT> ) ;


<s> static int loongarch_sign_extend_cost ( rtx op ) { if ( MEM_P ( op ) ) return <NUM_LIT> ;


<s> else if ( MEM_P ( x ) ) { if ( loongarch_small_data_pattern_1 ( XEXP ( x , <NUM_LIT> ) ) ) return true ; iter . skip_subrtxes ( ) ;


<s> if ( GET_CODE ( x ) == ASM_OPERANDS ) iter . skip_subrtxes ( ) ; else if ( MEM_P ( x ) ) { if ( loongarch_small_data_pattern_1 ( XEXP ( x , <NUM_LIT> ) ) ) return true ; iter . skip_subrtxes ( ) ; }


<s> bool loongarch_small_data_pattern_p ( rtx op ) { return loongarch_small_data_pattern_1 ( op ) ;


<s> high = loongarch_const_insns ( loongarch_subword ( x , true ) ) ;

gcc_assert ( low > <NUM_LIT> && high > <NUM_LIT> ) ;


<s> loongarch_emit_move ( loongarch_subword ( dest , true ) , loongarch_subword ( src , true ) ) ; loongarch_emit_move ( low_dest , loongarch_subword ( src , false ) ) ; } else { loongarch_emit_move ( low_dest , loongarch_subword ( src , false ) ) ; loongarch_emit_move ( loongarch_subword ( dest , true ) , loongarch_subword ( src , true ) ) ; } } rtx_insn * insn = ( rtx_insn * ) insn_ ; struct loongarch_address_info addr = { } ; if ( insn ) { rtx_insn * next = next_nonnote_nondebug_insn_bb ( insn ) ; if ( next ) { rtx set = single_set ( next ) ;


<s> loongarch_split_move ( dest , src , insn ) ;


<s> bool loongarch_split_move_insn_p ( rtx dest , rtx src ) { return loongarch_split_move_p ( dest , src ) ;


<s> bool loongarch_split_move_p ( rtx dest , rtx src ) { unsigned int size = GET_MODE_SIZE ( GET_MODE ( dest ) ) ; if ( size == <NUM_LIT> && FP_REG_RTX_P ( src ) && FP_REG_RTX_P ( dest ) ) return false ; if ( size == <NUM_LIT> ) { if ( FP_REG_RTX_P ( dest ) && MEM_P ( src ) ) return false ; if ( FP_REG_RTX_P ( src ) && MEM_P ( dest ) ) return false ; }


<s> unsigned int size = GET_MODE_SIZE ( GET_MODE ( dest ) ) ; if ( size == <NUM_LIT> && FP_REG_RTX_P ( src ) && FP_REG_RTX_P ( dest ) ) return false ; if ( size == <NUM_LIT> ) { if ( FP_REG_RTX_P ( dest ) && MEM_P ( src ) ) return false ; if ( FP_REG_RTX_P ( src ) && MEM_P ( dest ) ) return false ; }


<s> if ( GET_CODE ( x ) == PLUS && CONST_INT_P ( XEXP ( x , <NUM_LIT> ) ) ) { * base_ptr = XEXP ( x , <NUM_LIT> ) ; * offset_ptr = INTVAL ( XEXP ( x , <NUM_LIT> ) ) ; }


<s> static void loongarch_split_plus ( rtx x , rtx * base_ptr , HOST_WIDE_INT * offset_ptr ) { if ( GET_CODE ( x ) == PLUS && CONST_INT_P ( XEXP ( x , <NUM_LIT> ) ) ) { * base_ptr = XEXP ( x , <NUM_LIT> ) ; * offset_ptr = INTVAL ( XEXP ( x , <NUM_LIT> ) ) ; }


<s> static HOST_WIDE_INT loongarch_starting_frame_offset ( void ) { if ( FRAME_GROWS_DOWNWARD ) return <NUM_LIT> ;


<s> static HOST_WIDE_INT loongarch_starting_frame_offset ( void ) {

if ( FRAME_GROWS_DOWNWARD ) return <NUM_LIT> ;


<s> rtx base , offset ; split_const ( op , & base , & offset ) ; if ( UNSPEC_ADDRESS_P ( base ) ) op = plus_constant ( Pmode , UNSPEC_ADDRESS ( base ) , INTVAL ( offset ) ) ;


<s> split_const ( op , & base , & offset ) ; if ( UNSPEC_ADDRESS_P ( base ) ) op = plus_constant ( Pmode , UNSPEC_ADDRESS ( base ) , INTVAL ( offset ) ) ;


<s> if ( MEM_P ( op ) ) return loongarch_rewrite_small_data ( adjust_address ( op , word_mode , byte ) ) ; return simplify_gen_subreg ( word_mode , op , mode , byte ) ;


<s> if ( UNSPEC_ADDRESS_P ( x ) ) { * symbol_type = UNSPEC_ADDRESS_TYPE ( x ) ; x = UNSPEC_ADDRESS ( x ) ; } else if ( SYMBOL_REF_P ( x ) || LABEL_REF_P ( x ) ) { * symbol_type = loongarch_classify_symbol ( x ) ; if ( * symbol_type == SYMBOL_TLS ) return true ; } else return false ; if ( offset == const0_rtx ) return true ; switch ( * symbol_type ) { case SYMBOL_GOT_DISP :


<s> bool loongarch_symbol_binds_local_p ( const_rtx x ) { if ( LABEL_REF_P ( x ) ) return false ;

return ( SYMBOL_REF_DECL ( x ) ? targetm . binds_local_p ( SYMBOL_REF_DECL ( x ) ) : SYMBOL_REF_LOCAL_P ( x ) ) ;


<s> return ( SYMBOL_REF_DECL ( x ) ? targetm . binds_local_p ( SYMBOL_REF_DECL ( x ) ) : SYMBOL_REF_LOCAL_P ( x ) ) ;


<s> static int loongarch_symbol_insns ( enum loongarch_symbol_type type , machine_mode mode ) { switch ( type ) { case SYMBOL_GOT_DISP : if ( mode != MAX_MACHINE_MODE ) return <NUM_LIT> ; return <NUM_LIT> ; case SYMBOL_TLSGD : case SYMBOL_TLSLDM : return <NUM_LIT> ; case SYMBOL_TLS : return <NUM_LIT> ; } gcc_unreachable ( ) ;


<s> return SYMBOL_REF_P ( x ) && SYMBOL_REF_TLS_MODEL ( x ) != <NUM_LIT> ;


<s> bool loongarch_unsigned_immediate_p ( unsigned HOST_WIDE_INT x , int bits , int shift = <NUM_LIT> ) {

return ( x & ( ( <NUM_LIT> << shift ) - <NUM_LIT> ) ) == <NUM_LIT> && x < ( ( unsigned ) <NUM_LIT> << ( shift + bits ) ) ;


<s> split_const ( address , & base , & offset ) ;

return loongarch_unspec_address_offset ( base , offset , symbol_type ) ;


<s> base = gen_rtx_UNSPEC ( Pmode , gen_rtvec ( <NUM_LIT> , base ) , UNSPEC_ADDRESS_FIRST + symbol_type ) ; if ( offset != const0_rtx ) base = gen_rtx_PLUS ( Pmode , base , offset ) ;


<s> if ( ! IN_RANGE ( width , <NUM_LIT> , GET_MODE_BITSIZE ( GET_MODE ( op ) ) - <NUM_LIT> ) ) return false ;

if ( bitpos < <NUM_LIT> || bitpos + width > GET_MODE_BITSIZE ( GET_MODE ( op ) ) ) return false ;


<s> if ( ! strict_p && SUBREG_P ( x ) ) x = SUBREG_REG ( x ) ; return ( REG_P ( x ) && loongarch_regno_mode_ok_for_base_p ( REGNO ( x ) , mode , strict_p ) ) ;


<s> } else return false ; if ( ! strict_p && SUBREG_P ( index ) && contains_reg_of_mode [ GENERAL_REGS ] [ GET_MODE ( SUBREG_REG ( index ) ) ] ) index = SUBREG_REG ( index ) ; if ( loongarch_valid_base_register_p ( index , mode , strict_p ) ) { info -> type = ADDRESS_REG_REG ; info -> offset = index ; return true ; }


<s> return mode == SImode || ( TARGET_64BIT && mode == DImode ) ;


<s> static bool loongarch_valid_pointer_mode ( scalar_int_mode mode ) {

return mode == SImode || ( TARGET_64BIT && mode == DImode ) ;


<s> static void loongarch_va_start ( tree valist , rtx nextarg ) { nextarg = plus_constant ( Pmode , nextarg , - cfun -> machine -> varargs_size ) ;

std_expand_builtin_va_start ( valist , nextarg ) ;


<s> bool loongarch_weak_symbol_p ( const_rtx x ) { const_tree decl ; if ( LABEL_REF_P ( x ) || ! ( decl = SYMBOL_REF_DECL ( x ) ) ) return false ; return DECL_P ( decl ) && DECL_WEAK ( decl ) ;


<s> static int loongarch_zero_extend_cost ( rtx op ) { if ( MEM_P ( op ) ) return <NUM_LIT> ;