From 54070b515503af0361d0d03851fd0082b2a8258e Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 2 Oct 2015 20:08:59 +0200 Subject: [PATCH] system.h (ROUND_UP): New macro definition. * system.h (ROUND_UP): New macro definition. (ROUND_DOWN): Ditto. * ggc-page.c (ROUND_UP): Remove local macro definition. (PAGE_ALIGN): Implement using ROUND_UP macro. * config/i386/i386.h (PUSH_ROUNDING): Implement using ROUND_UP macro. * config/i386/i386.c (function_arg_advance_64): Use ROUND_UP macro to align values. (ix86_compute_frame_layout): Ditto. (ix86_expand_prologue): Ditto. (ix86_adjust_stack_and_probe): Use ROUND_DOWN macro to round down values. (expand_set_or_movmem_via_rep): Ditto. From-SVN: r228410 --- gcc/ChangeLog | 40 +++++++++++++++++++++++++++------------- gcc/config/i386/i386.c | 24 ++++++++++++------------ gcc/config/i386/i386.h | 3 +-- gcc/ggc-page.c | 6 +----- gcc/system.h | 6 ++++++ 5 files changed, 47 insertions(+), 32 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6e4181092fe..3f7561a0c57 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2015-10-02 Uros Bizjak + + * system.h (ROUND_UP): New macro definition. + (ROUND_DOWN): Ditto. + * ggc-page.c (ROUND_UP): Remove local macro definition. + (PAGE_ALIGN): Implement using ROUND_UP macro. + + * config/i386/i386.h (PUSH_ROUNDING): Implement using ROUND_UP macro. + * config/i386/i386.c (function_arg_advance_64): Use ROUND_UP macro + to align values. + (ix86_compute_frame_layout): Ditto. + (ix86_expand_prologue): Ditto. + (ix86_adjust_stack_and_probe): Use ROUND_DOWN macro + to round down values. + (expand_set_or_movmem_via_rep): Ditto. + 2015-10-02 Marek Polacek * genemit.c (gen_exp): Remove -Wduplicated-cond hack. @@ -188,7 +204,8 @@ PR tree-optimization/67754 * graphite-scop-detection.c (stmt_has_simple_data_refs_p): Call scev analysis on the same loop nest as analyze_drs_in_stmts. - * graphite-sese-to-poly.c (outermost_loop_in_sese_1): Moved and renamed... + * graphite-sese-to-poly.c (outermost_loop_in_sese_1): Moved and + renamed... (try_generate_gimple_bb): Call outermost_loop_in_sese. (analyze_drs_in_stmts): Same. * sese.c (outermost_loop_in_sese): ...here. @@ -232,8 +249,7 @@ 2015-10-01 H.J. Lu - * config/i386/x86-tune.def (X86_TUNE_USE_BT): Enable for - Lakemont. + * config/i386/x86-tune.def (X86_TUNE_USE_BT): Enable for Lakemont. (X86_TUNE_ZERO_EXTEND_WITH_AND): Disable for Lakemont. 2015-10-01 James Greenhalgh @@ -388,8 +404,7 @@ * config/i386/intelmic-mkoffload.c (main): Parse "-v" flag. (generate_target_descr_file, generate_target_offloadend_file) - (generate_host_descr_file, prepare_target_image, main): Pass it - on. + (generate_host_descr_file, prepare_target_image, main): Pass it on. * config/nvptx/mkoffload.c (main): Parse "-v" flag. (compile_native, main): Pass it on. * lto-wrapper.c (compile_offload_image): Likewise. @@ -422,7 +437,7 @@ 2015-09-30 Richard Biener - * builtins.c: Add comment that no new simplifications shouldd + * builtins.c: Add comment that no new simplifications should be added here. 2015-09-30 Marek Polacek @@ -488,8 +503,7 @@ * config/i386/t-interix (winnt-stubs.o): Fix compilation rule. - * config/sh/sh.c (gen_shl_and): Fix undefined left shift - behaviour. + * config/sh/sh.c (gen_shl_and): Fix undefined left shift behaviour. (gen_shl_sext): Likewise. * config/sh/sh.md (divsi3): Likewise. (imm->ext_dest_operand splitter): Likewise. @@ -1349,7 +1363,7 @@ (define_insn "*3"): ... Into new pattern using VI12_AVX_AVX512F iterators without masking. -2015-09-22 Kirill Yukhin +2015-09-22 Kirill Yukhin * config.gcc: Support "skylake-avx512". * config/i386/i386-c.c (ix86_target_macros_internal): Handle @@ -1364,14 +1378,14 @@ (processor_type): Add PROCESSOR_SKYLAKE_AVX512. * doc/invoke.texi (skylake-avx512): New. -2015-09-22 Kirill Yukhin +2015-09-22 Kirill Yukhin * gcc/config/i386/i386.md (define_insn "kunpckhi"): Fix operand in pattern. (define_insn "kunpcksi"): Ditto. (define_insn "kunpckdi"): Ditto. -2015-09-22 Kirill Yukhin +2015-09-22 Kirill Yukhin * gcc/config/i386/i386.md (define_split not/xor SWI1248x): Use iterator instead of fixed modes. @@ -3273,7 +3287,7 @@ 2015-09-04 Andrey Turetskiy Petr Murzin - Kirill Yukhin + Kirill Yukhin * config/i386/i386-builtin-types.def (VOID_PFLOAT_HI_V8DI_V16SF_INT): New. @@ -3296,7 +3310,7 @@ 2015-09-04 Andrey Turetskiy Petr Murzin - Kirill Yukhin + Kirill Yukhin * doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_SCATTER): New. * doc/tm.texi: Regenerate. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 171917536a0..f5c96572ced 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8651,7 +8651,7 @@ function_arg_advance_64 (CUMULATIVE_ARGS *cum, machine_mode mode, else { int align = ix86_function_arg_boundary (mode, type) / BITS_PER_WORD; - cum->words = (cum->words + align - 1) & ~(align - 1); + cum->words = ROUND_UP (cum->words, align); cum->words += words; return 0; } @@ -11285,7 +11285,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame) 16-byte aligned default stack, and thus we don't need to be within the re-aligned local stack frame to save them. */ gcc_assert (INCOMING_STACK_BOUNDARY >= 128); - offset = (offset + 16 - 1) & -16; + offset = ROUND_UP (offset, 16); offset += frame->nsseregs * 16; } frame->sse_reg_save_offset = offset; @@ -11295,7 +11295,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame) sure that no value happens to be the same before and after, force the alignment computation below to add a non-zero value. */ if (stack_realign_fp) - offset = (offset + stack_alignment_needed) & -stack_alignment_needed; + offset = ROUND_UP (offset, stack_alignment_needed); /* Va-arg area */ frame->va_arg_size = ix86_varargs_gpr_size + ix86_varargs_fpr_size; @@ -11308,7 +11308,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame) || !crtl->is_leaf || cfun->calls_alloca || ix86_current_function_calls_tls_descriptor) - offset = (offset + stack_alignment_needed - 1) & -stack_alignment_needed; + offset = ROUND_UP (offset, stack_alignment_needed); /* Frame pointer points here. */ frame->frame_pointer_offset = offset; @@ -11334,7 +11334,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame) or using alloca. */ if (!crtl->is_leaf || cfun->calls_alloca || ix86_current_function_calls_tls_descriptor) - offset = (offset + preferred_alignment - 1) & -preferred_alignment; + offset = ROUND_UP (offset, preferred_alignment); /* We've reached end of stack frame. */ frame->stack_pointer_offset = offset; @@ -12050,7 +12050,7 @@ ix86_adjust_stack_and_probe (const HOST_WIDE_INT size) /* Step 1: round SIZE to the previous multiple of the interval. */ - rounded_size = size & -PROBE_INTERVAL; + rounded_size = ROUND_DOWN (size, PROBE_INTERVAL); /* Step 2: compute initial and final value of the loop counter. */ @@ -12204,7 +12204,7 @@ ix86_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) /* Step 1: round SIZE to the previous multiple of the interval. */ - rounded_size = size & -PROBE_INTERVAL; + rounded_size = ROUND_DOWN (size, PROBE_INTERVAL); /* Step 2: compute initial and final value of the loop counter. */ @@ -12663,7 +12663,7 @@ ix86_expand_prologue (void) pointer is no longer valid. As for the value of sp_offset, see ix86_compute_frame_layout, which we need to match in order to pass verification of stack_pointer_offset at the end. */ - m->fs.sp_offset = (m->fs.sp_offset + align_bytes) & -align_bytes; + m->fs.sp_offset = ROUND_UP (m->fs.sp_offset, align_bytes); m->fs.sp_valid = false; } @@ -24692,8 +24692,8 @@ expand_set_or_movmem_via_rep (rtx destmem, rtx srcmem, destexp = gen_rtx_PLUS (Pmode, destptr, countreg); if ((!issetmem || orig_value == const0_rtx) && CONST_INT_P (count)) { - rounded_count = (INTVAL (count) - & ~((HOST_WIDE_INT) GET_MODE_SIZE (mode) - 1)); + rounded_count + = ROUND_DOWN (INTVAL (count), (HOST_WIDE_INT) GET_MODE_SIZE (mode)); destmem = shallow_copy_rtx (destmem); set_mem_size (destmem, rounded_count); } @@ -24719,8 +24719,8 @@ expand_set_or_movmem_via_rep (rtx destmem, rtx srcmem, srcexp = gen_rtx_PLUS (Pmode, srcptr, countreg); if (CONST_INT_P (count)) { - rounded_count = (INTVAL (count) - & ~((HOST_WIDE_INT) GET_MODE_SIZE (mode) - 1)); + rounded_count + = ROUND_DOWN (INTVAL (count), (HOST_WIDE_INT) GET_MODE_SIZE (mode)); srcmem = shallow_copy_rtx (srcmem); set_mem_size (srcmem, rounded_count); } diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 96ba90f3525..c59e3ccd66f 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1596,8 +1596,7 @@ enum reg_class and -8 for 64bit targets, we need to make sure all stack pointer adjustments are in multiple of 4 for 32bit targets and 8 for 64bit targets. */ -#define PUSH_ROUNDING(BYTES) \ - (((BYTES) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD) +#define PUSH_ROUNDING(BYTES) ROUND_UP (BYTES, UNITS_PER_WORD) /* If defined, the maximum amount of space required for outgoing arguments will be computed and placed into the variable `crtl->outgoing_args_size'. diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 58f19c0d24e..34e9e243deb 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -216,13 +216,9 @@ static const size_t extra_order_size_table[] = { #define ROUND_UP_VALUE(x, f) ((f) - 1 - ((f) - 1 + (x)) % (f)) -/* Compute the smallest multiple of F that is >= X. */ - -#define ROUND_UP(x, f) (CEIL (x, f) * (f)) - /* Round X to next multiple of the page size */ -#define PAGE_ALIGN(x) (((x) + G.pagesize - 1) & ~(G.pagesize - 1)) +#define PAGE_ALIGN(x) ROUND_UP ((x), G.pagesize) /* The Ith entry is the number of objects on a page or order I. */ diff --git a/gcc/system.h b/gcc/system.h index 85a66a5441a..f1694b94430 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -369,6 +369,12 @@ extern int errno; /* Returns the least number N such that N * Y >= X. */ #define CEIL(x,y) (((x) + (y) - 1) / (y)) +/* This macro rounds x up to the y boundary. */ +#define ROUND_UP(x,y) (((x) + (y) - 1) & ~((y) - 1)) + +/* This macro rounds x down to the y boundary. */ +#define ROUND_DOWN(x,y) ((x) & ~((y) - 1)) + #ifdef HAVE_SYS_WAIT_H #include #endif -- 2.30.2