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
This commit is contained in:
Uros Bizjak 2015-10-02 20:08:59 +02:00
parent 1c7485afda
commit 54070b5155
5 changed files with 47 additions and 32 deletions

View File

@ -1,3 +1,19 @@
2015-10-02 Uros Bizjak <ubizjak@gmail.com>
* 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 <polacek@redhat.com> 2015-10-02 Marek Polacek <polacek@redhat.com>
* genemit.c (gen_exp): Remove -Wduplicated-cond hack. * genemit.c (gen_exp): Remove -Wduplicated-cond hack.
@ -188,7 +204,8 @@
PR tree-optimization/67754 PR tree-optimization/67754
* graphite-scop-detection.c (stmt_has_simple_data_refs_p): Call * graphite-scop-detection.c (stmt_has_simple_data_refs_p): Call
scev analysis on the same loop nest as analyze_drs_in_stmts. 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. (try_generate_gimple_bb): Call outermost_loop_in_sese.
(analyze_drs_in_stmts): Same. (analyze_drs_in_stmts): Same.
* sese.c (outermost_loop_in_sese): ...here. * sese.c (outermost_loop_in_sese): ...here.
@ -232,8 +249,7 @@
2015-10-01 H.J. Lu <hongjiu.lu@intel.com> 2015-10-01 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/x86-tune.def (X86_TUNE_USE_BT): Enable for * config/i386/x86-tune.def (X86_TUNE_USE_BT): Enable for Lakemont.
Lakemont.
(X86_TUNE_ZERO_EXTEND_WITH_AND): Disable for Lakemont. (X86_TUNE_ZERO_EXTEND_WITH_AND): Disable for Lakemont.
2015-10-01 James Greenhalgh <james.greenhalgh@arm.com> 2015-10-01 James Greenhalgh <james.greenhalgh@arm.com>
@ -388,8 +404,7 @@
* config/i386/intelmic-mkoffload.c (main): Parse "-v" flag. * config/i386/intelmic-mkoffload.c (main): Parse "-v" flag.
(generate_target_descr_file, generate_target_offloadend_file) (generate_target_descr_file, generate_target_offloadend_file)
(generate_host_descr_file, prepare_target_image, main): Pass it (generate_host_descr_file, prepare_target_image, main): Pass it on.
on.
* config/nvptx/mkoffload.c (main): Parse "-v" flag. * config/nvptx/mkoffload.c (main): Parse "-v" flag.
(compile_native, main): Pass it on. (compile_native, main): Pass it on.
* lto-wrapper.c (compile_offload_image): Likewise. * lto-wrapper.c (compile_offload_image): Likewise.
@ -422,7 +437,7 @@
2015-09-30 Richard Biener <rguenther@suse.de> 2015-09-30 Richard Biener <rguenther@suse.de>
* builtins.c: Add comment that no new simplifications shouldd * builtins.c: Add comment that no new simplifications should
be added here. be added here.
2015-09-30 Marek Polacek <polacek@redhat.com> 2015-09-30 Marek Polacek <polacek@redhat.com>
@ -488,8 +503,7 @@
* config/i386/t-interix (winnt-stubs.o): Fix compilation rule. * config/i386/t-interix (winnt-stubs.o): Fix compilation rule.
* config/sh/sh.c (gen_shl_and): Fix undefined left shift * config/sh/sh.c (gen_shl_and): Fix undefined left shift behaviour.
behaviour.
(gen_shl_sext): Likewise. (gen_shl_sext): Likewise.
* config/sh/sh.md (divsi3): Likewise. * config/sh/sh.md (divsi3): Likewise.
(imm->ext_dest_operand splitter): Likewise. (imm->ext_dest_operand splitter): Likewise.
@ -1349,7 +1363,7 @@
(define_insn "*<code><mode>3"): ... Into new pattern using (define_insn "*<code><mode>3"): ... Into new pattern using
VI12_AVX_AVX512F iterators without masking. VI12_AVX_AVX512F iterators without masking.
2015-09-22 Kirill Yukhin <kirill.yukhin@intel.com> 2015-09-22 Kirill Yukhin <kirill.yukhin@intel.com>
* config.gcc: Support "skylake-avx512". * config.gcc: Support "skylake-avx512".
* config/i386/i386-c.c (ix86_target_macros_internal): Handle * config/i386/i386-c.c (ix86_target_macros_internal): Handle
@ -1364,14 +1378,14 @@
(processor_type): Add PROCESSOR_SKYLAKE_AVX512. (processor_type): Add PROCESSOR_SKYLAKE_AVX512.
* doc/invoke.texi (skylake-avx512): New. * doc/invoke.texi (skylake-avx512): New.
2015-09-22 Kirill Yukhin <kirill.yukhin@intel.com> 2015-09-22 Kirill Yukhin <kirill.yukhin@intel.com>
* gcc/config/i386/i386.md (define_insn "kunpckhi"): Fix * gcc/config/i386/i386.md (define_insn "kunpckhi"): Fix
operand in pattern. operand in pattern.
(define_insn "kunpcksi"): Ditto. (define_insn "kunpcksi"): Ditto.
(define_insn "kunpckdi"): Ditto. (define_insn "kunpckdi"): Ditto.
2015-09-22 Kirill Yukhin <kirill.yukhin@intel.com> 2015-09-22 Kirill Yukhin <kirill.yukhin@intel.com>
* gcc/config/i386/i386.md (define_split not/xor SWI1248x): Use * gcc/config/i386/i386.md (define_split not/xor SWI1248x): Use
iterator instead of fixed modes. iterator instead of fixed modes.
@ -3273,7 +3287,7 @@
2015-09-04 Andrey Turetskiy <andrey.turetskiy@intel.com> 2015-09-04 Andrey Turetskiy <andrey.turetskiy@intel.com>
Petr Murzin <petr.murzin@intel.com> Petr Murzin <petr.murzin@intel.com>
Kirill Yukhin <kirill.yukhin@intel.com> Kirill Yukhin <kirill.yukhin@intel.com>
* config/i386/i386-builtin-types.def * config/i386/i386-builtin-types.def
(VOID_PFLOAT_HI_V8DI_V16SF_INT): New. (VOID_PFLOAT_HI_V8DI_V16SF_INT): New.
@ -3296,7 +3310,7 @@
2015-09-04 Andrey Turetskiy <andrey.turetskiy@intel.com> 2015-09-04 Andrey Turetskiy <andrey.turetskiy@intel.com>
Petr Murzin <petr.murzin@intel.com> Petr Murzin <petr.murzin@intel.com>
Kirill Yukhin <kirill.yukhin@intel.com> Kirill Yukhin <kirill.yukhin@intel.com>
* doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_SCATTER): New. * doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_SCATTER): New.
* doc/tm.texi: Regenerate. * doc/tm.texi: Regenerate.

