From: Takayuki 'January June' Suwa Date: Fri, 13 May 2022 13:27:36 +0000 (+0900) Subject: xtensa: Make use of IN_RANGE macro where appropriate X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9b251fe2e39a49c0d3ecd34cf8c5d55544efd159;p=platform%2Fupstream%2Fgcc.git xtensa: Make use of IN_RANGE macro where appropriate No functional changes. gcc/ChangeLog: * config/xtensa/constraints.md (M, O): Use the macro. * config/xtensa/predicates.md (addsubx_operand, extui_fldsz_operand, sext_fldsz_operand): Ditto. * config/xtensa/xtensa.cc (xtensa_simm8, xtensa_simm8x256, xtensa_simm12b, xtensa_uimm8, xtensa_uimm8x2, xtensa_uimm8x4, xtensa_mask_immediate, smalloffset_mem_p, printx, xtensa_call_save_reg, xtensa_expand_prologue): Ditto. * config/xtensa/xtensa.h (FUNCTION_ARG_REGNO_P): Ditto. --- diff --git a/gcc/config/xtensa/constraints.md b/gcc/config/xtensa/constraints.md index 7fda33a..e7ac8db 100644 --- a/gcc/config/xtensa/constraints.md +++ b/gcc/config/xtensa/constraints.md @@ -92,7 +92,7 @@ "An integer constant in the range @minus{}32-95 for use with MOVI.N instructions." (and (match_code "const_int") - (match_test "ival >= -32 && ival <= 95"))) + (match_test "IN_RANGE (ival, -32, 95)"))) (define_constraint "N" "An unsigned 8-bit integer constant shifted left by 8 bits for use @@ -103,7 +103,7 @@ (define_constraint "O" "An integer constant that can be used in ADDI.N instructions." (and (match_code "const_int") - (match_test "ival == -1 || (ival >= 1 && ival <= 15)"))) + (match_test "ival == -1 || IN_RANGE (ival, 1, 15)"))) (define_constraint "P" "An integer constant that can be used as a mask value in an EXTUI diff --git a/gcc/config/xtensa/predicates.md b/gcc/config/xtensa/predicates.md index daea63b..a912e6d 100644 --- a/gcc/config/xtensa/predicates.md +++ b/gcc/config/xtensa/predicates.md @@ -25,8 +25,7 @@ (define_predicate "addsubx_operand" (and (match_code "const_int") - (match_test "INTVAL (op) >= 1 - && INTVAL (op) <= 3"))) + (match_test "IN_RANGE (INTVAL (op), 1, 3)"))) (define_predicate "arith_operand" (ior (and (match_code "const_int") @@ -64,7 +63,7 @@ (define_predicate "sext_fldsz_operand" (and (match_code "const_int") - (match_test "INTVAL (op) >= 8 && INTVAL (op) <= 23"))) + (match_test "IN_RANGE (INTVAL (op), 8, 23)"))) (define_predicate "lsbitnum_operand" (and (match_code "const_int") diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index a1f77b2..c5518ff 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -351,42 +351,42 @@ struct gcc_target targetm = TARGET_INITIALIZER; bool xtensa_simm8 (HOST_WIDE_INT v) { - return v >= -128 && v <= 127; + return IN_RANGE (v, -128, 127); } bool xtensa_simm8x256 (HOST_WIDE_INT v) { - return (v & 255) == 0 && (v >= -32768 && v <= 32512); + return (v & 255) == 0 && IN_RANGE (v, -32768, 32512); } bool xtensa_simm12b (HOST_WIDE_INT v) { - return v >= -2048 && v <= 2047; + return IN_RANGE (v, -2048, 2047); } static bool xtensa_uimm8 (HOST_WIDE_INT v) { - return v >= 0 && v <= 255; + return IN_RANGE (v, 0, 255); } static bool xtensa_uimm8x2 (HOST_WIDE_INT v) { - return (v & 1) == 0 && (v >= 0 && v <= 510); + return (v & 1) == 0 && IN_RANGE (v, 0, 510); } static bool xtensa_uimm8x4 (HOST_WIDE_INT v) { - return (v & 3) == 0 && (v >= 0 && v <= 1020); + return (v & 3) == 0 && IN_RANGE (v, 0, 1020); } @@ -537,7 +537,7 @@ smalloffset_mem_p (rtx op) return FALSE; val = INTVAL (offset); - return (val & 3) == 0 && (val >= 0 && val <= 60); + return (val & 3) == 0 && IN_RANGE (val, 0, 60); } } return FALSE; @@ -2367,7 +2367,7 @@ static void printx (FILE *file, signed int val) { /* Print a hexadecimal value in a nice way. */ - if ((val > -0xa) && (val < 0xa)) + if (IN_RANGE (val, -9, 9)) fprintf (file, "%d", val); else if (val < 0) fprintf (file, "-0x%x", -val); @@ -2697,7 +2697,7 @@ xtensa_call_save_reg(int regno) return crtl->profile || !crtl->is_leaf || crtl->calls_eh_return || df_regs_ever_live_p (regno); - if (crtl->calls_eh_return && regno >= 2 && regno < 4) + if (crtl->calls_eh_return && IN_RANGE (regno, 2, 3)) return true; return !call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno); @@ -2817,7 +2817,7 @@ xtensa_expand_prologue (void) int callee_save_size = cfun->machine->callee_save_size; /* -128 is a limit of single addi instruction. */ - if (total_size > 0 && total_size <= 128) + if (IN_RANGE (total_size, 1, 128)) { insn = emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, GEN_INT (-total_size))); diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index d25594f..d027a77 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -504,7 +504,7 @@ enum reg_class used for this purpose since all function arguments are pushed on the stack. */ #define FUNCTION_ARG_REGNO_P(N) \ - ((N) >= GP_OUTGOING_ARG_FIRST && (N) <= GP_OUTGOING_ARG_LAST) + IN_RANGE ((N), GP_OUTGOING_ARG_FIRST, GP_OUTGOING_ARG_LAST) /* Record the number of argument words seen so far, along with a flag to indicate whether these are incoming arguments. (FUNCTION_INCOMING_ARG