View File

@ -8651,7 +8651,7 @@ function_arg_advance_64 (CUMULATIVE_ARGS *cum, machine_mode mode,
else else
{ {
int align = ix86_function_arg_boundary (mode, type) / BITS_PER_WORD; 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; cum->words += words;
return 0; 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 16-byte aligned default stack, and thus we don't need to be
within the re-aligned local stack frame to save them. */ within the re-aligned local stack frame to save them. */
gcc_assert (INCOMING_STACK_BOUNDARY >= 128); gcc_assert (INCOMING_STACK_BOUNDARY >= 128);
offset = (offset + 16 - 1) & -16; offset = ROUND_UP (offset, 16);
offset += frame->nsseregs * 16; offset += frame->nsseregs * 16;
} }
frame->sse_reg_save_offset = offset; 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 sure that no value happens to be the same before and after, force
the alignment computation below to add a non-zero value. */ the alignment computation below to add a non-zero value. */
if (stack_realign_fp) if (stack_realign_fp)
offset = (offset + stack_alignment_needed) & -stack_alignment_needed; offset = ROUND_UP (offset, stack_alignment_needed);
/* Va-arg area */ /* Va-arg area */
frame->va_arg_size = ix86_varargs_gpr_size + ix86_varargs_fpr_size; 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 || !crtl->is_leaf
|| cfun->calls_alloca || cfun->calls_alloca
|| ix86_current_function_calls_tls_descriptor) || 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 pointer points here. */
frame->frame_pointer_offset = offset; frame->frame_pointer_offset = offset;
@ -11334,7 +11334,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame)
or using alloca. */ or using alloca. */
if (!crtl->is_leaf || cfun->calls_alloca if (!crtl->is_leaf || cfun->calls_alloca
|| ix86_current_function_calls_tls_descriptor) || 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. */ /* We've reached end of stack frame. */
frame->stack_pointer_offset = offset; 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. */ /* 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. */ /* 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. */ /* 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. */ /* 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, pointer is no longer valid. As for the value of sp_offset,
see ix86_compute_frame_layout, which we need to match in order see ix86_compute_frame_layout, which we need to match in order
to pass verification of stack_pointer_offset at the end. */ 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; 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); destexp = gen_rtx_PLUS (Pmode, destptr, countreg);
if ((!issetmem || orig_value == const0_rtx) && CONST_INT_P (count)) if ((!issetmem || orig_value == const0_rtx) && CONST_INT_P (count))
{ {
rounded_count = (INTVAL (count) rounded_count
& ~((HOST_WIDE_INT) GET_MODE_SIZE (mode) - 1)); = ROUND_DOWN (INTVAL (count), (HOST_WIDE_INT) GET_MODE_SIZE (mode));
destmem = shallow_copy_rtx (destmem); destmem = shallow_copy_rtx (destmem);
set_mem_size (destmem, rounded_count); 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); srcexp = gen_rtx_PLUS (Pmode, srcptr, countreg);
if (CONST_INT_P (count)) if (CONST_INT_P (count))
{ {
rounded_count = (INTVAL (count) rounded_count
& ~((HOST_WIDE_INT) GET_MODE_SIZE (mode) - 1)); = ROUND_DOWN (INTVAL (count), (HOST_WIDE_INT) GET_MODE_SIZE (mode));
srcmem = shallow_copy_rtx (srcmem); srcmem = shallow_copy_rtx (srcmem);
set_mem_size (srcmem, rounded_count); set_mem_size (srcmem, rounded_count);
} }

View File

@ -1596,8 +1596,7 @@ enum reg_class
and -8 for 64bit targets, we need to make sure all stack pointer adjustments 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. */ are in multiple of 4 for 32bit targets and 8 for 64bit targets. */
#define PUSH_ROUNDING(BYTES) \ #define PUSH_ROUNDING(BYTES) ROUND_UP (BYTES, UNITS_PER_WORD)
(((BYTES) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD)
/* If defined, the maximum amount of space required for outgoing arguments /* If defined, the maximum amount of space required for outgoing arguments
will be computed and placed into the variable `crtl->outgoing_args_size'. will be computed and placed into the variable `crtl->outgoing_args_size'.

View File

@ -216,13 +216,9 @@ static const size_t extra_order_size_table[] = {
#define ROUND_UP_VALUE(x, f) ((f) - 1 - ((f) - 1 + (x)) % (f)) #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 */ /* 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. */ /* The Ith entry is the number of objects on a page or order I. */

View File

@ -369,6 +369,12 @@ extern int errno;
/* Returns the least number N such that N * Y >= X. */ /* Returns the least number N such that N * Y >= X. */
#define CEIL(x,y) (((x) + (y) - 1) / (y)) #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 #ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif