2000-04-18 20:14:10 +02:00
|
|
|
|
/* RTL simplification functions for GNU compiler.
|
2000-02-26 15:26:24 +01:00
|
|
|
|
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
2009-02-20 16:20:38 +01:00
|
|
|
|
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
2007-01-28 06:15:06 +01:00
|
|
|
|
Free Software Foundation, Inc.
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
This file is part of GCC.
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
2007-07-26 10:37:01 +02:00
|
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
version.
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
|
for more details.
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-07-26 10:37:01 +02:00
|
|
|
|
along with GCC; see the file COPYING3. If not see
|
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "system.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
|
#include "coretypes.h"
|
|
|
|
|
#include "tm.h"
|
1999-11-01 01:18:23 +01:00
|
|
|
|
#include "rtl.h"
|
real.c, real.h: Rewrite from scratch.
gcc/
* real.c, real.h: Rewrite from scratch.
* Makefile.in (simplify-rtx.o): Depend on TREE_H.
(paranoia): New target.
* builtins.c (fold_builtin_inf): Use new real.h interface.
* c-common.c (builtin_define_with_hex_fp_value): Likewise.
* c-lex.c (interpret_float): Likewise.
* emit-rtl.c (gen_lowpart_common): Likewise.
* optabs.c (expand_float): Use real_2expN.
* config/ia64/ia64.md (divsi3, udivsi3): Likewise.
* defaults.h (INTEL_EXTENDED_IEEE_FORMAT): New.
(FLOAT_WORDS_BIG_ENDIAN): New.
* cse.c (find_comparison_args): Don't pass FLOAT_STORE_FLAG_VALUE
directly to REAL_VALUE_NEGATIVE.
* loop.c (canonicalize_condition): Likewise.
* simplify-rtx.c: Include tree.h.
(simplify_unary_operation): Don't handle FIX and UNSIGNED_FIX
with floating-point result modes.
* toplev.c (backend_init): Call init_real_once.
* fold-const.c (force_fit_type): Don't call CHECK_FLOAT_VALUE.
* tree.c (build_real): Likewise.
* config/alpha/alpha.c, config/vax/vax.c (float_strings,
float_values, inited_float_values, check_float_value): Remove.
* config/alpha/alpha.h, config/m68hc11/m68hc11.h,
config/m88k/m88k.h, config/vax/vax.h (CHECK_FLOAT_VALUE): Remove.
* doc/tm.texi (CHECK_FLOAT_VALUE): Remove.
gcc/f/
* target.c (ffetarget_real1): Don't pass FFETARGET_ATOF_
directly to ffetarget_make_real1.
(ffetarget_real2): Similarly.
* target.h (ffetarget_cvt_r1_to_rv_, ffetarget_cvt_rv_to_r2_,
ffetarget_cvt_r2_to_rv_): Use new real.h interface and simplify.
gcc/java/
* jcf-parse.c (get_constant): Runtime check for IEEE format;
use new real.h interface.
* jcf-write.c (find_constant_index): Use new real.h interface.
* lex.c (IS_ZERO): Use REAL_VALUES_EQUAL.
contrib/
* paranoia.cc: New file.
From-SVN: r57198
2002-09-16 18:36:39 +02:00
|
|
|
|
#include "tree.h"
|
1999-11-01 01:18:23 +01:00
|
|
|
|
#include "tm_p.h"
|
|
|
|
|
#include "regs.h"
|
|
|
|
|
#include "hard-reg-set.h"
|
|
|
|
|
#include "flags.h"
|
|
|
|
|
#include "real.h"
|
|
|
|
|
#include "insn-config.h"
|
|
|
|
|
#include "recog.h"
|
|
|
|
|
#include "function.h"
|
|
|
|
|
#include "expr.h"
|
|
|
|
|
#include "toplev.h"
|
|
|
|
|
#include "output.h"
|
2000-03-14 19:36:18 +01:00
|
|
|
|
#include "ggc.h"
|
2003-02-03 20:40:58 +01:00
|
|
|
|
#include "target.h"
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
/* Simplification and canonicalization of RTL. */
|
|
|
|
|
|
2000-05-23 20:06:22 +02:00
|
|
|
|
/* Much code operates on (low, high) pairs; the low value is an
|
|
|
|
|
unsigned wide int, the high value a signed wide int. We
|
|
|
|
|
occasionally need to sign extend from low to high as if low were a
|
|
|
|
|
signed wide int. */
|
2000-05-24 22:26:54 +02:00
|
|
|
|
#define HWI_SIGN_EXTEND(low) \
|
2000-05-23 20:06:22 +02:00
|
|
|
|
((((HOST_WIDE_INT) low) < 0) ? ((HOST_WIDE_INT) -1) : ((HOST_WIDE_INT) 0))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
cfglayout.c (insn_scope, insn_line): Constify.
* cfglayout.c (insn_scope, insn_line): Constify.
* emit-rtl.c (const_int_htab_hash, const_int_htab_eq,
const_double_htab_hash, const_double_htab_eq,
mem_attrs_htab_hash): Likewise.
* loop-iv.c (biv_eq): Likewise.
* print-rtl.c (print_rtx, print_decl_name, print_mem_expr,
print_inline_rtx, debug_rtx, debug_rtx_list, debug_rtx_range,
debug_rtx_find, print_rtl, print_rtl_single, print_simple_rtl):
Likewise.
* rtl-error.c (location_for_asm, diagnostic_for_asm,
error_for_asm, warning_for_asm, _fatal_insn,
_fatal_insn_not_found): Likewise.
* rtl.c (rtx_size, shared_const_p, shallow_copy_rtx_stat,
rtx_equal_p, rtl_check_failed_bounds, rtl_check_failed_type1,
rtl_check_failed_type2, rtl_check_failed_code1,
rtl_check_failed_code2, rtl_check_failed_code_mode,
rtvec_check_failed_bounds, rtl_check_failed_flag): Likewise.
* rtl.h (rtl_check_failed_bounds, rtl_check_failed_type1,
rtl_check_failed_type2, rtl_check_failed_code1,
rtl_check_failed_code2, rtl_check_failed_code_mode,
rtvec_check_failed_bounds, rtl_check_failed_flag, LABEL_KIND,
SET_LABEL_KIND, rhs_regno, subreg_lsb, subreg_regno, subreg_nregs,
shared_const_p, rtx_size, shallow_copy_rtx_stat, rtx_equal_p,
get_pool_mode, insn_line, insn_file, simplify_replace_rtx,
mode_signbit_p, rtx_addr_can_trap_p, nonzero_address_p,
rtx_unstable_p, get_integer_term, get_related_value,
offset_within_block_p, reg_mentioned_p, count_occurrences,
reg_referenced_p, reg_used_between_p, no_labels_between_p,
single_set_2, multiple_sets, set_noop_p, refers_to_regno_p,
reg_overlap_mentioned_p, dead_or_set_p, dead_or_set_regno_p,
find_reg_note, find_regno_note, find_reg_equal_equiv_note,
find_constant_src, find_reg_fusage, find_regno_fusage,
pure_call_p, remove_note, side_effects_p, volatile_refs_p,
volatile_insn_p, may_trap_p, may_trap_after_code_motion_p,
may_trap_or_fault_p, inequality_comparisons_p, tablejump_p,
computed_jump_p, auto_inc_p, in_expr_list_p,
remove_node_from_expr_list, loc_mentioned_in_p,
label_is_jump_target_p, reversed_comparison_code_parts,
debug_rtx, debug_rtx_list, debug_rtx_range, debug_rtx_find,
print_mem_expr, print_rtl, print_simple_rtl, print_rtl_single,
print_inline_rtx): Likewise.
* rtlanal.c (covers_regno_p, covers_regno_no_parallel_p,
computed_jump_p_1, nonzero_bits1, rtx_unstable_p,
rtx_addr_can_trap_p_1, rtx_addr_can_trap_p, nonzero_address_p,
get_integer_term, get_related_value, offset_within_block_p,
count_occurrences, reg_mentioned_p, no_labels_between_p,
reg_used_between_p, reg_referenced_p, single_set_2,
multiple_sets, set_noop_p, refers_to_regno_p,
reg_overlap_mentioned_p, dead_or_set_p,
covers_regno_no_parallel_p, covers_regno_p,
dead_or_set_regno_p, find_reg_note, find_regno_note,
find_reg_equal_equiv_note, find_constant_src, find_reg_fusage,
find_regno_fusage, pure_call_p, remove_note, in_expr_list_p,
remove_node_from_expr_list, volatile_insn_p, volatile_refs_p,
side_effects_p, may_trap_p_1, may_trap_p,
may_trap_after_code_motion_p, may_trap_or_fault_p,
inequality_comparisons_p, tablejump_p, computed_jump_p_1,
computed_jump_p, auto_inc_p, loc_mentioned_in_p, subreg_lsb,
subreg_regno, subreg_nregs, label_is_jump_target_p): Likewise.
* simplify-rtx.c (neg_const_int, plus_minus_operand_p,
mode_signbit_p, simplify_replace_rtx, plus_minus_operand_p):
Likewise.
* toplev.h (_fatal_insn_not_found, _fatal_insn, error_for_asm,
warning_for_asm): Likewise.
* tree.h (print_rtl): Likewise.
* varasm.c (get_pool_mode): Likewise.
From-SVN: r126922
2007-07-25 20:33:26 +02:00
|
|
|
|
static rtx neg_const_int (enum machine_mode, const_rtx);
|
|
|
|
|
static bool plus_minus_operand_p (const_rtx);
|
2007-07-23 18:43:24 +02:00
|
|
|
|
static bool simplify_plus_minus_op_data_cmp (rtx, rtx);
|
2005-11-30 09:20:23 +01:00
|
|
|
|
static rtx simplify_plus_minus (enum rtx_code, enum machine_mode, rtx, rtx);
|
2004-01-06 23:51:00 +01:00
|
|
|
|
static rtx simplify_immed_subreg (enum machine_mode, rtx, enum machine_mode,
|
|
|
|
|
unsigned int);
|
2003-08-17 21:24:09 +02:00
|
|
|
|
static rtx simplify_associative_operation (enum rtx_code, enum machine_mode,
|
|
|
|
|
rtx, rtx);
|
2004-04-29 09:50:55 +02:00
|
|
|
|
static rtx simplify_relational_operation_1 (enum rtx_code, enum machine_mode,
|
|
|
|
|
enum machine_mode, rtx, rtx);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
static rtx simplify_unary_operation_1 (enum rtx_code, enum machine_mode, rtx);
|
|
|
|
|
static rtx simplify_binary_operation_1 (enum rtx_code, enum machine_mode,
|
|
|
|
|
rtx, rtx, rtx, rtx);
|
2001-12-13 02:21:52 +01:00
|
|
|
|
|
|
|
|
|
/* Negate a CONST_INT rtx, truncating (because a conversion from a
|
2001-12-28 19:17:54 +01:00
|
|
|
|
maximally negative number can overflow). */
|
2001-12-13 02:21:52 +01:00
|
|
|
|
static rtx
|
cfglayout.c (insn_scope, insn_line): Constify.
* cfglayout.c (insn_scope, insn_line): Constify.
* emit-rtl.c (const_int_htab_hash, const_int_htab_eq,
const_double_htab_hash, const_double_htab_eq,
mem_attrs_htab_hash): Likewise.
* loop-iv.c (biv_eq): Likewise.
* print-rtl.c (print_rtx, print_decl_name, print_mem_expr,
print_inline_rtx, debug_rtx, debug_rtx_list, debug_rtx_range,
debug_rtx_find, print_rtl, print_rtl_single, print_simple_rtl):
Likewise.
* rtl-error.c (location_for_asm, diagnostic_for_asm,
error_for_asm, warning_for_asm, _fatal_insn,
_fatal_insn_not_found): Likewise.
* rtl.c (rtx_size, shared_const_p, shallow_copy_rtx_stat,
rtx_equal_p, rtl_check_failed_bounds, rtl_check_failed_type1,
rtl_check_failed_type2, rtl_check_failed_code1,
rtl_check_failed_code2, rtl_check_failed_code_mode,
rtvec_check_failed_bounds, rtl_check_failed_flag): Likewise.
* rtl.h (rtl_check_failed_bounds, rtl_check_failed_type1,
rtl_check_failed_type2, rtl_check_failed_code1,
rtl_check_failed_code2, rtl_check_failed_code_mode,
rtvec_check_failed_bounds, rtl_check_failed_flag, LABEL_KIND,
SET_LABEL_KIND, rhs_regno, subreg_lsb, subreg_regno, subreg_nregs,
shared_const_p, rtx_size, shallow_copy_rtx_stat, rtx_equal_p,
get_pool_mode, insn_line, insn_file, simplify_replace_rtx,
mode_signbit_p, rtx_addr_can_trap_p, nonzero_address_p,
rtx_unstable_p, get_integer_term, get_related_value,
offset_within_block_p, reg_mentioned_p, count_occurrences,
reg_referenced_p, reg_used_between_p, no_labels_between_p,
single_set_2, multiple_sets, set_noop_p, refers_to_regno_p,
reg_overlap_mentioned_p, dead_or_set_p, dead_or_set_regno_p,
find_reg_note, find_regno_note, find_reg_equal_equiv_note,
find_constant_src, find_reg_fusage, find_regno_fusage,
pure_call_p, remove_note, side_effects_p, volatile_refs_p,
volatile_insn_p, may_trap_p, may_trap_after_code_motion_p,
may_trap_or_fault_p, inequality_comparisons_p, tablejump_p,
computed_jump_p, auto_inc_p, in_expr_list_p,
remove_node_from_expr_list, loc_mentioned_in_p,
label_is_jump_target_p, reversed_comparison_code_parts,
debug_rtx, debug_rtx_list, debug_rtx_range, debug_rtx_find,
print_mem_expr, print_rtl, print_simple_rtl, print_rtl_single,
print_inline_rtx): Likewise.
* rtlanal.c (covers_regno_p, covers_regno_no_parallel_p,
computed_jump_p_1, nonzero_bits1, rtx_unstable_p,
rtx_addr_can_trap_p_1, rtx_addr_can_trap_p, nonzero_address_p,
get_integer_term, get_related_value, offset_within_block_p,
count_occurrences, reg_mentioned_p, no_labels_between_p,
reg_used_between_p, reg_referenced_p, single_set_2,
multiple_sets, set_noop_p, refers_to_regno_p,
reg_overlap_mentioned_p, dead_or_set_p,
covers_regno_no_parallel_p, covers_regno_p,
dead_or_set_regno_p, find_reg_note, find_regno_note,
find_reg_equal_equiv_note, find_constant_src, find_reg_fusage,
find_regno_fusage, pure_call_p, remove_note, in_expr_list_p,
remove_node_from_expr_list, volatile_insn_p, volatile_refs_p,
side_effects_p, may_trap_p_1, may_trap_p,
may_trap_after_code_motion_p, may_trap_or_fault_p,
inequality_comparisons_p, tablejump_p, computed_jump_p_1,
computed_jump_p, auto_inc_p, loc_mentioned_in_p, subreg_lsb,
subreg_regno, subreg_nregs, label_is_jump_target_p): Likewise.
* simplify-rtx.c (neg_const_int, plus_minus_operand_p,
mode_signbit_p, simplify_replace_rtx, plus_minus_operand_p):
Likewise.
* toplev.h (_fatal_insn_not_found, _fatal_insn, error_for_asm,
warning_for_asm): Likewise.
* tree.h (print_rtl): Likewise.
* varasm.c (get_pool_mode): Likewise.
From-SVN: r126922
2007-07-25 20:33:26 +02:00
|
|
|
|
neg_const_int (enum machine_mode mode, const_rtx i)
|
2001-12-13 02:21:52 +01:00
|
|
|
|
{
|
emit-rtl.c (gen_int_mode): New function.
* emit-rtl.c (gen_int_mode): New function.
* rtl.h: Prototype for it.
* combine.c (make_extraction, simplify_comparison), expmed.c
(store_bit_field, expand_mult_highpart, expand_divmod), expr.c
(convert_modes, store_field), optabs.c (expand_fix),
simplify-rtx.c (neg_const_int, simplify_unary_real),
* config/rs6000/rs6000.c, config/rs6000/rs6000.md:
Use it instead of GEN_INT (trunc_int_for_mode (...)).
From-SVN: r51030
2002-03-19 19:00:43 +01:00
|
|
|
|
return gen_int_mode (- INTVAL (i), mode);
|
2001-12-13 02:21:52 +01:00
|
|
|
|
}
|
|
|
|
|
|
2004-04-09 23:39:14 +02:00
|
|
|
|
/* Test whether expression, X, is an immediate constant that represents
|
|
|
|
|
the most significant bit of machine mode MODE. */
|
|
|
|
|
|
2004-10-18 20:46:06 +02:00
|
|
|
|
bool
|
cfglayout.c (insn_scope, insn_line): Constify.
* cfglayout.c (insn_scope, insn_line): Constify.
* emit-rtl.c (const_int_htab_hash, const_int_htab_eq,
const_double_htab_hash, const_double_htab_eq,
mem_attrs_htab_hash): Likewise.
* loop-iv.c (biv_eq): Likewise.
* print-rtl.c (print_rtx, print_decl_name, print_mem_expr,
print_inline_rtx, debug_rtx, debug_rtx_list, debug_rtx_range,
debug_rtx_find, print_rtl, print_rtl_single, print_simple_rtl):
Likewise.
* rtl-error.c (location_for_asm, diagnostic_for_asm,
error_for_asm, warning_for_asm, _fatal_insn,
_fatal_insn_not_found): Likewise.
* rtl.c (rtx_size, shared_const_p, shallow_copy_rtx_stat,
rtx_equal_p, rtl_check_failed_bounds, rtl_check_failed_type1,
rtl_check_failed_type2, rtl_check_failed_code1,
rtl_check_failed_code2, rtl_check_failed_code_mode,
rtvec_check_failed_bounds, rtl_check_failed_flag): Likewise.
* rtl.h (rtl_check_failed_bounds, rtl_check_failed_type1,
rtl_check_failed_type2, rtl_check_failed_code1,
rtl_check_failed_code2, rtl_check_failed_code_mode,
rtvec_check_failed_bounds, rtl_check_failed_flag, LABEL_KIND,
SET_LABEL_KIND, rhs_regno, subreg_lsb, subreg_regno, subreg_nregs,
shared_const_p, rtx_size, shallow_copy_rtx_stat, rtx_equal_p,
get_pool_mode, insn_line, insn_file, simplify_replace_rtx,
mode_signbit_p, rtx_addr_can_trap_p, nonzero_address_p,
rtx_unstable_p, get_integer_term, get_related_value,
offset_within_block_p, reg_mentioned_p, count_occurrences,
reg_referenced_p, reg_used_between_p, no_labels_between_p,
single_set_2, multiple_sets, set_noop_p, refers_to_regno_p,
reg_overlap_mentioned_p, dead_or_set_p, dead_or_set_regno_p,
find_reg_note, find_regno_note, find_reg_equal_equiv_note,
find_constant_src, find_reg_fusage, find_regno_fusage,
pure_call_p, remove_note, side_effects_p, volatile_refs_p,
volatile_insn_p, may_trap_p, may_trap_after_code_motion_p,
may_trap_or_fault_p, inequality_comparisons_p, tablejump_p,
computed_jump_p, auto_inc_p, in_expr_list_p,
remove_node_from_expr_list, loc_mentioned_in_p,
label_is_jump_target_p, reversed_comparison_code_parts,
debug_rtx, debug_rtx_list, debug_rtx_range, debug_rtx_find,
print_mem_expr, print_rtl, print_simple_rtl, print_rtl_single,
print_inline_rtx): Likewise.
* rtlanal.c (covers_regno_p, covers_regno_no_parallel_p,
computed_jump_p_1, nonzero_bits1, rtx_unstable_p,
rtx_addr_can_trap_p_1, rtx_addr_can_trap_p, nonzero_address_p,
get_integer_term, get_related_value, offset_within_block_p,
count_occurrences, reg_mentioned_p, no_labels_between_p,
reg_used_between_p, reg_referenced_p, single_set_2,
multiple_sets, set_noop_p, refers_to_regno_p,
reg_overlap_mentioned_p, dead_or_set_p,
covers_regno_no_parallel_p, covers_regno_p,
dead_or_set_regno_p, find_reg_note, find_regno_note,
find_reg_equal_equiv_note, find_constant_src, find_reg_fusage,
find_regno_fusage, pure_call_p, remove_note, in_expr_list_p,
remove_node_from_expr_list, volatile_insn_p, volatile_refs_p,
side_effects_p, may_trap_p_1, may_trap_p,
may_trap_after_code_motion_p, may_trap_or_fault_p,
inequality_comparisons_p, tablejump_p, computed_jump_p_1,
computed_jump_p, auto_inc_p, loc_mentioned_in_p, subreg_lsb,
subreg_regno, subreg_nregs, label_is_jump_target_p): Likewise.
* simplify-rtx.c (neg_const_int, plus_minus_operand_p,
mode_signbit_p, simplify_replace_rtx, plus_minus_operand_p):
Likewise.
* toplev.h (_fatal_insn_not_found, _fatal_insn, error_for_asm,
warning_for_asm): Likewise.
* tree.h (print_rtl): Likewise.
* varasm.c (get_pool_mode): Likewise.
From-SVN: r126922
2007-07-25 20:33:26 +02:00
|
|
|
|
mode_signbit_p (enum machine_mode mode, const_rtx x)
|
2004-04-09 23:39:14 +02:00
|
|
|
|
{
|
|
|
|
|
unsigned HOST_WIDE_INT val;
|
|
|
|
|
unsigned int width;
|
|
|
|
|
|
|
|
|
|
if (GET_MODE_CLASS (mode) != MODE_INT)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
width = GET_MODE_BITSIZE (mode);
|
|
|
|
|
if (width == 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (width <= HOST_BITS_PER_WIDE_INT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (x))
|
2004-04-09 23:39:14 +02:00
|
|
|
|
val = INTVAL (x);
|
|
|
|
|
else if (width <= 2 * HOST_BITS_PER_WIDE_INT
|
|
|
|
|
&& GET_CODE (x) == CONST_DOUBLE
|
|
|
|
|
&& CONST_DOUBLE_LOW (x) == 0)
|
|
|
|
|
{
|
|
|
|
|
val = CONST_DOUBLE_HIGH (x);
|
|
|
|
|
width -= HOST_BITS_PER_WIDE_INT;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (width < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
val &= ((unsigned HOST_WIDE_INT) 1 << width) - 1;
|
|
|
|
|
return val == ((unsigned HOST_WIDE_INT) 1 << (width - 1));
|
|
|
|
|
}
|
2000-04-18 20:14:10 +02:00
|
|
|
|
|
2002-05-09 14:02:29 +02:00
|
|
|
|
/* Make a binary operation by properly ordering the operands and
|
1999-11-01 01:18:23 +01:00
|
|
|
|
seeing if the expression folds. */
|
|
|
|
|
|
|
|
|
|
rtx
|
2003-07-06 14:35:56 +02:00
|
|
|
|
simplify_gen_binary (enum rtx_code code, enum machine_mode mode, rtx op0,
|
|
|
|
|
rtx op1)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
|
|
|
|
rtx tem;
|
|
|
|
|
|
|
|
|
|
/* If this simplifies, do it. */
|
|
|
|
|
tem = simplify_binary_operation (code, mode, op0, op1);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
|
|
|
|
|
2006-01-07 23:23:27 +01:00
|
|
|
|
/* Put complex operands first and constants second if commutative. */
|
|
|
|
|
if (GET_RTX_CLASS (code) == RTX_COMM_ARITH
|
|
|
|
|
&& swap_commutative_operands_p (op0, op1))
|
|
|
|
|
tem = op0, op0 = op1, op1 = tem;
|
|
|
|
|
|
2002-03-07 00:07:08 +01:00
|
|
|
|
return gen_rtx_fmt_ee (code, mode, op0, op1);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-25 01:43:55 +02:00
|
|
|
|
/* If X is a MEM referencing the constant pool, return the real value.
|
2001-07-17 17:11:56 +02:00
|
|
|
|
Otherwise return X. */
|
2001-07-27 01:47:15 +02:00
|
|
|
|
rtx
|
2003-07-06 14:35:56 +02:00
|
|
|
|
avoid_constant_pool_reference (rtx x)
|
2001-07-17 17:11:56 +02:00
|
|
|
|
{
|
2003-02-03 20:40:58 +01:00
|
|
|
|
rtx c, tmp, addr;
|
2001-07-25 01:43:55 +02:00
|
|
|
|
enum machine_mode cmode;
|
2005-05-26 10:15:31 +02:00
|
|
|
|
HOST_WIDE_INT offset = 0;
|
2001-07-25 01:43:55 +02:00
|
|
|
|
|
2003-02-03 20:40:58 +01:00
|
|
|
|
switch (GET_CODE (x))
|
|
|
|
|
{
|
|
|
|
|
case MEM:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FLOAT_EXTEND:
|
|
|
|
|
/* Handle float extensions of constant pool references. */
|
|
|
|
|
tmp = XEXP (x, 0);
|
|
|
|
|
c = avoid_constant_pool_reference (tmp);
|
|
|
|
|
if (c != tmp && GET_CODE (c) == CONST_DOUBLE)
|
|
|
|
|
{
|
|
|
|
|
REAL_VALUE_TYPE d;
|
|
|
|
|
|
|
|
|
|
REAL_VALUE_FROM_CONST_DOUBLE (d, c);
|
|
|
|
|
return CONST_DOUBLE_FROM_REAL_VALUE (d, GET_MODE (x));
|
|
|
|
|
}
|
|
|
|
|
return x;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-09 18:56:04 +01:00
|
|
|
|
if (GET_MODE (x) == BLKmode)
|
|
|
|
|
return x;
|
|
|
|
|
|
2001-07-25 01:43:55 +02:00
|
|
|
|
addr = XEXP (x, 0);
|
|
|
|
|
|
2003-08-19 23:04:38 +02:00
|
|
|
|
/* Call target hook to avoid the effects of -fpic etc.... */
|
alias.c, [...]: Replace calls via (*targetm.foo) () with targetm.foo ().
* alias.c, attribs.c, bt-load.c, builtins.c, c-common.c,
c-decl.c, c-objc-common.c, c-typeck.c, calls.c, cfglayout.c,
cse.c, dbxout.c, dwarf2out.c, except.c, final.c,
haifa-sched.c, integrate.c, passes.c, rtlanal.c, sched-rgn.c,
sched-vis.c, simplify-rtx.c, stor-layout.c, tree.c, varasm.c,
vmsdbgout.c: Replace calls via (*targetm.foo) () with
targetm.foo ().
From-SVN: r79729
2004-03-20 05:52:59 +01:00
|
|
|
|
addr = targetm.delegitimize_address (addr);
|
2003-02-03 20:40:58 +01:00
|
|
|
|
|
2005-05-26 10:15:31 +02:00
|
|
|
|
/* Split the address into a base and integer offset. */
|
|
|
|
|
if (GET_CODE (addr) == CONST
|
|
|
|
|
&& GET_CODE (XEXP (addr, 0)) == PLUS
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (XEXP (addr, 0), 1)))
|
2005-05-26 10:15:31 +02:00
|
|
|
|
{
|
|
|
|
|
offset = INTVAL (XEXP (XEXP (addr, 0), 1));
|
|
|
|
|
addr = XEXP (XEXP (addr, 0), 0);
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-08 22:49:02 +02:00
|
|
|
|
if (GET_CODE (addr) == LO_SUM)
|
|
|
|
|
addr = XEXP (addr, 1);
|
|
|
|
|
|
2005-05-26 10:15:31 +02:00
|
|
|
|
/* If this is a constant pool reference, we can turn it into its
|
|
|
|
|
constant and hope that simplifications happen. */
|
|
|
|
|
if (GET_CODE (addr) == SYMBOL_REF
|
|
|
|
|
&& CONSTANT_POOL_ADDRESS_P (addr))
|
2001-07-25 01:43:55 +02:00
|
|
|
|
{
|
2005-05-26 10:15:31 +02:00
|
|
|
|
c = get_pool_constant (addr);
|
|
|
|
|
cmode = get_pool_mode (addr);
|
|
|
|
|
|
|
|
|
|
/* If we're accessing the constant in a different mode than it was
|
|
|
|
|
originally stored, attempt to fix that up via subreg simplifications.
|
|
|
|
|
If that fails we have no choice but to return the original memory. */
|
|
|
|
|
if (offset != 0 || cmode != GET_MODE (x))
|
|
|
|
|
{
|
|
|
|
|
rtx tem = simplify_subreg (GET_MODE (x), c, cmode, offset);
|
|
|
|
|
if (tem && CONSTANT_P (tem))
|
|
|
|
|
return tem;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return c;
|
2001-07-25 01:43:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-26 10:15:31 +02:00
|
|
|
|
return x;
|
2001-07-17 17:11:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
invoke.texi (-fvar-tracking-assignments): New.
gcc/ChangeLog:
* doc/invoke.texi (-fvar-tracking-assignments): New.
(-fvar-tracking-assignments-toggle): New.
(-fdump-final-insns=file): Mark filename as optional.
(--param min-nondebug-insn-uid): New.
(-gdwarf-@{version}): Mention version 4.
* opts.c (common_handle_option): Accept it.
* tree-vrp.c (find_assert_locations_1): Skip debug stmts.
* regrename.c (regrename_optimize): Drop last. Don't count debug
insns as uses. Don't reject change because of debug insn.
(do_replace): Reject DEBUG_INSN as chain starter. Take base_regno
from the chain starter, and check for inexact matches in
DEBUG_INSNS.
(scan_rtx_reg): Accept inexact matches in DEBUG_INSNs.
(build_def_use): Simplify and fix the marking of DEBUG_INSNs.
* sched-ebb.c (schedule_ebbs): Skip boundary debug insns.
* fwprop.c (forward_propagate_and_simplify): ...into debug insns.
* doc/gimple.texi (is_gimple_debug): New.
(gimple_debug_bind_p): New.
(is_gimple_call, gimple_assign_cast_p): End sentence with period.
* doc/install.texi (bootstrap-debug): More details.
(bootstrap-debug-big, bootstrap-debug-lean): Document.
(bootstrap-debug-lib): More details.
(bootstrap-debug-ckovw): Update.
(bootstrap-time): New.
* tree-into-ssa.c (mark_def_sites): Skip debug stmts.
(insert_phi_nodes_for): Insert debug stmts.
(rewrite_stmt): Take iterator. Insert debug stmts.
(rewrite_enter_block): Adjust.
(maybe_replace_use_in_debug_stmt): New.
(rewrite_update_stmt): Use it.
(mark_use_interesting): Return early for debug stmts.
* tree-ssa-loop-im.c (rewrite_bittest): Propagate DEFs into debug
stmts before replacing stmt.
(move_computations_stmt): Likewise.
* ira-conflicts.c (add_copies): Skip debug insns.
* regstat.c (regstat_init_n_sets_and_refs): Discount debug insns.
(regstat_bb_compute_ri): Skip debug insns.
* tree-ssa-threadupdate.c (redirection_block_p): Skip debug stmts.
* tree-ssa-loop-manip.c (find_uses_to_rename_stmt,
check_loop_closed_ssa_stmt): Skip debug stmts.
* tree-tailcall.c (find_tail_calls): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise.
* tree.h (MAY_HAVE_DEBUG_STMTS): New.
(build_var_debug_value_stat): Declare.
(build_var_debug_value): Define.
(target_for_debug_bind): Declare.
* reload.c (find_equiv_reg): Skip debug insns.
* rtlanal.c (reg_used_between_p): Skip debug insns.
(side_effects_p): Likewise.
(canonicalize_condition): Likewise.
* ddg.c (create_ddg_dep_from_intra_loop_link): Check that non-debug
insns never depend on debug insns.
(create_ddg_dep_no_link): Likewise.
(add_cross_iteration_register_deps): Use ANTI_DEP for debug insns.
Don't add inter-loop dependencies for debug insns.
(build_intra_loop_deps): Likewise.
(create_ddg): Count debug insns.
* ddg.h (struct ddg::num_debug): New.
(num_backargs): Pair up with previous int field.
* diagnostic.c (diagnostic_report_diagnostic): Skip notes on
-fcompare-debug-second.
* final.c (get_attr_length_1): Skip debug insns.
(rest_of_clean-state): Don't dump CFA_RESTORE_STATE.
* gcc.c (invoke_as): Call compare-debug-dump-opt.
(driver_self_specs): Map -fdump-final-insns to
-fdump-final-insns=..
(get_local_tick): New.
(compare_debug_dump_opt_spec_function): Test for . argument and
compute output name. Compute temp output spec without flag name.
Compute -frandom-seed.
(OPT): Undef after use.
* cfgloopanal.c (num_loop_insns): Skip debug insns.
(average_num_loop_insns): Likewise.
* params.h (MIN_NONDEBUG_INSN_UID): New.
* gimple.def (GIMPLE_DEBUG): New.
* ipa-reference.c (scan_stmt_for_static_refs): Skip debug stmts.
* auto-inc-dec.c (merge_in_block): Skip debug insns.
(merge_in_block): Fix whitespace.
* toplev.c (flag_var_tracking): Update comment.
(flag_var_tracking_assignments): New.
(flag_var_tracking_assignments_toggle): New.
(process_options): Don't open final insns dump file if we're not
going to write to it. Compute defaults for var_tracking.
* df-scan.c (df_insn_rescan_debug_internal): New.
(df_uses_record): Handle debug insns.
* haifa-sched.c (ready): Initialize n_debug.
(contributes_to_priority): Skip debug insns.
(dep_list_size): New.
(priority): Use it.
(rank_for_schedule): Likewise. Schedule debug insns as soon as
they're ready. Disregard previous debug insns to make decisions.
(queue_insn): Never queue debug insns.
(ready_add, ready_remove_first, ready_remove): Count debug insns.
(schedule_insn): Don't reject debug insns because of issue rate.
(get_ebb_head_tail, no_real_insns_p): Skip boundary debug insns.
(queue_to_ready): Skip and discount debug insns.
(choose_ready): Let debug insns through.
(schedule_block): Check boundary debug insns. Discount debug
insns, schedule them early. Adjust whitespace.
(set_priorities): Check for boundary debug insns.
(add_jump_dependencies): Use dep_list_size.
(prev_non_location_insn): New.
(check_cfg): Use it.
* tree-ssa-loop-ivopts.c (find-interesting_users): Skip debug
stmts.
(remove_unused_ivs): Reset debug stmts.
* modulo-sched.c (const_iteration_count): Skip debug insns.
(res_MII): Discount debug insns.
(loop_single_full_bb_p): Skip debug insns.
(sms_schedule): Likewise.
(sms_schedule_by_order): Likewise.
(ps_has_conflicts): Likewise.
* caller-save.c (refmarker_fn): New.
(save_call_clobbered_regs): Replace regs with saved mem in
debug insns.
(mark_referenced_regs): Take pointer, mark and arg. Adjust.
Call refmarker_fn mark for hardregnos.
(mark_reg_as_referenced): New.
(replace_reg_with_saved_mem): New.
* ipa-pure-const.c (check_stmt): Skip debug stmts.
* cse.c (cse_insn): Canonicalize debug insns. Skip them when
searching back.
(cse_extended_basic_block): Skip debug insns.
(count_reg_usage): Likewise.
(is_dead_reg): New, split out of...
(set_live_p): ... here.
(insn_live_p): Use it for debug insns.
* tree-stdarg.c (check_all_va_list_escapes): Skip debug stmts.
(execute_optimize_stdarg): Likewise.
* tree-ssa-dom.c (propagate_rhs_into_lhs): Likewise.
* tree-ssa-propagate.c (substitute_and_fold): Don't regard
changes in debug stmts as changes.
* sel-sched.c (moving_insn_creates_bookkeeping_block_p): New.
(moveup_expr): Don't move across debug insns. Don't move
debug insn if it would create a bookkeeping block.
(moveup_expr_cached): Don't use cache for debug insns that
are heads of blocks.
(compute_av_set_inside_bb): Skip debug insns.
(sel_rank_for_schedule): Schedule debug insns first. Remove
dead code.
(block_valid_for_bookkeeping_p); Support lax searches.
(create_block_for_bookkeeping): Adjust block numbers when
encountering debug-only blocks.
(find_place_for_bookkeeping): Deal with debug-only blocks.
(generate_bookkeeping_insn): Accept no place to insert.
(remove_temp_moveop_nops): New argument full_tidying.
(prepare_place_to_insert): Deal with debug insns.
(advance_state_on_fence): Debug insns don't start cycles.
(update_boundaries): Take fence as argument. Deal with
debug insns.
(schedule_expr_on_boundary): No full_tidying on debug insns.
(fill_insns): Deal with debug insns.
(track_scheduled_insns_and_blocks): Don't count debug insns.
(need_nop_to_preserve_insn_bb): New, split out of...
(remove_insn_from_stream): ... this.
(fur_orig_expr_not_found): Skip debug insns.
* rtl.def (VALUE): Move up.
(DEBUG_INSN): New.
* tree-ssa-sink.c (all_immediate_uses_same_place): Skip debug
stmts.
(nearest_common_dominator_of_uses): Take debug_stmts argument.
Set it if debug stmts are found.
(statement_sink_location): Skip debug stmts. Propagate
moving defs into debug stmts.
* ifcvt.c (first_active_insn): Skip debug insns.
(last_active_insns): Likewise.
(cond_exec_process_insns): Likewise.
(noce_process_if_block): Likewise.
(check_cond_move_block): Likewise.
(cond_move_convert_if_block): Likewise.
(block_jumps_and_fallthru_p): Likewise.
(dead_or_predicable): Likewise.
* dwarf2out.c (debug_str_hash_forced): New.
(find_AT_string): Add comment.
(gen_label_for_indirect_string): New.
(get_debug_string_label): New.
(AT_string_form): Use it.
(mem_loc_descriptor): Handle non-TLS symbols. Handle MINUS , DIV,
MOD, AND, IOR, XOR, NOT, ABS, NEG, and CONST_STRING. Accept but
discard COMPARE, IF_THEN_ELSE, ROTATE, ROTATERT, TRUNCATE and
several operations that cannot be represented with DWARF opcodes.
(loc_descriptor): Ignore SIGN_EXTEND and ZERO_EXTEND. Require
dwarf_version 4 for DW_OP_implicit_value and DW_OP_stack_value.
(dwarf2out_var_location): Take during-call mark into account.
(output_indirect_string): Update comment. Output if there are
label and references.
(prune_indirect_string): New.
(prune_unused_types): Call it if debug_str_hash_forced.
More in dwarf2out.c, from Jakub Jelinek <jakub@redhat.com>:
(dw_long_long_const): Remove.
(struct dw_val_struct): Change val_long_long type to rtx.
(print_die, attr_checksum, same_dw_val_p, loc_descriptor): Adjust for
val_long_long change to CONST_DOUBLE rtx from a long hi/lo pair.
(output_die): Likewise. Use HOST_BITS_PER_WIDE_INT size of each
component instead of HOST_BITS_PER_LONG.
(output_loc_operands): Likewise. For const8* assert
HOST_BITS_PER_WIDE_INT rather than HOST_BITS_PER_LONG is >= 64.
(output_loc_operands_raw): For const8* assert HOST_BITS_PER_WIDE_INT
rather than HOST_BITS_PER_LONG is >= 64.
(add_AT_long_long): Remove val_hi and val_lo arguments, add
val_const_double.
(size_of_die): Use HOST_BITS_PER_WIDE_INT size multiplier instead of
HOST_BITS_PER_LONG for dw_val_class_long_long.
(add_const_value_attribute): Adjust add_AT_long_long caller. Don't
handle TLS SYMBOL_REFs. If CONST wraps a constant, tail recurse.
(dwarf_stack_op_name): Handle DW_OP_implicit_value and
DW_OP_stack_value.
(size_of_loc_descr, output_loc_operands, output_loc_operands_raw):
Handle DW_OP_implicit_value.
(extract_int): Move prototype earlier.
(mem_loc_descriptor): For SUBREG punt if inner
mode size is wider than DWARF2_ADDR_SIZE. Handle SIGN_EXTEND
and ZERO_EXTEND by DW_OP_shl and DW_OP_shr{a,}. Handle
EQ, NE, GT, GE, LT, LE, GTU, GEU, LTU, LEU, SMIN, SMAX, UMIN,
UMAX, SIGN_EXTRACT, ZERO_EXTRACT.
(loc_descriptor): Compare mode size with DWARF2_ADDR_SIZE
instead of Pmode size.
(loc_descriptor): Add MODE argument. Handle CONST_INT, CONST_DOUBLE,
CONST_VECTOR, CONST, LABEL_REF and SYMBOL_REF if mode != VOIDmode,
attempt to handle other expressions. Don't handle TLS SYMBOL_REFs.
(concat_loc_descriptor, concatn_loc_descriptor,
loc_descriptor_from_tree_1): Adjust loc_descriptor callers.
(add_location_or_const_value_attribute): Likewise. For single
location loc_lists attempt to use add_const_value_attribute
for constant decls. Add DW_AT_const_value even if
NOTE_VAR_LOCATION is VAR_LOCATION with CONSTANT_P or CONST_STRING
in its expression.
* cfgbuild.c (inside_basic_block_p): Handle debug insns.
(control_flow_insn_p): Likewise.
* tree-parloops.c (eliminate_local_variables_stmt): Handle debug
stmt.
(separate_decls_in_region_debug_bind): New.
(separate_decls_in_region): Process debug bind stmts afterwards.
* recog.c (verify_changes): Handle debug insns.
(extract_insn): Likewise.
(peephole2_optimize): Skip debug insns.
* dse.c (scan_insn): Skip debug insns.
* sel-sched-ir.c (return_nop_to_pool): Take full_tidying argument.
Pass it on.
(setup_id_for_insn): Handle debug insns.
(maybe_tidy_empty_bb): Adjust whitespace.
(tidy_control_flow): Skip debug insns.
(sel_remove_insn): Adjust for debug insns.
(sel_estimate_number_of_insns): Skip debug insns.
(create_insn_rtx_from_pattern): Handle debug insns.
(create_copy_of_insn_rtx): Likewise.
* sel-sched-.h (sel_bb_end): Declare.
(sel_bb_empty_or_nop_p): New.
(get_all_loop_exits): Use it.
(_eligible_successor_edge_p): Likewise.
(return_nop_to_pool): Adjust.
* tree-eh.c (tre_empty_eh_handler_p): Skip debug stmts.
* ira-lives.c (process_bb_node_lives): Skip debug insns.
* gimple-pretty-print.c (dump_gimple_debug): New.
(dump_gimple_stmt): Use it.
(dump_bb_header): Skip gimple debug stmts.
* regmove.c (optimize_reg_copy_1): Discount debug insns.
(fixup_match_2): Likewise.
(regmove_backward_pass): Likewise. Simplify combined
replacement. Handle debug insns.
* function.c (instantiate_virtual_regs): Handle debug insns.
* function.h (struct emit_status): Add x_cur_debug_insn_uid.
* print-rtl.h: Include cselib.h.
(print_rtx): Print VALUEs. Split out and recurse for
VAR_LOCATIONs.
* df.h (df_inns_rescan_debug_internal): Declare.
* gcse.c (alloc_hash_table): Estimate n_insns.
(cprop_insn): Don't regard debug insns as changes.
(bypass_conditional_jumps): Skip debug insns.
(one_pre_gcse_pass): Adjust.
(one_code_hoisting_pass): Likewise.
(compute_ld_motion_mems): Skip debug insns.
(one_cprop_pass): Adjust.
* tree-if-conv.c (tree_if_convert_stmt): Reset debug stmts.
(if_convertible_stmt_p): Handle debug stmts.
* init-regs.c (initialize_uninitialized_regs): Skip debug insns.
* tree-vect-loop.c (vect_is_simple_reduction): Skip debug stmts.
* ira-build.c (create_bb_allocnos): Skip debug insns.
* tree-flow-inline.h (has_zero_uses): Discount debug stmts.
(has_single_use): Likewise.
(single_imm_use): Likewise.
(num_imm_uses): Likewise.
* tree-ssa-phiopt.c (empty_block_p): Skip debug stmts.
* tree-ssa-coalesce.c (build_ssa_conflict_graph): Skip debug stmts.
(create_outofssa_var_map): Likewise.
* lower-subreg.c (adjust_decomposed_uses): New.
(resolve_debug): New.
(decompose_multiword_subregs): Use it.
* tree-dfa.c (find_referenced_vars): Skip debug stmts.
* emit-rtl.c: Include params.h.
(cur_debug_insn_uid): Define.
(set_new_first_and_last_insn): Set cur_debug_insn_uid too.
(copy_rtx_if_shared_1): Handle debug insns.
(reset_used_flags): Likewise.
(set_used_flags): LIkewise.
(get_max_insn_count): New.
(next_nondebug_insn): New.
(prev_nondebug_insn): New.
(make_debug_insn_raw): New.
(emit_insn_before_noloc): Handle debug insns.
(emit_jump_insn_before_noloc): Likewise.
(emit_call_insn_before_noloc): Likewise.
(emit_debug_insn_before_noloc): New.
(emit_insn_after_noloc): Handle debug insns.
(emit_jump_insn_after_noloc): Likewise.
(emit_call_insn_after_noloc): Likewise.
(emit_debug_insn_after_noloc): Likewise.
(emit_insn_after): Take loc from earlier non-debug insn.
(emit_jump_insn_after): Likewise.
(emit_call_insn_after): Likewise.
(emit_debug_insn_after_setloc): New.
(emit_debug_insn_after): New.
(emit_insn_before): Take loc from later non-debug insn.
(emit_jump_insn_before): Likewise.
(emit_call_insn_before): Likewise.
(emit_debug_insn_before_setloc): New.
(emit_debug_insn_before): New.
(emit_insn): Handle debug insns.
(emit_debug_insn): New.
(emit_jump_insn): Handle debug insns.
(emit_call_insn): Likewise.
(emit): Likewise.
(init_emit): Take min-nondebug-insn-uid into account.
Initialize cur_debug_insn_uid.
(emit_copy_of_insn_after): Handle debug insns.
* cfgexpand.c (gimple_assign_rhs_to_tree): Do not overwrite
location of single rhs in place.
(maybe_dump_rtl_for_gimple_stmt): Dump lineno.
(floor_sdiv_adjust): New.
(cell_sdiv_adjust): New.
(cell_udiv_adjust): New.
(round_sdiv_adjust): New.
(round_udiv_adjust): New.
(wrap_constant): Moved from cselib.
(unwrap_constant): New.
(expand_debug_expr): New.
(expand_debug_locations): New.
(expand_gimple_basic_block): Drop hiding redeclaration. Expand
debug bind stmts.
(gimple_expand_cfg): Expand debug locations.
* cselib.c: Include tree-pass.h.
(struct expand_value_data): New.
(cselib_record_sets_hook): New.
(PRESERVED_VALUE_P, LONG_TERM_PRESERVED_VALUE_P): New.
(cselib_clear_table): Move, and implemnet in terms of...
(cselib_reset_table_with_next_value): ... this.
(cselib_get_next_unknown_value): New.
(discard_useless_locs): Don't discard preserved values.
(cselib_preserve_value): New.
(cselib_preserved_value_p): New.
(cselib_preserve_definitely): New.
(cselib_clear_preserve): New.
(cselib_preserve_only_values): New.
(new_cselib_val): Take rtx argument. Dump it in details.
(cselib_lookup_mem): Adjust.
(expand_loc): Take regs_active in struct. Adjust. Silence
dumps unless details are requested.
(cselib_expand_value_rtx_cb): New.
(cselib_expand_value_rtx): Rename and reimplment in terms of...
(cselib_expand_value_rtx_1): ... this. Adjust. Silence dumps
without details. Copy more subregs. Try to resolve values
using a callback. Wrap constants.
(cselib_subst_to_values): Adjust.
(cselib_log_lookup): New.
(cselib_lookup): Call it.
(cselib_invalidate_regno): Don't count preserved values as
useless.
(cselib_invalidate_mem): Likewise.
(cselib_record_set): Likewise.
(struct set): Renamed to cselib_set, moved to cselib.h.
(cselib_record_sets): Adjust. Call hook.
(cselib_process_insn): Reset table when it would be cleared.
(dump_cselib_val): New.
(dump_cselib_table): New.
* tree-cfgcleanup.c (tree_forwarded_block_p): Skip debug stmts.
(remove_forwarder_block): Support moving debug stmts.
* cselib.h (cselib_record_sets_hook): Declare.
(cselib_expand_callback): New type.
(cselib_expand_value_rtx_cb): Declare.
(cselib_reset_table_with_next_value): Declare.
(cselib_get_next_unknown_value): Declare.
(cselib_preserve_value): Declare.
(cselib_preserved_value_p): Declare.
(cselib_preserve_only_values): Declare.
(dump_cselib_table): Declare.
* cfgcleanup.c (flow_find_cross_jump): Skip debug insns.
(try_crossjump_to_edge): Likewise.
(delete_unreachable_blocks): Remove dominant GIMPLE blocks after
dominated blocks when debug stmts are present.
* simplify-rtx.c (delegitimize_mem_from_attrs): New.
* tree-ssa-live.c (remove_unused_locals): Skip debug stmts.
(set_var_live_on_entry): Likewise.
* loop-invariant.c (find_invariants_bb): Skip debug insns.
* cfglayout.c (curr_location, last_location): Make static.
(set_curr_insn_source_location): Don't avoid bouncing.
(get_curr_insn_source_location): New.
(get_curr_insn_block): New.
(duplicate_insn_chain): Handle debug insns.
* tree-ssa-forwprop.c (forward_propagate_addr_expr): Propagate
into debug stmts.
* common.opt (fcompare-debug): Move to sort order.
(fdump-unnumbered-links): Likewise.
(fvar-tracking-assignments): New.
(fvar-tracking-assignments-toggle): New.
* tree-ssa-dce.c (mark_stmt_necessary): Don't mark blocks
because of debug stmts.
(mark_stmt_if_obviously_necessary): Mark debug stmts.
(eliminate_unnecessary_stmts): Walk dominated blocks before
dominators.
* tree-ssa-ter.c (find_replaceable_in_bb): Skip debug stmts.
* ira.c (memref_used_between_p): Skip debug insns.
(update_equiv_regs): Likewise.
* sched-deps.c (sd_lists_size): Accept empty list.
(sd_init_insn): Mark debug insns.
(sd_finish_insn): Unmark them.
(sd_add_dep): Reject non-debug deps on debug insns.
(fixup_sched_groups): Give debug insns group treatment.
Skip debug insns.
(sched_analyze_reg): Don't mark debug insns for sched before call.
(sched_analyze_2): Handle debug insns.
(sched_analyze_insn): Compute next non-debug insn. Handle debug
insns.
(deps_analyze_insn): Handle debug insns.
(deps_start_bb): Skip debug insns.
(init_deps): Initialize last_debug_insn.
* tree-ssa.c (target_for_debug_bind): New.
(find_released_ssa_name): New.
(propagate_var_def_into_debug_stmts): New.
(propagate_defs_into_debug_stmts): New.
(verify_ssa): Skip debug bind stmts without values.
(warn_uninialized_vars): Skip debug stmts.
* target-def.h (TARGET_DELEGITIMIZE_ADDRESS): Set default.
* rtl.c (rtx_equal_p_cb): Handle VALUEs.
(rtx_equal_p): Likewise.
* ira-costs.c (scan_one_insn): Skip debug insns.
(process_bb_node_for_hard_reg_moves): Likewise.
* rtl.h (DEBUG_INSN_P): New.
(NONDEBUG_INSN_P): New.
(MAY_HAVE_DEBUG_INSNS): New.
(INSN_P): Accept debug insns.
(RTX_FRAME_RELATED_P): Likewise.
(INSN_DELETED_P): Likewise
(PAT_VAR_LOCATION_DECL): New.
(PAT_VAR_LOCATION_LOC): New.
(PAT_VAR_OCATION_STATUS): New.
(NOTE_VAR_LOCATION_DECL): Reimplement.
(NOTE_VAR_LOCATION_LOC): Likewise.
(NOTE_VAR_LOCATION_STATUS): Likewise.
(INSN_VAR_LOCATION): New.
(INSN_VAR_LOCATION_DECL): New.
(INSN_VAR_LOCATION_LOC): New.
(INSN_VAR_LOCATION_STATUS): New.
(gen_rtx_UNKNOWN_VAR_LOC): New.
(VAR_LOC_UNKNOWN_P): New.
(NOTE_DURING_CALL_P): New.
(SCHED_GROUP_P): Accept debug insns.
(emit_debug_insn_before): Declare.
(emit_debug_insn_before_noloc): Declare.
(emit_debug_insn_beore_setloc): Declare.
(emit_debug_insn_after): Declare.
(emit_debug_insn_after_noloc): Declare.
(emit_debug_insn_after_setloc): Declare.
(emit_debug_insn): Declare.
(make_debug_insn_raw): Declare.
(prev_nondebug_insn): Declare.
(next_nondebug_insn): Declare.
(delegitimize_mem_from_attrs): Declare.
(get_max_insn_count): Declare.
(wrap_constant): Declare.
(unwrap_constant): Declare.
(get_curr_insn_source_location): Declare.
(get_curr_insn_block): Declare.
* tree-inline.c (insert_debug_decl_map): New.
(processing_debug_stmt): New.
(remap_decl): Don't create new mappings in debug stmts.
(remap_gimple_op_r): Don't add references in debug stmts.
(copy_tree_body_r): Likewise.
(remap_gimple_stmt): Handle debug bind stmts.
(copy_bb): Skip debug stmts.
(copy_edges_for_bb): Likewise.
(copy_debug_stmt): New.
(copy_debug_stmts): New.
(copy_body): Copy debug stmts at the end.
(insert_init_debug_bind): New.
(insert_init_stmt): Take id. Skip and emit debug stmts.
(setup_one_parameter): Remap variable earlier, register debug
mapping.
(estimate_num_insns): Skip debug stmts.
(expand_call_inline): Preserve debug_map.
(optimize_inline_calls): Check for no debug_stmts left-overs.
(unsave_expr_now): Preserve debug_map.
(copy_gimple_seq_and_replace_locals): Likewise.
(tree_function_versioning): Check for no debug_stmts left-overs.
Init and destroy debug_map as needed. Split edges unconditionally.
(build_duplicate_type): Init and destroy debug_map as needed.
* tree-inline.h: Include gimple.h instead of pointer-set.h.
(struct copy_body_data): Add debug_stmts and debug_map.
* sched-int.h (struct ready_list): Add n_debug.
(struct deps): Add last_debug_insn.
(DEBUG_INSN_SCHED_P): New.
(BOUNDARY_DEBUG_INSN_P): New.
(SCHEDULE_DEBUG_INSN_P): New.
(sd_iterator_cond): Accept empty list.
* combine.c (create_log_links): Skip debug insns.
(combine_instructions): Likewise.
(cleanup_auto_inc_dec): New. From Jakub Jelinek: Make sure the
return value is always unshared.
(struct rtx_subst_pair): New.
(auto_adjust_pair): New.
(propagate_for_debug_subst): New.
(propagate_for_debug): New.
(try_combine): Skip debug insns. Propagate removed defs into
debug insns.
(next_nonnote_nondebug_insn): New.
(distribute_notes): Use it. Skip debug insns.
(distribute_links): Skip debug insns.
* tree-outof-ssa.c (set_location_for_edge): Likewise.
* resource.c (mark_target_live_regs): Likewise.
* var-tracking.c: Include cselib.h and target.h.
(enum micro_operation_type): Add MO_VAL_USE, MO_VAL_LOC, and
MO_VAL_SET.
(micro_operation_type_name): New.
(enum emit_note_where): Add EMIT_NOTE_AFTER_CALL_INSN.
(struct micro_operation_def): Update comments.
(decl_or_value): New type. Use instead of decls.
(struct emit_note_data_def): Add vars.
(struct attrs_def): Use decl_or_value.
(struct variable_tracking_info_def): Add permp, flooded.
(struct location_chain_def): Update comment.
(struct variable_part_def): Use decl_or_value.
(struct variable_def): Make var_part a variable length array.
(valvar_pool): New.
(scratch_regs): New.
(cselib_hook_called): New.
(dv_is_decl_p): New.
(dv_is_value_p): New.
(dv_as_decl): New.
(dv_as_value): New.
(dv_as_opaque): New.
(dv_onepart_p): New.
(dv_pool): New.
(IS_DECL_CODE): New.
(check_value_is_not_decl): New.
(dv_from_decl): New.
(dv_from_value): New.
(dv_htab_hash): New.
(variable_htab_hash): Use it.
(variable_htab_eq): Support values.
(variable_htab_free): Free from the right pool.
(attrs_list_member, attrs_list_insert): Use decl_or_value.
(attrs_list_union): Adjust.
(attrs_list_mpdv_union): New.
(tie_break_pointers): New.
(canon_value_cmp): New.
(unshare_variable): Return possibly-modified slot.
(vars_copy_1): Adjust.
(var_reg_decl_set): Adjust. Split out of...
(var_reg_set): ... this.
(get_init_value): Adjust.
(var_reg_delete_and_set): Adjust.
(var_reg_delete): Adjust.
(var_regno_delete): Adjust.
(var_mem_decl_set): Split out of...
(var_mem_set): ... this.
(var_mem_delete_and_set): Adjust.
(var_mem_delete): Adjust.
(val_store): New.
(val_reset): New.
(val_resolve): New.
(variable_union): Adjust. Speed up merge of 1-part vars.
(variable_canonicalize): Use unshared slot.
(VALUED_RECURSED_INTO): New.
(find_loc_in_1pdv): New.
(struct dfset_merge): New.
(insert_into_intersection): New.
(intersect_loc_chains): New.
(loc_cmp): New.
(canonicalize_loc_order_check): New.
(canonicalize_values_mark): New.
(canonicalize_values_star): New.
(variable_merge_over_cur): New.
(variable_merge_over_src): New.
(dataflow_set_merge): New.
(dataflow_set_equiv_regs): New.
(remove_duplicate_values): New.
(struct dfset_post_merge): New.
(variable_post_merge_new_vals): New.
(variable_post_merge_perm_vals): New.
(dataflow_post_merge_adjust): New.
(find_mem_expr_in_1pdv): New.
(dataflow_set_preserve_mem_locs): New.
(dataflow_set_remove_mem_locs): New.
(dataflow_set_clear_at_call): New.
(onepart_variable_different_p): New.
(variable_different_p): Use it.
(dataflow_set_different_1): Adjust. Make detailed dump
more verbose.
(track_expr_p): Add need_rtl parameter. Don't generate rtl
if not needed.
(track_loc_p): Pass it true.
(struct count_use_info): New.
(find_use_val): New.
(replace_expr_with_values): New.
(log_op_type): New.
(use_type): New, partially split out of...
(count_uses): ... this. Count new micro-ops.
(count_uses_1): Adjust.
(count_stores): Adjust.
(count_with_sets): New.
(VAL_NEEDS_RESOLUTION): New.
(VAL_HOLDS_TRACK_EXPR): New.
(VAL_EXPR_IS_COPIED): New.
(VAL_EXPR_IS_CLOBBERED): New.
(add_uses): Adjust. Generate new micro-ops.
(add_uses_1): Adjust.
(add_stores): Generate new micro-ops.
(add_with_sets): New.
(find_src_status): Adjust.
(find_src_set_src): Adjust.
(compute_bb_dataflow): Use dataflow_set_clear_at_call.
Handle new micro-ops. Canonicalize value equivalances.
(vt_find_locations): Compute total size of hash tables for
dumping. Perform merge for var-tracking-assignments. Don't
disregard single-block loops.
(dump_attrs_list): Handle decl_or_value.
(dump_variable): Take variable. Deal with decl_or_value.
(dump_variable_slot): New.
(dump_vars): Use it.
(dump_dataflow_sets): Adjust.
(set_slot_part): New, extended to support one-part variables
after splitting out of...
(set_variable_part): ... this.
(clobber_slot_part): New, split out of...
(clobber_variable_part): ... this.
(delete_slot_part): New, split out of...
(delete_variable_part): .... this.
(check_wrap_constant): New.
(vt_expand_loc_callback): New.
(vt_expand_loc): New.
(emit_note_insn_var_location): Adjust. Handle values. Handle
EMIT_NOTE_AFTER_CALL_INSN.
(emit_notes_for_differences_1): Adjust. Handle values.
(emit_notes_for_differences_2): Likewise.
(emit_notes_for_differences): Adjust.
(emit_notes_in_bb): Take pointer to set. Emit AFTER_CALL_INSN
notes. Adjust. Handle new micro-ops.
(vt_add_function_parameters): Adjust. Create and bind values.
(vt_initialize): Adjust. Initialize scratch_regs and
valvar_pool, flooded and perm.. Initialize and use cselib. Log
operations. Move some code to count_with_sets and add_with_sets.
(delete_debug_insns): New.
(vt_debug_insns_local): New.
(vt_finalize): Release permp, valvar_pool, scratch_regs. Finish
cselib.
(var_tracking_main): If var-tracking-assignments is enabled
but var-tracking isn't, delete debug insns and leave. Likewise
if we exceed limits or fail the stack adjustments tests, and
after all var-tracking processing.
More in var-tracking, from Jakub Jelinek <jakub@redhat.com>:
(dataflow_set): Add traversed_vars.
(value_chain, const_value_chain): New typedefs.
(value_chain_pool, value_chains): New variables.
(value_chain_htab_hash, value_chain_htab_eq, add_value_chain,
add_value_chains, add_cselib_value_chains, remove_value_chain,
remove_value_chains, remove_cselib_value_chains): New functions.
(shared_hash_find_slot_unshare_1, shared_hash_find_slot_1,
shared_hash_find_slot_noinsert_1, shared_hash_find_1): New
static inlines.
(shared_hash_find_slot_unshare, shared_hash_find_slot,
shared_hash_find_slot_noinsert, shared_hash_find): Update.
(dst_can_be_shared): New variable.
(unshare_variable): Unshare set->vars if shared, use shared_hash_*.
Clear dst_can_be_shared. If set->traversed_vars is non-NULL and
different from set->vars, look up slot again instead of using the
passed in slot.
(dataflow_set_init): Initialize traversed_vars.
(variable_union): Use shared_hash_*. Use initially NO_INSERT
lookup if set->vars is shared. Don't keep slot cleared before
calling unshare_variable. Unshare set->vars if needed. Adjust
unshare_variable callers. Clear dst_can_be_shared if needed.
Even ->refcount == 1 vars must be unshared if set->vars is shared
and var needs to be modified.
(dataflow_set_union): Set traversed_vars during canonicalization.
(VALUE_CHANGED, DECL_CHANGED): Define.
(set_dv_changed, dv_changed_p): New static inlines.
(track_expr_p): Clear DECL_CHANGED.
(dump_dataflow_sets): Set it.
(variable_was_changed): Call set_dv_changed.
(emit_note_insn_var_location): Likewise.
(changed_variables_stack): New variable.
(check_changed_vars_1, check_changed_vars_2): New functions.
(emit_notes_for_changes): Do nothing if changed_variables is
empty. Traverse changed_variables with check_changed_vars_1,
call check_changed_vars_2 on each changed_variables_stack entry.
(emit_notes_in_bb): Add SET argument. Just clear it at the
beginning, use it instead of local &set, don't destroy it at the
end.
(vt_emit_notes): Call dataflow_set_clear early on all
VTI(bb)->out sets, never use them, instead use emit_notes_in_bb
computed set, dataflow_set_clear also VTI(bb)->in when we are
done with the basic block. Initialize changed_variables_stack,
free it afterwards. If ENABLE_CHECKING verify that after noting
differences to an empty set value_chains hash table is empty.
(vt_initialize): Initialize value_chains and value_chain_pool.
(vt_finalize): Delete value_chains htab, free value_chain_pool.
(variable_tracking_main): Call dump_dataflow_sets before calling
vt_emit_notes, not after it.
* tree-flow.h (propagate_defs_into_debug_stmts): Declare.
(propagate_var_def_into_debug_stmts): Declare.
* df-problems.c (df_lr_bb_local_compute): Skip debug insns.
(df_set_note): Reject debug insns.
(df_whole_mw_reg_dead_p): Take added_notes_p argument. Don't
add notes to debug insns.
(df_note_bb_compute): Adjust. Likewise.
(df_simulate_uses): Skip debug insns.
(df_simulate_initialize_backwards): Likewise.
* reg-stack.c (subst_stack_regs_in_debug_insn): New.
(subst_stack_regs_pat): Reject debug insns.
(convert_regs_1): Handle debug insns.
* Makefile.in (TREE_INLINE_H): Take pointer-set.h from GIMPLE_H.
(print-rtl.o): Depend on cselib.h.
(cselib.o): Depend on TREE_PASS_H.
(var-tracking.o): Depend on cselib.h and TARGET_H.
* sched-rgn.c (rgn_estimate_number_of_insns): Discount
debug insns.
(init_ready_list): Skip boundary debug insns.
(add_branch_dependences): Skip debug insns.
(free_block_dependencies): Check for blocks with only debug
insns.
(compute_priorities): Likewise.
* gimple.c (gss_for_code): Handle GIMPLE_DEBUG.
(gimple_build_with_ops_stat): Take subcode as unsigned. Adjust
all callers.
(gimple_build_debug_bind_stat): New.
(empty_body_p): Skip debug stmts.
(gimple_has_side_effects): Likewise.
(gimple_rhs_has_side_effects): Likewise.
* gimple.h (enum gimple_debug_subcode, GIMPLE_DEBUG_BIND): New.
(gimple_build_debug_bind_stat): Declare.
(gimple_build_debug_bind): Define.
(is_gimple_debug): New.
(gimple_debug_bind_p): New.
(gimple_debug_bind_get_var): New.
(gimple_debug_bind_get_value): New.
(gimple_debug_bind_get_value_ptr): New.
(gimple_debug_bind_set_var): New.
(gimple_debug_bind_set_value): New.
(GIMPLE_DEBUG_BIND_NOVALUE): New internal temporary macro.
(gimple_debug_bind_reset_value): New.
(gimple_debug_bind_has_value_p): New.
(gsi_next_nondebug): New.
(gsi_prev_nondebug): New.
(gsi_start_nondebug_bb): New.
(gsi_last_nondebug_bb): New.
* sched-vis.c (print_pattern): Handle VAR_LOCATION.
(print_insn): Handle DEBUG_INSN.
* tree-cfg.c (remove_bb): Walk stmts backwards. Let loc
of first insn prevail.
(first_stmt): Skip debug stmts.
(first_non_label_stmt): Likewise.
(last_stmt): Likewise.
(has_zero_uses_1): New.
(single_imm_use_1): New.
(verify_gimple_debug): New.
(verify_types_in_gimple_stmt): Handle debug stmts.
(verify_stmt): Likewise.
(debug_loop_num): Skip debug stmts.
(remove_edge_and_dominated_blocks): Remove dominators last.
* tree-ssa-reasssoc.c (rewrite_expr_tree): Propagate into
debug stmts.
(linearize_expr): Likewise.
* config/i386/i386.c (ix86_delegitimize_address): Call
default implementation.
* config/ia64/ia64.c (ia64_safe_itanium_class): Handle debug
insns.
(group_barrier_needed): Skip debug insns.
(emit_insn_group_barriers): Likewise.
(emit_all_insn_group_barriers): Likewise.
(ia64_variable_issue): Handle debug insns.
(ia64_dfa_new_cycle): Likewise.
(final_emit_insn_group_barriers): Skip debug insns.
(ia64_dwarf2out_def_steady_cfa): Take frame argument. Don't
def cfa without frame.
(process_set): Likewise.
(process_for_unwind_directive): Pass frame on.
* config/rs6000/rs6000.c (TARGET_DELEGITIMIZE_ADDRESS): Define.
(rs6000_delegitimize_address): New.
(rs6000_debug_adjust_cost): Handle debug insns.
(is_microcoded_insn): Likewise.
(is_cracked_insn): Likewise.
(is_nonpipeline_insn): Likewise.
(insn_must_be_first_in_group): Likewise.
(insn_must_be_last_in_group): Likewise.
(force_new_group): Likewise.
* cfgrtl.c (rtl_split_block): Emit INSN_DELETED note if block
contains only debug insns.
(rtl_merge_blocks): Skip debug insns.
(purge_dead_edges): Likewise.
(rtl_block_ends_with_call_p): Skip debug insns.
* dce.c (deletable_insn_p): Handle VAR_LOCATION.
(mark_reg_dependencies): Skip debug insns.
* params.def (PARAM_MIN_NONDEBUG_INSN_UID): New.
* tree-ssanames.c (release_ssa_name): Propagate def into
debug stmts.
* tree-ssa-threadedge.c
(record_temporary_equivalences_from_stmts): Skip debug stmts.
* regcprop.c (replace_oldest_value_addr): Skip debug insns.
(replace_oldest_value_mem): Use ALL_REGS for debug insns.
(copyprop_hardreg_forward_1): Handle debug insns.
* reload1.c (reload): Skip debug insns. Replace unassigned
pseudos in debug insns with their equivalences.
(eliminate_regs_in_insn): Skip debug insns.
(emit_input_reload_insns): Skip debug insns at first, adjust
them later.
* tree-ssa-operands.c (add_virtual_operand): Reject debug stmts.
(get_indirect_ref_operands): Pass opf_no_vops on.
(get_expr_operands): Likewise. Skip debug stmts.
(parse_ssa_operands): Scan debug insns with opf_no_vops.
gcc/testsuite/ChangeLog:
* gcc.dg/guality/guality.c: New.
* gcc.dg/guality/guality.h: New.
* gcc.dg/guality/guality.exp: New.
* gcc.dg/guality/example.c: New.
* lib/gcc-dg.exp (cleanup-dump): Remove .gk files.
(cleanup-saved-temps): Likewise, .gkd files too.
gcc/cp/ChangeLog:
* cp-tree.h (TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS): New.
* cp-lang.c (cxx_dwarf_name): Pass it.
* error.c (count_non_default_template_args): Take flags as
argument. Adjust all callers. Skip counting of default
arguments if the new flag is given.
ChangeLog:
* Makefile.tpl (BUILD_CONFIG): Default to bootstrap-debug.
* Makefile.in: Rebuilt.
contrib/ChangeLog:
* compare-debug: Look for .gkd files and compare them.
config/ChangeLog:
* bootstrap-debug.mk: Add comments.
* bootstrap-debug-big.mk: New.
* bootstrap-debug-lean.mk: New.
* bootstrap-debug-ckovw.mk: Add comments.
* bootstrap-debug-lib.mk: Drop CFLAGS for stages. Use -g0
for TFLAGS in stage1. Drop -fvar-tracking-assignments-toggle.
From-SVN: r151312
2009-09-02 04:42:21 +02:00
|
|
|
|
/* Simplify a MEM based on its attributes. This is the default
|
|
|
|
|
delegitimize_address target hook, and it's recommended that every
|
|
|
|
|
overrider call it. */
|
|
|
|
|
|
|
|
|
|
rtx
|
|
|
|
|
delegitimize_mem_from_attrs (rtx x)
|
|
|
|
|
{
|
|
|
|
|
if (MEM_P (x)
|
|
|
|
|
&& MEM_EXPR (x)
|
|
|
|
|
&& (!MEM_OFFSET (x)
|
|
|
|
|
|| GET_CODE (MEM_OFFSET (x)) == CONST_INT))
|
|
|
|
|
{
|
|
|
|
|
tree decl = MEM_EXPR (x);
|
|
|
|
|
enum machine_mode mode = GET_MODE (x);
|
|
|
|
|
HOST_WIDE_INT offset = 0;
|
|
|
|
|
|
|
|
|
|
switch (TREE_CODE (decl))
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
decl = NULL;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case VAR_DECL:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ARRAY_REF:
|
|
|
|
|
case ARRAY_RANGE_REF:
|
|
|
|
|
case COMPONENT_REF:
|
|
|
|
|
case BIT_FIELD_REF:
|
|
|
|
|
case REALPART_EXPR:
|
|
|
|
|
case IMAGPART_EXPR:
|
|
|
|
|
case VIEW_CONVERT_EXPR:
|
|
|
|
|
{
|
|
|
|
|
HOST_WIDE_INT bitsize, bitpos;
|
|
|
|
|
tree toffset;
|
|
|
|
|
int unsignedp = 0, volatilep = 0;
|
|
|
|
|
|
|
|
|
|
decl = get_inner_reference (decl, &bitsize, &bitpos, &toffset,
|
|
|
|
|
&mode, &unsignedp, &volatilep, false);
|
|
|
|
|
if (bitsize != GET_MODE_BITSIZE (mode)
|
|
|
|
|
|| (bitpos % BITS_PER_UNIT)
|
|
|
|
|
|| (toffset && !host_integerp (toffset, 0)))
|
|
|
|
|
decl = NULL;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
offset += bitpos / BITS_PER_UNIT;
|
|
|
|
|
if (toffset)
|
|
|
|
|
offset += TREE_INT_CST_LOW (toffset);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (decl
|
|
|
|
|
&& mode == GET_MODE (x)
|
|
|
|
|
&& TREE_CODE (decl) == VAR_DECL
|
|
|
|
|
&& (TREE_STATIC (decl)
|
|
|
|
|
|| DECL_THREAD_LOCAL_P (decl))
|
|
|
|
|
&& DECL_RTL_SET_P (decl)
|
|
|
|
|
&& MEM_P (DECL_RTL (decl)))
|
|
|
|
|
{
|
|
|
|
|
rtx newx;
|
|
|
|
|
|
|
|
|
|
if (MEM_OFFSET (x))
|
|
|
|
|
offset += INTVAL (MEM_OFFSET (x));
|
|
|
|
|
|
|
|
|
|
newx = DECL_RTL (decl);
|
|
|
|
|
|
|
|
|
|
if (MEM_P (newx))
|
|
|
|
|
{
|
|
|
|
|
rtx n = XEXP (newx, 0), o = XEXP (x, 0);
|
|
|
|
|
|
|
|
|
|
/* Avoid creating a new MEM needlessly if we already had
|
|
|
|
|
the same address. We do if there's no OFFSET and the
|
|
|
|
|
old address X is identical to NEWX, or if X is of the
|
|
|
|
|
form (plus NEWX OFFSET), or the NEWX is of the form
|
|
|
|
|
(plus Y (const_int Z)) and X is that with the offset
|
|
|
|
|
added: (plus Y (const_int Z+OFFSET)). */
|
|
|
|
|
if (!((offset == 0
|
|
|
|
|
|| (GET_CODE (o) == PLUS
|
|
|
|
|
&& GET_CODE (XEXP (o, 1)) == CONST_INT
|
|
|
|
|
&& (offset == INTVAL (XEXP (o, 1))
|
|
|
|
|
|| (GET_CODE (n) == PLUS
|
|
|
|
|
&& GET_CODE (XEXP (n, 1)) == CONST_INT
|
|
|
|
|
&& (INTVAL (XEXP (n, 1)) + offset
|
|
|
|
|
== INTVAL (XEXP (o, 1)))
|
|
|
|
|
&& (n = XEXP (n, 0))))
|
|
|
|
|
&& (o = XEXP (o, 0))))
|
|
|
|
|
&& rtx_equal_p (o, n)))
|
|
|
|
|
x = adjust_address_nv (newx, mode, offset);
|
|
|
|
|
}
|
|
|
|
|
else if (GET_MODE (x) == GET_MODE (newx)
|
|
|
|
|
&& offset == 0)
|
|
|
|
|
x = newx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-13 21:43:13 +01:00
|
|
|
|
/* Make a unary operation by first seeing if it folds and otherwise making
|
|
|
|
|
the specified operation. */
|
|
|
|
|
|
|
|
|
|
rtx
|
2003-07-06 14:35:56 +02:00
|
|
|
|
simplify_gen_unary (enum rtx_code code, enum machine_mode mode, rtx op,
|
|
|
|
|
enum machine_mode op_mode)
|
2001-02-13 21:43:13 +01:00
|
|
|
|
{
|
|
|
|
|
rtx tem;
|
|
|
|
|
|
|
|
|
|
/* If this simplifies, use it. */
|
|
|
|
|
if ((tem = simplify_unary_operation (code, mode, op, op_mode)) != 0)
|
|
|
|
|
return tem;
|
|
|
|
|
|
|
|
|
|
return gen_rtx_fmt_e (code, mode, op);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Likewise for ternary operations. */
|
|
|
|
|
|
|
|
|
|
rtx
|
2003-07-06 14:35:56 +02:00
|
|
|
|
simplify_gen_ternary (enum rtx_code code, enum machine_mode mode,
|
|
|
|
|
enum machine_mode op0_mode, rtx op0, rtx op1, rtx op2)
|
2001-02-13 21:43:13 +01:00
|
|
|
|
{
|
|
|
|
|
rtx tem;
|
|
|
|
|
|
|
|
|
|
/* If this simplifies, use it. */
|
|
|
|
|
if (0 != (tem = simplify_ternary_operation (code, mode, op0_mode,
|
|
|
|
|
op0, op1, op2)))
|
|
|
|
|
return tem;
|
|
|
|
|
|
|
|
|
|
return gen_rtx_fmt_eee (code, mode, op0, op1, op2);
|
|
|
|
|
}
|
2004-04-29 09:50:55 +02:00
|
|
|
|
|
rtl.h (simplify_gen_relational): Add cmp_mode parameter.
* rtl.h (simplify_gen_relational): Add cmp_mode parameter.
* simplify-rtx.c (simplify_gen_relational): Likewise.
* simplify-rtx.c (simplify_replace_rtx): Handle relationals and MEMs.
* i386.h (VALID_SSE_REG_MODE): Accept MMX modes if SSE2
* i386.md (movsi_1, movdi2, movdi_1_rex64): Handle SSE2 moves.
* i386.md (negsf2, negdf2, abssf2, absdf2): Force operands to
registers in SSE case; fix handling of the immediates.
(negsf2_ifs, abssf2_ifs): Tweak constraints; require
operands to be in regsiters before reload.
(negdf2_ifs, absdf2_ifs): Likewise; disable for 64bit
(negdf2_ifs_rex64, absdf2_ifs_rtx64): New.
(abstf,absxf,negtf,negxf splitters): Compute
properly the regnum for x86_64.
(avsdf2_if_rex64): New.
From-SVN: r41664
2001-04-28 21:16:30 +02:00
|
|
|
|
/* Likewise, for relational operations.
|
2004-04-29 09:50:55 +02:00
|
|
|
|
CMP_MODE specifies mode comparison is done in. */
|
2001-02-13 21:43:13 +01:00
|
|
|
|
|
|
|
|
|
rtx
|
2003-07-06 14:35:56 +02:00
|
|
|
|
simplify_gen_relational (enum rtx_code code, enum machine_mode mode,
|
|
|
|
|
enum machine_mode cmp_mode, rtx op0, rtx op1)
|
2001-02-13 21:43:13 +01:00
|
|
|
|
{
|
|
|
|
|
rtx tem;
|
|
|
|
|
|
2004-04-29 09:50:55 +02:00
|
|
|
|
if (0 != (tem = simplify_relational_operation (code, mode, cmp_mode,
|
|
|
|
|
op0, op1)))
|
|
|
|
|
return tem;
|
2002-06-08 01:50:31 +02:00
|
|
|
|
|
2001-02-13 21:43:13 +01:00
|
|
|
|
return gen_rtx_fmt_ee (code, mode, op0, op1);
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-26 02:38:05 +02:00
|
|
|
|
/* Replace all occurrences of OLD_RTX in X with NEW_RTX and try to simplify the
|
2001-02-13 21:43:13 +01:00
|
|
|
|
resulting RTX. Return a new RTX which is as simplified as possible. */
|
|
|
|
|
|
|
|
|
|
rtx
|
cfglayout.c (insn_scope, insn_line): Constify.
* cfglayout.c (insn_scope, insn_line): Constify.
* emit-rtl.c (const_int_htab_hash, const_int_htab_eq,
const_double_htab_hash, const_double_htab_eq,
mem_attrs_htab_hash): Likewise.
* loop-iv.c (biv_eq): Likewise.
* print-rtl.c (print_rtx, print_decl_name, print_mem_expr,
print_inline_rtx, debug_rtx, debug_rtx_list, debug_rtx_range,
debug_rtx_find, print_rtl, print_rtl_single, print_simple_rtl):
Likewise.
* rtl-error.c (location_for_asm, diagnostic_for_asm,
error_for_asm, warning_for_asm, _fatal_insn,
_fatal_insn_not_found): Likewise.
* rtl.c (rtx_size, shared_const_p, shallow_copy_rtx_stat,
rtx_equal_p, rtl_check_failed_bounds, rtl_check_failed_type1,
rtl_check_failed_type2, rtl_check_failed_code1,
rtl_check_failed_code2, rtl_check_failed_code_mode,
rtvec_check_failed_bounds, rtl_check_failed_flag): Likewise.
* rtl.h (rtl_check_failed_bounds, rtl_check_failed_type1,
rtl_check_failed_type2, rtl_check_failed_code1,
rtl_check_failed_code2, rtl_check_failed_code_mode,
rtvec_check_failed_bounds, rtl_check_failed_flag, LABEL_KIND,
SET_LABEL_KIND, rhs_regno, subreg_lsb, subreg_regno, subreg_nregs,
shared_const_p, rtx_size, shallow_copy_rtx_stat, rtx_equal_p,
get_pool_mode, insn_line, insn_file, simplify_replace_rtx,
mode_signbit_p, rtx_addr_can_trap_p, nonzero_address_p,
rtx_unstable_p, get_integer_term, get_related_value,
offset_within_block_p, reg_mentioned_p, count_occurrences,
reg_referenced_p, reg_used_between_p, no_labels_between_p,
single_set_2, multiple_sets, set_noop_p, refers_to_regno_p,
reg_overlap_mentioned_p, dead_or_set_p, dead_or_set_regno_p,
find_reg_note, find_regno_note, find_reg_equal_equiv_note,
find_constant_src, find_reg_fusage, find_regno_fusage,
pure_call_p, remove_note, side_effects_p, volatile_refs_p,
volatile_insn_p, may_trap_p, may_trap_after_code_motion_p,
may_trap_or_fault_p, inequality_comparisons_p, tablejump_p,
computed_jump_p, auto_inc_p, in_expr_list_p,
remove_node_from_expr_list, loc_mentioned_in_p,
label_is_jump_target_p, reversed_comparison_code_parts,
debug_rtx, debug_rtx_list, debug_rtx_range, debug_rtx_find,
print_mem_expr, print_rtl, print_simple_rtl, print_rtl_single,
print_inline_rtx): Likewise.
* rtlanal.c (covers_regno_p, covers_regno_no_parallel_p,
computed_jump_p_1, nonzero_bits1, rtx_unstable_p,
rtx_addr_can_trap_p_1, rtx_addr_can_trap_p, nonzero_address_p,
get_integer_term, get_related_value, offset_within_block_p,
count_occurrences, reg_mentioned_p, no_labels_between_p,
reg_used_between_p, reg_referenced_p, single_set_2,
multiple_sets, set_noop_p, refers_to_regno_p,
reg_overlap_mentioned_p, dead_or_set_p,
covers_regno_no_parallel_p, covers_regno_p,
dead_or_set_regno_p, find_reg_note, find_regno_note,
find_reg_equal_equiv_note, find_constant_src, find_reg_fusage,
find_regno_fusage, pure_call_p, remove_note, in_expr_list_p,
remove_node_from_expr_list, volatile_insn_p, volatile_refs_p,
side_effects_p, may_trap_p_1, may_trap_p,
may_trap_after_code_motion_p, may_trap_or_fault_p,
inequality_comparisons_p, tablejump_p, computed_jump_p_1,
computed_jump_p, auto_inc_p, loc_mentioned_in_p, subreg_lsb,
subreg_regno, subreg_nregs, label_is_jump_target_p): Likewise.
* simplify-rtx.c (neg_const_int, plus_minus_operand_p,
mode_signbit_p, simplify_replace_rtx, plus_minus_operand_p):
Likewise.
* toplev.h (_fatal_insn_not_found, _fatal_insn, error_for_asm,
warning_for_asm): Likewise.
* tree.h (print_rtl): Likewise.
* varasm.c (get_pool_mode): Likewise.
From-SVN: r126922
2007-07-25 20:33:26 +02:00
|
|
|
|
simplify_replace_rtx (rtx x, const_rtx old_rtx, rtx new_rtx)
|
2001-02-13 21:43:13 +01:00
|
|
|
|
{
|
|
|
|
|
enum rtx_code code = GET_CODE (x);
|
|
|
|
|
enum machine_mode mode = GET_MODE (x);
|
2003-10-26 02:31:02 +01:00
|
|
|
|
enum machine_mode op_mode;
|
|
|
|
|
rtx op0, op1, op2;
|
2001-02-13 21:43:13 +01:00
|
|
|
|
|
2004-07-26 02:38:05 +02:00
|
|
|
|
/* If X is OLD_RTX, return NEW_RTX. Otherwise, if this is an expression, try
|
2001-02-13 21:43:13 +01:00
|
|
|
|
to build a new expression substituting recursively. If we can't do
|
|
|
|
|
anything, return our input. */
|
|
|
|
|
|
2004-07-26 02:38:05 +02:00
|
|
|
|
if (x == old_rtx)
|
|
|
|
|
return new_rtx;
|
2001-02-13 21:43:13 +01:00
|
|
|
|
|
|
|
|
|
switch (GET_RTX_CLASS (code))
|
|
|
|
|
{
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_UNARY:
|
2003-10-26 02:31:02 +01:00
|
|
|
|
op0 = XEXP (x, 0);
|
|
|
|
|
op_mode = GET_MODE (op0);
|
2004-07-26 02:38:05 +02:00
|
|
|
|
op0 = simplify_replace_rtx (op0, old_rtx, new_rtx);
|
2003-10-26 02:31:02 +01:00
|
|
|
|
if (op0 == XEXP (x, 0))
|
|
|
|
|
return x;
|
|
|
|
|
return simplify_gen_unary (code, mode, op0, op_mode);
|
2001-02-13 21:43:13 +01:00
|
|
|
|
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_BIN_ARITH:
|
|
|
|
|
case RTX_COMM_ARITH:
|
2004-07-26 02:38:05 +02:00
|
|
|
|
op0 = simplify_replace_rtx (XEXP (x, 0), old_rtx, new_rtx);
|
|
|
|
|
op1 = simplify_replace_rtx (XEXP (x, 1), old_rtx, new_rtx);
|
2003-10-26 02:31:02 +01:00
|
|
|
|
if (op0 == XEXP (x, 0) && op1 == XEXP (x, 1))
|
|
|
|
|
return x;
|
|
|
|
|
return simplify_gen_binary (code, mode, op0, op1);
|
|
|
|
|
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_COMPARE:
|
|
|
|
|
case RTX_COMM_COMPARE:
|
2003-10-26 02:31:02 +01:00
|
|
|
|
op0 = XEXP (x, 0);
|
|
|
|
|
op1 = XEXP (x, 1);
|
|
|
|
|
op_mode = GET_MODE (op0) != VOIDmode ? GET_MODE (op0) : GET_MODE (op1);
|
2004-07-26 02:38:05 +02:00
|
|
|
|
op0 = simplify_replace_rtx (op0, old_rtx, new_rtx);
|
|
|
|
|
op1 = simplify_replace_rtx (op1, old_rtx, new_rtx);
|
2003-10-26 02:31:02 +01:00
|
|
|
|
if (op0 == XEXP (x, 0) && op1 == XEXP (x, 1))
|
|
|
|
|
return x;
|
|
|
|
|
return simplify_gen_relational (code, mode, op_mode, op0, op1);
|
2001-02-13 21:43:13 +01:00
|
|
|
|
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_TERNARY:
|
|
|
|
|
case RTX_BITFIELD_OPS:
|
2003-10-26 02:31:02 +01:00
|
|
|
|
op0 = XEXP (x, 0);
|
|
|
|
|
op_mode = GET_MODE (op0);
|
2004-07-26 02:38:05 +02:00
|
|
|
|
op0 = simplify_replace_rtx (op0, old_rtx, new_rtx);
|
|
|
|
|
op1 = simplify_replace_rtx (XEXP (x, 1), old_rtx, new_rtx);
|
|
|
|
|
op2 = simplify_replace_rtx (XEXP (x, 2), old_rtx, new_rtx);
|
2003-10-26 02:31:02 +01:00
|
|
|
|
if (op0 == XEXP (x, 0) && op1 == XEXP (x, 1) && op2 == XEXP (x, 2))
|
|
|
|
|
return x;
|
|
|
|
|
if (op_mode == VOIDmode)
|
|
|
|
|
op_mode = GET_MODE (op0);
|
|
|
|
|
return simplify_gen_ternary (code, mode, op_mode, op0, op1, op2);
|
2001-02-13 21:43:13 +01:00
|
|
|
|
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_EXTRA:
|
2001-05-17 20:46:58 +02:00
|
|
|
|
/* The only case we try to handle is a SUBREG. */
|
|
|
|
|
if (code == SUBREG)
|
|
|
|
|
{
|
2004-07-26 02:38:05 +02:00
|
|
|
|
op0 = simplify_replace_rtx (SUBREG_REG (x), old_rtx, new_rtx);
|
2003-10-26 02:31:02 +01:00
|
|
|
|
if (op0 == SUBREG_REG (x))
|
|
|
|
|
return x;
|
|
|
|
|
op0 = simplify_gen_subreg (GET_MODE (x), op0,
|
2001-05-17 20:46:58 +02:00
|
|
|
|
GET_MODE (SUBREG_REG (x)),
|
|
|
|
|
SUBREG_BYTE (x));
|
2003-10-26 02:31:02 +01:00
|
|
|
|
return op0 ? op0 : x;
|
2001-05-17 20:46:58 +02:00
|
|
|
|
}
|
2003-10-26 02:31:02 +01:00
|
|
|
|
break;
|
2001-02-13 21:43:13 +01:00
|
|
|
|
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_OBJ:
|
2002-06-11 00:29:14 +02:00
|
|
|
|
if (code == MEM)
|
2003-10-26 02:31:02 +01:00
|
|
|
|
{
|
2004-07-26 02:38:05 +02:00
|
|
|
|
op0 = simplify_replace_rtx (XEXP (x, 0), old_rtx, new_rtx);
|
2003-10-26 02:31:02 +01:00
|
|
|
|
if (op0 == XEXP (x, 0))
|
|
|
|
|
return x;
|
|
|
|
|
return replace_equiv_address_nv (x, op0);
|
|
|
|
|
}
|
2002-10-14 20:16:07 +02:00
|
|
|
|
else if (code == LO_SUM)
|
|
|
|
|
{
|
2004-07-26 02:38:05 +02:00
|
|
|
|
op0 = simplify_replace_rtx (XEXP (x, 0), old_rtx, new_rtx);
|
|
|
|
|
op1 = simplify_replace_rtx (XEXP (x, 1), old_rtx, new_rtx);
|
2002-10-14 20:16:07 +02:00
|
|
|
|
|
|
|
|
|
/* (lo_sum (high x) x) -> x */
|
|
|
|
|
if (GET_CODE (op0) == HIGH && rtx_equal_p (XEXP (op0, 0), op1))
|
|
|
|
|
return op1;
|
2002-06-11 00:29:14 +02:00
|
|
|
|
|
2003-10-26 02:31:02 +01:00
|
|
|
|
if (op0 == XEXP (x, 0) && op1 == XEXP (x, 1))
|
|
|
|
|
return x;
|
2002-10-14 20:16:07 +02:00
|
|
|
|
return gen_rtx_LO_SUM (mode, op0, op1);
|
|
|
|
|
}
|
|
|
|
|
else if (code == REG)
|
|
|
|
|
{
|
2004-12-16 20:19:04 +01:00
|
|
|
|
if (rtx_equal_p (x, old_rtx))
|
2004-07-26 02:38:05 +02:00
|
|
|
|
return new_rtx;
|
2002-10-14 20:16:07 +02:00
|
|
|
|
}
|
2003-10-26 02:31:02 +01:00
|
|
|
|
break;
|
2002-06-11 00:29:14 +02:00
|
|
|
|
|
|
|
|
|
default:
|
2003-10-26 02:31:02 +01:00
|
|
|
|
break;
|
2001-02-13 21:43:13 +01:00
|
|
|
|
}
|
rtl.h (simplify_gen_relational): Add cmp_mode parameter.
* rtl.h (simplify_gen_relational): Add cmp_mode parameter.
* simplify-rtx.c (simplify_gen_relational): Likewise.
* simplify-rtx.c (simplify_replace_rtx): Handle relationals and MEMs.
* i386.h (VALID_SSE_REG_MODE): Accept MMX modes if SSE2
* i386.md (movsi_1, movdi2, movdi_1_rex64): Handle SSE2 moves.
* i386.md (negsf2, negdf2, abssf2, absdf2): Force operands to
registers in SSE case; fix handling of the immediates.
(negsf2_ifs, abssf2_ifs): Tweak constraints; require
operands to be in regsiters before reload.
(negdf2_ifs, absdf2_ifs): Likewise; disable for 64bit
(negdf2_ifs_rex64, absdf2_ifs_rtx64): New.
(abstf,absxf,negtf,negxf splitters): Compute
properly the regnum for x86_64.
(avsdf2_if_rex64): New.
From-SVN: r41664
2001-04-28 21:16:30 +02:00
|
|
|
|
return x;
|
2001-02-13 21:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
/* Try to simplify a unary operation CODE whose output mode is to be
|
|
|
|
|
MODE with input operand OP whose mode was originally OP_MODE.
|
|
|
|
|
Return zero if no simplification can be made. */
|
|
|
|
|
rtx
|
2003-07-06 14:35:56 +02:00
|
|
|
|
simplify_unary_operation (enum rtx_code code, enum machine_mode mode,
|
|
|
|
|
rtx op, enum machine_mode op_mode)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
{
|
|
|
|
|
rtx trueop, tem;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (op) == CONST)
|
|
|
|
|
op = XEXP (op, 0);
|
|
|
|
|
|
|
|
|
|
trueop = avoid_constant_pool_reference (op);
|
|
|
|
|
|
|
|
|
|
tem = simplify_const_unary_operation (code, mode, trueop, op_mode);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
|
|
|
|
|
|
|
|
|
return simplify_unary_operation_1 (code, mode, op);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Perform some simplifications we can do even if the operands
|
|
|
|
|
aren't constant. */
|
|
|
|
|
static rtx
|
|
|
|
|
simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
|
|
|
|
|
{
|
|
|
|
|
enum rtx_code reversed;
|
|
|
|
|
rtx temp;
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case NOT:
|
|
|
|
|
/* (not (not X)) == X. */
|
|
|
|
|
if (GET_CODE (op) == NOT)
|
|
|
|
|
return XEXP (op, 0);
|
|
|
|
|
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
/* (not (eq X Y)) == (ne X Y), etc. if BImode or the result of the
|
|
|
|
|
comparison is all ones. */
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (COMPARISON_P (op)
|
|
|
|
|
&& (mode == BImode || STORE_FLAG_VALUE == -1)
|
|
|
|
|
&& ((reversed = reversed_comparison_code (op, NULL_RTX)) != UNKNOWN))
|
|
|
|
|
return simplify_gen_relational (reversed, mode, VOIDmode,
|
|
|
|
|
XEXP (op, 0), XEXP (op, 1));
|
|
|
|
|
|
|
|
|
|
/* (not (plus X -1)) can become (neg X). */
|
|
|
|
|
if (GET_CODE (op) == PLUS
|
|
|
|
|
&& XEXP (op, 1) == constm1_rtx)
|
|
|
|
|
return simplify_gen_unary (NEG, mode, XEXP (op, 0), mode);
|
|
|
|
|
|
|
|
|
|
/* Similarly, (not (neg X)) is (plus X -1). */
|
|
|
|
|
if (GET_CODE (op) == NEG)
|
|
|
|
|
return plus_constant (XEXP (op, 0), -1);
|
|
|
|
|
|
|
|
|
|
/* (not (xor X C)) for C constant is (xor X D) with D = ~C. */
|
|
|
|
|
if (GET_CODE (op) == XOR
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (op, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& (temp = simplify_unary_operation (NOT, mode,
|
|
|
|
|
XEXP (op, 1), mode)) != 0)
|
|
|
|
|
return simplify_gen_binary (XOR, mode, XEXP (op, 0), temp);
|
|
|
|
|
|
|
|
|
|
/* (not (plus X C)) for signbit C is (xor X D) with D = ~C. */
|
|
|
|
|
if (GET_CODE (op) == PLUS
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (op, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& mode_signbit_p (mode, XEXP (op, 1))
|
|
|
|
|
&& (temp = simplify_unary_operation (NOT, mode,
|
|
|
|
|
XEXP (op, 1), mode)) != 0)
|
|
|
|
|
return simplify_gen_binary (XOR, mode, XEXP (op, 0), temp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* (not (ashift 1 X)) is (rotate ~1 X). We used to do this for
|
|
|
|
|
operands other than 1, but that is not valid. We could do a
|
|
|
|
|
similar simplification for (not (lshiftrt C X)) where C is
|
|
|
|
|
just the sign bit, but this doesn't seem common enough to
|
|
|
|
|
bother with. */
|
|
|
|
|
if (GET_CODE (op) == ASHIFT
|
|
|
|
|
&& XEXP (op, 0) == const1_rtx)
|
|
|
|
|
{
|
|
|
|
|
temp = simplify_gen_unary (NOT, mode, const1_rtx, mode);
|
|
|
|
|
return simplify_gen_binary (ROTATE, mode, temp, XEXP (op, 1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (not (ashiftrt foo C)) where C is the number of bits in FOO
|
|
|
|
|
minus 1 is (ge foo (const_int 0)) if STORE_FLAG_VALUE is -1,
|
|
|
|
|
so we can perform the above simplification. */
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (STORE_FLAG_VALUE == -1
|
|
|
|
|
&& GET_CODE (op) == ASHIFTRT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& GET_CODE (XEXP (op, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& INTVAL (XEXP (op, 1)) == GET_MODE_BITSIZE (mode) - 1)
|
|
|
|
|
return simplify_gen_relational (GE, mode, VOIDmode,
|
|
|
|
|
XEXP (op, 0), const0_rtx);
|
|
|
|
|
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
|
|
|
|
|
if (GET_CODE (op) == SUBREG
|
|
|
|
|
&& subreg_lowpart_p (op)
|
|
|
|
|
&& (GET_MODE_SIZE (GET_MODE (op))
|
|
|
|
|
< GET_MODE_SIZE (GET_MODE (SUBREG_REG (op))))
|
|
|
|
|
&& GET_CODE (SUBREG_REG (op)) == ASHIFT
|
|
|
|
|
&& XEXP (SUBREG_REG (op), 0) == const1_rtx)
|
|
|
|
|
{
|
|
|
|
|
enum machine_mode inner_mode = GET_MODE (SUBREG_REG (op));
|
|
|
|
|
rtx x;
|
|
|
|
|
|
|
|
|
|
x = gen_rtx_ROTATE (inner_mode,
|
|
|
|
|
simplify_gen_unary (NOT, inner_mode, const1_rtx,
|
|
|
|
|
inner_mode),
|
|
|
|
|
XEXP (SUBREG_REG (op), 1));
|
|
|
|
|
return rtl_hooks.gen_lowpart_no_emit (mode, x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Apply De Morgan's laws to reduce number of patterns for machines
|
|
|
|
|
with negating logical insns (and-not, nand, etc.). If result has
|
|
|
|
|
only one NOT, put it first, since that is how the patterns are
|
|
|
|
|
coded. */
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (op) == IOR || GET_CODE (op) == AND)
|
|
|
|
|
{
|
|
|
|
|
rtx in1 = XEXP (op, 0), in2 = XEXP (op, 1);
|
|
|
|
|
enum machine_mode op_mode;
|
|
|
|
|
|
|
|
|
|
op_mode = GET_MODE (in1);
|
|
|
|
|
in1 = simplify_gen_unary (NOT, op_mode, in1, op_mode);
|
|
|
|
|
|
|
|
|
|
op_mode = GET_MODE (in2);
|
|
|
|
|
if (op_mode == VOIDmode)
|
|
|
|
|
op_mode = mode;
|
|
|
|
|
in2 = simplify_gen_unary (NOT, op_mode, in2, op_mode);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (in2) == NOT && GET_CODE (in1) != NOT)
|
|
|
|
|
{
|
|
|
|
|
rtx tem = in2;
|
|
|
|
|
in2 = in1; in1 = tem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return gen_rtx_fmt_ee (GET_CODE (op) == IOR ? AND : IOR,
|
|
|
|
|
mode, in1, in2);
|
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NEG:
|
|
|
|
|
/* (neg (neg X)) == X. */
|
|
|
|
|
if (GET_CODE (op) == NEG)
|
|
|
|
|
return XEXP (op, 0);
|
|
|
|
|
|
|
|
|
|
/* (neg (plus X 1)) can become (not X). */
|
|
|
|
|
if (GET_CODE (op) == PLUS
|
|
|
|
|
&& XEXP (op, 1) == const1_rtx)
|
|
|
|
|
return simplify_gen_unary (NOT, mode, XEXP (op, 0), mode);
|
|
|
|
|
|
|
|
|
|
/* Similarly, (neg (not X)) is (plus X 1). */
|
|
|
|
|
if (GET_CODE (op) == NOT)
|
|
|
|
|
return plus_constant (XEXP (op, 0), 1);
|
|
|
|
|
|
|
|
|
|
/* (neg (minus X Y)) can become (minus Y X). This transformation
|
|
|
|
|
isn't safe for modes with signed zeros, since if X and Y are
|
|
|
|
|
both +0, (minus Y X) is the same as (minus X Y). If the
|
|
|
|
|
rounding mode is towards +infinity (or -infinity) then the two
|
|
|
|
|
expressions will be rounded differently. */
|
|
|
|
|
if (GET_CODE (op) == MINUS
|
|
|
|
|
&& !HONOR_SIGNED_ZEROS (mode)
|
|
|
|
|
&& !HONOR_SIGN_DEPENDENT_ROUNDING (mode))
|
|
|
|
|
return simplify_gen_binary (MINUS, mode, XEXP (op, 1), XEXP (op, 0));
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (op) == PLUS
|
|
|
|
|
&& !HONOR_SIGNED_ZEROS (mode)
|
|
|
|
|
&& !HONOR_SIGN_DEPENDENT_ROUNDING (mode))
|
|
|
|
|
{
|
|
|
|
|
/* (neg (plus A C)) is simplified to (minus -C A). */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (XEXP (op, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|| GET_CODE (XEXP (op, 1)) == CONST_DOUBLE)
|
|
|
|
|
{
|
|
|
|
|
temp = simplify_unary_operation (NEG, mode, XEXP (op, 1), mode);
|
|
|
|
|
if (temp)
|
|
|
|
|
return simplify_gen_binary (MINUS, mode, temp, XEXP (op, 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (neg (plus A B)) is canonicalized to (minus (neg A) B). */
|
|
|
|
|
temp = simplify_gen_unary (NEG, mode, XEXP (op, 0), mode);
|
|
|
|
|
return simplify_gen_binary (MINUS, mode, temp, XEXP (op, 1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (neg (mult A B)) becomes (mult (neg A) B).
|
|
|
|
|
This works even for floating-point values. */
|
|
|
|
|
if (GET_CODE (op) == MULT
|
|
|
|
|
&& !HONOR_SIGN_DEPENDENT_ROUNDING (mode))
|
|
|
|
|
{
|
|
|
|
|
temp = simplify_gen_unary (NEG, mode, XEXP (op, 0), mode);
|
|
|
|
|
return simplify_gen_binary (MULT, mode, temp, XEXP (op, 1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* NEG commutes with ASHIFT since it is multiplication. Only do
|
|
|
|
|
this if we can then eliminate the NEG (e.g., if the operand
|
|
|
|
|
is a constant). */
|
|
|
|
|
if (GET_CODE (op) == ASHIFT)
|
|
|
|
|
{
|
|
|
|
|
temp = simplify_unary_operation (NEG, mode, XEXP (op, 0), mode);
|
|
|
|
|
if (temp)
|
|
|
|
|
return simplify_gen_binary (ASHIFT, mode, temp, XEXP (op, 1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (neg (ashiftrt X C)) can be replaced by (lshiftrt X C) when
|
|
|
|
|
C is equal to the width of MODE minus 1. */
|
|
|
|
|
if (GET_CODE (op) == ASHIFTRT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (op, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& INTVAL (XEXP (op, 1)) == GET_MODE_BITSIZE (mode) - 1)
|
|
|
|
|
return simplify_gen_binary (LSHIFTRT, mode,
|
|
|
|
|
XEXP (op, 0), XEXP (op, 1));
|
|
|
|
|
|
|
|
|
|
/* (neg (lshiftrt X C)) can be replaced by (ashiftrt X C) when
|
|
|
|
|
C is equal to the width of MODE minus 1. */
|
|
|
|
|
if (GET_CODE (op) == LSHIFTRT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (op, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& INTVAL (XEXP (op, 1)) == GET_MODE_BITSIZE (mode) - 1)
|
|
|
|
|
return simplify_gen_binary (ASHIFTRT, mode,
|
|
|
|
|
XEXP (op, 0), XEXP (op, 1));
|
|
|
|
|
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
/* (neg (xor A 1)) is (plus A -1) if A is known to be either 0 or 1. */
|
|
|
|
|
if (GET_CODE (op) == XOR
|
|
|
|
|
&& XEXP (op, 1) == const1_rtx
|
|
|
|
|
&& nonzero_bits (XEXP (op, 0), mode) == 1)
|
|
|
|
|
return plus_constant (XEXP (op, 0), -1);
|
2006-02-18 06:22:46 +01:00
|
|
|
|
|
|
|
|
|
/* (neg (lt x 0)) is (ashiftrt X C) if STORE_FLAG_VALUE is 1. */
|
|
|
|
|
/* (neg (lt x 0)) is (lshiftrt X C) if STORE_FLAG_VALUE is -1. */
|
|
|
|
|
if (GET_CODE (op) == LT
|
2007-08-28 11:47:32 +02:00
|
|
|
|
&& XEXP (op, 1) == const0_rtx
|
|
|
|
|
&& SCALAR_INT_MODE_P (GET_MODE (XEXP (op, 0))))
|
2006-02-18 06:22:46 +01:00
|
|
|
|
{
|
2006-03-03 06:55:02 +01:00
|
|
|
|
enum machine_mode inner = GET_MODE (XEXP (op, 0));
|
|
|
|
|
int isize = GET_MODE_BITSIZE (inner);
|
2006-02-18 06:22:46 +01:00
|
|
|
|
if (STORE_FLAG_VALUE == 1)
|
2006-03-03 06:55:02 +01:00
|
|
|
|
{
|
|
|
|
|
temp = simplify_gen_binary (ASHIFTRT, inner, XEXP (op, 0),
|
|
|
|
|
GEN_INT (isize - 1));
|
|
|
|
|
if (mode == inner)
|
|
|
|
|
return temp;
|
|
|
|
|
if (GET_MODE_BITSIZE (mode) > isize)
|
|
|
|
|
return simplify_gen_unary (SIGN_EXTEND, mode, temp, inner);
|
|
|
|
|
return simplify_gen_unary (TRUNCATE, mode, temp, inner);
|
|
|
|
|
}
|
2006-02-18 06:22:46 +01:00
|
|
|
|
else if (STORE_FLAG_VALUE == -1)
|
2006-03-03 06:55:02 +01:00
|
|
|
|
{
|
|
|
|
|
temp = simplify_gen_binary (LSHIFTRT, inner, XEXP (op, 0),
|
|
|
|
|
GEN_INT (isize - 1));
|
|
|
|
|
if (mode == inner)
|
|
|
|
|
return temp;
|
|
|
|
|
if (GET_MODE_BITSIZE (mode) > isize)
|
|
|
|
|
return simplify_gen_unary (ZERO_EXTEND, mode, temp, inner);
|
|
|
|
|
return simplify_gen_unary (TRUNCATE, mode, temp, inner);
|
|
|
|
|
}
|
2006-02-18 06:22:46 +01:00
|
|
|
|
}
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TRUNCATE:
|
|
|
|
|
/* We can't handle truncation to a partial integer mode here
|
|
|
|
|
because we don't know the real bitsize of the partial
|
|
|
|
|
integer mode. */
|
|
|
|
|
if (GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* (truncate:SI ({sign,zero}_extend:DI foo:SI)) == foo:SI. */
|
|
|
|
|
if ((GET_CODE (op) == SIGN_EXTEND
|
|
|
|
|
|| GET_CODE (op) == ZERO_EXTEND)
|
|
|
|
|
&& GET_MODE (XEXP (op, 0)) == mode)
|
|
|
|
|
return XEXP (op, 0);
|
|
|
|
|
|
|
|
|
|
/* (truncate:SI (OP:DI ({sign,zero}_extend:DI foo:SI))) is
|
|
|
|
|
(OP:SI foo:SI) if OP is NEG or ABS. */
|
|
|
|
|
if ((GET_CODE (op) == ABS
|
|
|
|
|
|| GET_CODE (op) == NEG)
|
|
|
|
|
&& (GET_CODE (XEXP (op, 0)) == SIGN_EXTEND
|
|
|
|
|
|| GET_CODE (XEXP (op, 0)) == ZERO_EXTEND)
|
|
|
|
|
&& GET_MODE (XEXP (XEXP (op, 0), 0)) == mode)
|
|
|
|
|
return simplify_gen_unary (GET_CODE (op), mode,
|
|
|
|
|
XEXP (XEXP (op, 0), 0), mode);
|
|
|
|
|
|
2006-02-14 08:10:35 +01:00
|
|
|
|
/* (truncate:A (subreg:B (truncate:C X) 0)) is
|
|
|
|
|
(truncate:A X). */
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
if (GET_CODE (op) == SUBREG
|
|
|
|
|
&& GET_CODE (SUBREG_REG (op)) == TRUNCATE
|
|
|
|
|
&& subreg_lowpart_p (op))
|
2006-02-14 08:10:35 +01:00
|
|
|
|
return simplify_gen_unary (TRUNCATE, mode, XEXP (SUBREG_REG (op), 0),
|
|
|
|
|
GET_MODE (XEXP (SUBREG_REG (op), 0)));
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
|
|
|
|
|
/* If we know that the value is already truncated, we can
|
2006-02-28 21:32:20 +01:00
|
|
|
|
replace the TRUNCATE with a SUBREG. Note that this is also
|
|
|
|
|
valid if TRULY_NOOP_TRUNCATION is false for the corresponding
|
|
|
|
|
modes we just have to apply a different definition for
|
|
|
|
|
truncation. But don't do this for an (LSHIFTRT (MULT ...))
|
|
|
|
|
since this will cause problems with the umulXi3_highpart
|
|
|
|
|
patterns. */
|
|
|
|
|
if ((TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
GET_MODE_BITSIZE (GET_MODE (op)))
|
2006-02-28 21:32:20 +01:00
|
|
|
|
? (num_sign_bit_copies (op, GET_MODE (op))
|
2006-04-03 20:12:15 +02:00
|
|
|
|
> (unsigned int) (GET_MODE_BITSIZE (GET_MODE (op))
|
|
|
|
|
- GET_MODE_BITSIZE (mode)))
|
2006-02-28 21:32:20 +01:00
|
|
|
|
: truncated_to_mode (mode, op))
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& ! (GET_CODE (op) == LSHIFTRT
|
|
|
|
|
&& GET_CODE (XEXP (op, 0)) == MULT))
|
|
|
|
|
return rtl_hooks.gen_lowpart_no_emit (mode, op);
|
|
|
|
|
|
|
|
|
|
/* A truncate of a comparison can be replaced with a subreg if
|
|
|
|
|
STORE_FLAG_VALUE permits. This is like the previous test,
|
|
|
|
|
but it works even if the comparison is done in a mode larger
|
|
|
|
|
than HOST_BITS_PER_WIDE_INT. */
|
|
|
|
|
if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
|
|
|
|
|
&& COMPARISON_P (op)
|
|
|
|
|
&& ((HOST_WIDE_INT) STORE_FLAG_VALUE & ~GET_MODE_MASK (mode)) == 0)
|
|
|
|
|
return rtl_hooks.gen_lowpart_no_emit (mode, op);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FLOAT_TRUNCATE:
|
2005-12-18 22:40:47 +01:00
|
|
|
|
if (DECIMAL_FLOAT_MODE_P (mode))
|
|
|
|
|
break;
|
|
|
|
|
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
/* (float_truncate:SF (float_extend:DF foo:SF)) = foo:SF. */
|
|
|
|
|
if (GET_CODE (op) == FLOAT_EXTEND
|
|
|
|
|
&& GET_MODE (XEXP (op, 0)) == mode)
|
|
|
|
|
return XEXP (op, 0);
|
|
|
|
|
|
|
|
|
|
/* (float_truncate:SF (float_truncate:DF foo:XF))
|
|
|
|
|
= (float_truncate:SF foo:XF).
|
|
|
|
|
This may eliminate double rounding, so it is unsafe.
|
|
|
|
|
|
|
|
|
|
(float_truncate:SF (float_extend:XF foo:DF))
|
|
|
|
|
= (float_truncate:SF foo:DF).
|
|
|
|
|
|
|
|
|
|
(float_truncate:DF (float_extend:XF foo:SF))
|
|
|
|
|
= (float_extend:SF foo:DF). */
|
|
|
|
|
if ((GET_CODE (op) == FLOAT_TRUNCATE
|
|
|
|
|
&& flag_unsafe_math_optimizations)
|
|
|
|
|
|| GET_CODE (op) == FLOAT_EXTEND)
|
|
|
|
|
return simplify_gen_unary (GET_MODE_SIZE (GET_MODE (XEXP (op,
|
|
|
|
|
0)))
|
|
|
|
|
> GET_MODE_SIZE (mode)
|
|
|
|
|
? FLOAT_TRUNCATE : FLOAT_EXTEND,
|
|
|
|
|
mode,
|
|
|
|
|
XEXP (op, 0), mode);
|
|
|
|
|
|
|
|
|
|
/* (float_truncate (float x)) is (float x) */
|
|
|
|
|
if (GET_CODE (op) == FLOAT
|
|
|
|
|
&& (flag_unsafe_math_optimizations
|
2007-06-17 21:23:30 +02:00
|
|
|
|
|| (SCALAR_FLOAT_MODE_P (GET_MODE (op))
|
|
|
|
|
&& ((unsigned)significand_size (GET_MODE (op))
|
|
|
|
|
>= (GET_MODE_BITSIZE (GET_MODE (XEXP (op, 0)))
|
|
|
|
|
- num_sign_bit_copies (XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0))))))))
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
return simplify_gen_unary (FLOAT, mode,
|
|
|
|
|
XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0)));
|
|
|
|
|
|
|
|
|
|
/* (float_truncate:SF (OP:DF (float_extend:DF foo:sf))) is
|
|
|
|
|
(OP:SF foo:SF) if OP is NEG or ABS. */
|
|
|
|
|
if ((GET_CODE (op) == ABS
|
|
|
|
|
|| GET_CODE (op) == NEG)
|
|
|
|
|
&& GET_CODE (XEXP (op, 0)) == FLOAT_EXTEND
|
|
|
|
|
&& GET_MODE (XEXP (XEXP (op, 0), 0)) == mode)
|
|
|
|
|
return simplify_gen_unary (GET_CODE (op), mode,
|
|
|
|
|
XEXP (XEXP (op, 0), 0), mode);
|
|
|
|
|
|
|
|
|
|
/* (float_truncate:SF (subreg:DF (float_truncate:SF X) 0))
|
|
|
|
|
is (float_truncate:SF x). */
|
|
|
|
|
if (GET_CODE (op) == SUBREG
|
|
|
|
|
&& subreg_lowpart_p (op)
|
|
|
|
|
&& GET_CODE (SUBREG_REG (op)) == FLOAT_TRUNCATE)
|
|
|
|
|
return SUBREG_REG (op);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FLOAT_EXTEND:
|
2005-12-18 22:40:47 +01:00
|
|
|
|
if (DECIMAL_FLOAT_MODE_P (mode))
|
|
|
|
|
break;
|
|
|
|
|
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
/* (float_extend (float_extend x)) is (float_extend x)
|
|
|
|
|
|
|
|
|
|
(float_extend (float x)) is (float x) assuming that double
|
|
|
|
|
rounding can't happen.
|
|
|
|
|
*/
|
|
|
|
|
if (GET_CODE (op) == FLOAT_EXTEND
|
|
|
|
|
|| (GET_CODE (op) == FLOAT
|
2007-06-17 21:23:30 +02:00
|
|
|
|
&& SCALAR_FLOAT_MODE_P (GET_MODE (op))
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& ((unsigned)significand_size (GET_MODE (op))
|
|
|
|
|
>= (GET_MODE_BITSIZE (GET_MODE (XEXP (op, 0)))
|
|
|
|
|
- num_sign_bit_copies (XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0)))))))
|
|
|
|
|
return simplify_gen_unary (GET_CODE (op), mode,
|
|
|
|
|
XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0)));
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ABS:
|
|
|
|
|
/* (abs (neg <foo>)) -> (abs <foo>) */
|
|
|
|
|
if (GET_CODE (op) == NEG)
|
|
|
|
|
return simplify_gen_unary (ABS, mode, XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0)));
|
|
|
|
|
|
|
|
|
|
/* If the mode of the operand is VOIDmode (i.e. if it is ASM_OPERANDS),
|
|
|
|
|
do nothing. */
|
|
|
|
|
if (GET_MODE (op) == VOIDmode)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* If operand is something known to be positive, ignore the ABS. */
|
|
|
|
|
if (GET_CODE (op) == FFS || GET_CODE (op) == ABS
|
|
|
|
|
|| ((GET_MODE_BITSIZE (GET_MODE (op))
|
|
|
|
|
<= HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
&& ((nonzero_bits (op, GET_MODE (op))
|
|
|
|
|
& ((HOST_WIDE_INT) 1
|
|
|
|
|
<< (GET_MODE_BITSIZE (GET_MODE (op)) - 1)))
|
|
|
|
|
== 0)))
|
|
|
|
|
return op;
|
|
|
|
|
|
|
|
|
|
/* If operand is known to be only -1 or 0, convert ABS to NEG. */
|
|
|
|
|
if (num_sign_bit_copies (op, mode) == GET_MODE_BITSIZE (mode))
|
|
|
|
|
return gen_rtx_NEG (mode, op);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FFS:
|
|
|
|
|
/* (ffs (*_extend <X>)) = (ffs <X>) */
|
|
|
|
|
if (GET_CODE (op) == SIGN_EXTEND
|
|
|
|
|
|| GET_CODE (op) == ZERO_EXTEND)
|
|
|
|
|
return simplify_gen_unary (FFS, mode, XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0)));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case POPCOUNT:
|
2007-02-08 18:10:56 +01:00
|
|
|
|
switch (GET_CODE (op))
|
|
|
|
|
{
|
|
|
|
|
case BSWAP:
|
|
|
|
|
case ZERO_EXTEND:
|
|
|
|
|
/* (popcount (zero_extend <X>)) = (popcount <X>) */
|
|
|
|
|
return simplify_gen_unary (POPCOUNT, mode, XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0)));
|
|
|
|
|
|
|
|
|
|
case ROTATE:
|
|
|
|
|
case ROTATERT:
|
|
|
|
|
/* Rotations don't affect popcount. */
|
|
|
|
|
if (!side_effects_p (XEXP (op, 1)))
|
|
|
|
|
return simplify_gen_unary (POPCOUNT, mode, XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0)));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
case PARITY:
|
2007-02-08 18:10:56 +01:00
|
|
|
|
switch (GET_CODE (op))
|
|
|
|
|
{
|
|
|
|
|
case NOT:
|
|
|
|
|
case BSWAP:
|
|
|
|
|
case ZERO_EXTEND:
|
|
|
|
|
case SIGN_EXTEND:
|
|
|
|
|
return simplify_gen_unary (PARITY, mode, XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0)));
|
|
|
|
|
|
|
|
|
|
case ROTATE:
|
|
|
|
|
case ROTATERT:
|
|
|
|
|
/* Rotations don't affect parity. */
|
|
|
|
|
if (!side_effects_p (XEXP (op, 1)))
|
|
|
|
|
return simplify_gen_unary (PARITY, mode, XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0)));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BSWAP:
|
|
|
|
|
/* (bswap (bswap x)) -> x. */
|
|
|
|
|
if (GET_CODE (op) == BSWAP)
|
|
|
|
|
return XEXP (op, 0);
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FLOAT:
|
|
|
|
|
/* (float (sign_extend <X>)) = (float <X>). */
|
|
|
|
|
if (GET_CODE (op) == SIGN_EXTEND)
|
|
|
|
|
return simplify_gen_unary (FLOAT, mode, XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0)));
|
2005-02-28 16:29:43 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SIGN_EXTEND:
|
|
|
|
|
/* (sign_extend (truncate (minus (label_ref L1) (label_ref L2))))
|
|
|
|
|
becomes just the MINUS if its mode is MODE. This allows
|
|
|
|
|
folding switch statements on machines using casesi (such as
|
|
|
|
|
the VAX). */
|
|
|
|
|
if (GET_CODE (op) == TRUNCATE
|
|
|
|
|
&& GET_MODE (XEXP (op, 0)) == mode
|
|
|
|
|
&& GET_CODE (XEXP (op, 0)) == MINUS
|
|
|
|
|
&& GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF
|
|
|
|
|
&& GET_CODE (XEXP (XEXP (op, 0), 1)) == LABEL_REF)
|
|
|
|
|
return XEXP (op, 0);
|
|
|
|
|
|
|
|
|
|
/* Check for a sign extension of a subreg of a promoted
|
|
|
|
|
variable, where the promotion is sign-extended, and the
|
|
|
|
|
target mode is the same as the variable's promotion. */
|
|
|
|
|
if (GET_CODE (op) == SUBREG
|
|
|
|
|
&& SUBREG_PROMOTED_VAR_P (op)
|
|
|
|
|
&& ! SUBREG_PROMOTED_UNSIGNED_P (op)
|
2008-02-28 21:02:09 +01:00
|
|
|
|
&& GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (XEXP (op, 0))))
|
|
|
|
|
return rtl_hooks.gen_lowpart_no_emit (mode, op);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|
|
|
|
|
#if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
|
|
|
|
|
if (! POINTERS_EXTEND_UNSIGNED
|
|
|
|
|
&& mode == Pmode && GET_MODE (op) == ptr_mode
|
|
|
|
|
&& (CONSTANT_P (op)
|
|
|
|
|
|| (GET_CODE (op) == SUBREG
|
|
|
|
|
&& REG_P (SUBREG_REG (op))
|
|
|
|
|
&& REG_POINTER (SUBREG_REG (op))
|
|
|
|
|
&& GET_MODE (SUBREG_REG (op)) == Pmode)))
|
|
|
|
|
return convert_memory_address (Pmode, op);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZERO_EXTEND:
|
|
|
|
|
/* Check for a zero extension of a subreg of a promoted
|
|
|
|
|
variable, where the promotion is zero-extended, and the
|
|
|
|
|
target mode is the same as the variable's promotion. */
|
|
|
|
|
if (GET_CODE (op) == SUBREG
|
|
|
|
|
&& SUBREG_PROMOTED_VAR_P (op)
|
2005-04-07 10:21:31 +02:00
|
|
|
|
&& SUBREG_PROMOTED_UNSIGNED_P (op) > 0
|
2008-02-28 21:02:09 +01:00
|
|
|
|
&& GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (XEXP (op, 0))))
|
|
|
|
|
return rtl_hooks.gen_lowpart_no_emit (mode, op);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|
|
|
|
|
#if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
|
|
|
|
|
if (POINTERS_EXTEND_UNSIGNED > 0
|
|
|
|
|
&& mode == Pmode && GET_MODE (op) == ptr_mode
|
|
|
|
|
&& (CONSTANT_P (op)
|
|
|
|
|
|| (GET_CODE (op) == SUBREG
|
|
|
|
|
&& REG_P (SUBREG_REG (op))
|
|
|
|
|
&& REG_POINTER (SUBREG_REG (op))
|
|
|
|
|
&& GET_MODE (SUBREG_REG (op)) == Pmode)))
|
|
|
|
|
return convert_memory_address (Pmode, op);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Try to compute the value of a unary operation CODE whose output mode is to
|
|
|
|
|
be MODE with input operand OP whose mode was originally OP_MODE.
|
|
|
|
|
Return zero if the value cannot be computed. */
|
|
|
|
|
rtx
|
|
|
|
|
simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
|
|
|
|
|
rtx op, enum machine_mode op_mode)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
unsigned int width = GET_MODE_BITSIZE (mode);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2003-02-09 13:35:28 +01:00
|
|
|
|
if (code == VEC_DUPLICATE)
|
|
|
|
|
{
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (VECTOR_MODE_P (mode));
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (GET_MODE (op) != VOIDmode)
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (!VECTOR_MODE_P (GET_MODE (op)))
|
|
|
|
|
gcc_assert (GET_MODE_INNER (mode) == GET_MODE (op));
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
else
|
|
|
|
|
gcc_assert (GET_MODE_INNER (mode) == GET_MODE_INNER
|
2005-02-28 16:29:43 +01:00
|
|
|
|
(GET_MODE (op)));
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
}
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op) || GET_CODE (op) == CONST_DOUBLE
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|| GET_CODE (op) == CONST_VECTOR)
|
2003-02-09 13:35:28 +01:00
|
|
|
|
{
|
|
|
|
|
int elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode));
|
|
|
|
|
unsigned n_elts = (GET_MODE_SIZE (mode) / elt_size);
|
|
|
|
|
rtvec v = rtvec_alloc (n_elts);
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (GET_CODE (op) != CONST_VECTOR)
|
2003-02-09 13:35:28 +01:00
|
|
|
|
for (i = 0; i < n_elts; i++)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
RTVEC_ELT (v, i) = op;
|
2003-02-09 13:35:28 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
enum machine_mode inmode = GET_MODE (op);
|
2003-02-09 13:35:28 +01:00
|
|
|
|
int in_elt_size = GET_MODE_SIZE (GET_MODE_INNER (inmode));
|
|
|
|
|
unsigned in_n_elts = (GET_MODE_SIZE (inmode) / in_elt_size);
|
|
|
|
|
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (in_n_elts < n_elts);
|
|
|
|
|
gcc_assert ((n_elts % in_n_elts) == 0);
|
2003-02-09 13:35:28 +01:00
|
|
|
|
for (i = 0; i < n_elts; i++)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
RTVEC_ELT (v, i) = CONST_VECTOR_ELT (op, i % in_n_elts);
|
2003-02-09 13:35:28 +01:00
|
|
|
|
}
|
|
|
|
|
return gen_rtx_CONST_VECTOR (mode, v);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (VECTOR_MODE_P (mode) && GET_CODE (op) == CONST_VECTOR)
|
2003-02-09 23:55:35 +01:00
|
|
|
|
{
|
|
|
|
|
int elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode));
|
|
|
|
|
unsigned n_elts = (GET_MODE_SIZE (mode) / elt_size);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
enum machine_mode opmode = GET_MODE (op);
|
2003-02-09 23:55:35 +01:00
|
|
|
|
int op_elt_size = GET_MODE_SIZE (GET_MODE_INNER (opmode));
|
|
|
|
|
unsigned op_n_elts = (GET_MODE_SIZE (opmode) / op_elt_size);
|
|
|
|
|
rtvec v = rtvec_alloc (n_elts);
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (op_n_elts == n_elts);
|
2003-02-09 23:55:35 +01:00
|
|
|
|
for (i = 0; i < n_elts; i++)
|
|
|
|
|
{
|
|
|
|
|
rtx x = simplify_unary_operation (code, GET_MODE_INNER (mode),
|
2005-02-28 16:29:43 +01:00
|
|
|
|
CONST_VECTOR_ELT (op, i),
|
2003-02-09 23:55:35 +01:00
|
|
|
|
GET_MODE_INNER (opmode));
|
|
|
|
|
if (!x)
|
|
|
|
|
return 0;
|
|
|
|
|
RTVEC_ELT (v, i) = x;
|
|
|
|
|
}
|
|
|
|
|
return gen_rtx_CONST_VECTOR (mode, v);
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
/* The order of these tests is critical so that, for example, we don't
|
|
|
|
|
check the wrong mode (input vs. output) for a conversion operation,
|
|
|
|
|
such as FIX. At some point, this should be simplified. */
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (code == FLOAT && GET_MODE (op) == VOIDmode
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& (GET_CODE (op) == CONST_DOUBLE || CONST_INT_P (op)))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
|
|
|
|
HOST_WIDE_INT hv, lv;
|
|
|
|
|
REAL_VALUE_TYPE d;
|
|
|
|
|
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
lv = INTVAL (op), hv = HWI_SIGN_EXTEND (lv);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
else
|
2005-02-28 16:29:43 +01:00
|
|
|
|
lv = CONST_DOUBLE_LOW (op), hv = CONST_DOUBLE_HIGH (op);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
REAL_VALUE_FROM_INT (d, lv, hv, mode);
|
|
|
|
|
d = real_value_truncate (mode, d);
|
|
|
|
|
return CONST_DOUBLE_FROM_REAL_VALUE (d, mode);
|
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
else if (code == UNSIGNED_FLOAT && GET_MODE (op) == VOIDmode
|
|
|
|
|
&& (GET_CODE (op) == CONST_DOUBLE
|
2009-06-22 12:29:13 +02:00
|
|
|
|
|| CONST_INT_P (op)))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
|
|
|
|
HOST_WIDE_INT hv, lv;
|
|
|
|
|
REAL_VALUE_TYPE d;
|
|
|
|
|
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
lv = INTVAL (op), hv = HWI_SIGN_EXTEND (lv);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
else
|
2005-02-28 16:29:43 +01:00
|
|
|
|
lv = CONST_DOUBLE_LOW (op), hv = CONST_DOUBLE_HIGH (op);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
if (op_mode == VOIDmode)
|
|
|
|
|
{
|
|
|
|
|
/* We don't know how to interpret negative-looking numbers in
|
|
|
|
|
this case, so don't try to fold those. */
|
|
|
|
|
if (hv < 0)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else if (GET_MODE_BITSIZE (op_mode) >= HOST_BITS_PER_WIDE_INT * 2)
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
hv = 0, lv &= GET_MODE_MASK (op_mode);
|
|
|
|
|
|
|
|
|
|
REAL_VALUE_FROM_UNSIGNED_INT (d, lv, hv, mode);
|
|
|
|
|
d = real_value_truncate (mode, d);
|
|
|
|
|
return CONST_DOUBLE_FROM_REAL_VALUE (d, mode);
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
&& width <= HOST_BITS_PER_WIDE_INT && width > 0)
|
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
HOST_WIDE_INT arg0 = INTVAL (op);
|
2001-10-11 05:16:15 +02:00
|
|
|
|
HOST_WIDE_INT val;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case NOT:
|
|
|
|
|
val = ~ arg0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NEG:
|
|
|
|
|
val = - arg0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ABS:
|
|
|
|
|
val = (arg0 >= 0 ? arg0 : - arg0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FFS:
|
|
|
|
|
/* Don't use ffs here. Instead, get low order bit and then its
|
|
|
|
|
number. If arg0 is zero, this will return 0, as desired. */
|
|
|
|
|
arg0 &= GET_MODE_MASK (mode);
|
|
|
|
|
val = exact_log2 (arg0 & (- arg0)) + 1;
|
|
|
|
|
break;
|
|
|
|
|
|
[multiple changes]
2003-02-01 Richard Henderson <rth@redhat.com>
* optabs.c (expand_unop): Use word_mode for outmode of bit scaners.
* libgcc2.c (__ffsdi2, __clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2): Change
return type to Wtype.
* libgcc-std.ver (GCC_3.4): Fix inheritance.
* config/i386/i386.md (ffssi2): Use nonimmediate_operand for
expander input constraint.
2003-02-01 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
* optabs.h (optab_index): Add OTI_clz, OTI_ctz, OTI_popcount and
OTI_parity.
(clz_optab, ctz_optab, popcount_optab, parity_optab): New.
* optabs.c (widen_clz, expand_parity): New.
(expand_unop): Handle clz and parity. Hardcode SImode as outmode
for libcalls to clz, ctz, popcount, and parity.
(init_optabs): Init clz_optab, ctz_optab, popcount_optab and
parity_optab, and set up libfunc handlers.
* libgcc2.c (__clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2,
__popcount_tab): New.
* libgcc2.h: Declare them.
* libgcc-std.ver (GCC_3.4): Add new functions from libgcc2.c.
* genopinit.c (optabs): Add clz_optab, ctz_optab, popcount_optab
and parity_optab.
* builtin-types.def (BT_FN_INT_LONG, BT_FN_INT_LONGLONG): New.
* builtins.def (BUILT_IN_CLZ, BUILT_IN_CTZ, BUILT_IN_POPCOUNT,
BUILT_IN_PARITY, BUILT_IN_FFSL, BUILT_IN_CLZL, BUILT_IN_CTZL,
BUILT_IN_POPCOUNTL, BUILT_IN_PARITYL, BUILT_IN_FFSLL,
BUILT_IN_CLZLL, BUILT_IN_CTZLL, BUILT_IN_POPCOUNTLL,
BUILT_IN_PARITYLL): New.
* builtins.c (expand_builtin_unop): Rename from expand_builtin_ffs
and add optab argument.
(expand_builtin): Expand BUILT_IN_{FFS,CLZ,POPCOUNT,PARITY}*.
* tree.def (CLZ_EXPR, CTZ_EXPR, POPCOUNT_EXPR, PARITY_EXPR): New.
* expr.c (expand_expr): Handle them.
* fold-const.c (tree_expr_nonnegative_p): Likewise.
* rtl.def (CLZ, CTZ, POPCOUNT, PARITY): New.
* reload1.c (eliminate_regs): Handle them.
(elimination_effects): Likewise.
* function.c (instantiate_virtual_regs_1): Likewise
* genattrtab.c (check_attr_value): Likewise.
* simplify-rtx.c (simplify_unary_operation): Likewise.
* c-common.c (c_common_truthvalue_conversion): Handle POPCOUNT_EXPR.
* combine.c (combine_simplify_rtx): Handle POPCOUNT and PARITY.
(nonzero_bits): Handle CLZ, CTZ, POPCOUNT and PARITY.
* config/alpha/alpha.md (clzdi2, ctzdi2, popcountdi2): New.
* config/arm/arm.c (arm_init_builtins): Rename __builtin_clz to
__builtin_arm_clz.
* Makefile.in (LIB2FUNCS_1, LIB2FUNCS_2): Move...
* mklibgcc.in (lib2funcs): ...here and merge. Add new members.
* doc/extend.texi (Other Builtins): Add new builtins.
* doc/md.texi (Standard Names): Add new patterns.
From-SVN: r62252
2003-02-01 20:00:02 +01:00
|
|
|
|
case CLZ:
|
|
|
|
|
arg0 &= GET_MODE_MASK (mode);
|
2003-02-05 23:37:54 +01:00
|
|
|
|
if (arg0 == 0 && CLZ_DEFINED_VALUE_AT_ZERO (mode, val))
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
val = GET_MODE_BITSIZE (mode) - floor_log2 (arg0) - 1;
|
[multiple changes]
2003-02-01 Richard Henderson <rth@redhat.com>
* optabs.c (expand_unop): Use word_mode for outmode of bit scaners.
* libgcc2.c (__ffsdi2, __clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2): Change
return type to Wtype.
* libgcc-std.ver (GCC_3.4): Fix inheritance.
* config/i386/i386.md (ffssi2): Use nonimmediate_operand for
expander input constraint.
2003-02-01 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
* optabs.h (optab_index): Add OTI_clz, OTI_ctz, OTI_popcount and
OTI_parity.
(clz_optab, ctz_optab, popcount_optab, parity_optab): New.
* optabs.c (widen_clz, expand_parity): New.
(expand_unop): Handle clz and parity. Hardcode SImode as outmode
for libcalls to clz, ctz, popcount, and parity.
(init_optabs): Init clz_optab, ctz_optab, popcount_optab and
parity_optab, and set up libfunc handlers.
* libgcc2.c (__clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2,
__popcount_tab): New.
* libgcc2.h: Declare them.
* libgcc-std.ver (GCC_3.4): Add new functions from libgcc2.c.
* genopinit.c (optabs): Add clz_optab, ctz_optab, popcount_optab
and parity_optab.
* builtin-types.def (BT_FN_INT_LONG, BT_FN_INT_LONGLONG): New.
* builtins.def (BUILT_IN_CLZ, BUILT_IN_CTZ, BUILT_IN_POPCOUNT,
BUILT_IN_PARITY, BUILT_IN_FFSL, BUILT_IN_CLZL, BUILT_IN_CTZL,
BUILT_IN_POPCOUNTL, BUILT_IN_PARITYL, BUILT_IN_FFSLL,
BUILT_IN_CLZLL, BUILT_IN_CTZLL, BUILT_IN_POPCOUNTLL,
BUILT_IN_PARITYLL): New.
* builtins.c (expand_builtin_unop): Rename from expand_builtin_ffs
and add optab argument.
(expand_builtin): Expand BUILT_IN_{FFS,CLZ,POPCOUNT,PARITY}*.
* tree.def (CLZ_EXPR, CTZ_EXPR, POPCOUNT_EXPR, PARITY_EXPR): New.
* expr.c (expand_expr): Handle them.
* fold-const.c (tree_expr_nonnegative_p): Likewise.
* rtl.def (CLZ, CTZ, POPCOUNT, PARITY): New.
* reload1.c (eliminate_regs): Handle them.
(elimination_effects): Likewise.
* function.c (instantiate_virtual_regs_1): Likewise
* genattrtab.c (check_attr_value): Likewise.
* simplify-rtx.c (simplify_unary_operation): Likewise.
* c-common.c (c_common_truthvalue_conversion): Handle POPCOUNT_EXPR.
* combine.c (combine_simplify_rtx): Handle POPCOUNT and PARITY.
(nonzero_bits): Handle CLZ, CTZ, POPCOUNT and PARITY.
* config/alpha/alpha.md (clzdi2, ctzdi2, popcountdi2): New.
* config/arm/arm.c (arm_init_builtins): Rename __builtin_clz to
__builtin_arm_clz.
* Makefile.in (LIB2FUNCS_1, LIB2FUNCS_2): Move...
* mklibgcc.in (lib2funcs): ...here and merge. Add new members.
* doc/extend.texi (Other Builtins): Add new builtins.
* doc/md.texi (Standard Names): Add new patterns.
From-SVN: r62252
2003-02-01 20:00:02 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CTZ:
|
|
|
|
|
arg0 &= GET_MODE_MASK (mode);
|
2003-02-05 23:37:54 +01:00
|
|
|
|
if (arg0 == 0)
|
|
|
|
|
{
|
|
|
|
|
/* Even if the value at zero is undefined, we have to come
|
|
|
|
|
up with some replacement. Seems good enough. */
|
|
|
|
|
if (! CTZ_DEFINED_VALUE_AT_ZERO (mode, val))
|
|
|
|
|
val = GET_MODE_BITSIZE (mode);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
val = exact_log2 (arg0 & -arg0);
|
[multiple changes]
2003-02-01 Richard Henderson <rth@redhat.com>
* optabs.c (expand_unop): Use word_mode for outmode of bit scaners.
* libgcc2.c (__ffsdi2, __clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2): Change
return type to Wtype.
* libgcc-std.ver (GCC_3.4): Fix inheritance.
* config/i386/i386.md (ffssi2): Use nonimmediate_operand for
expander input constraint.
2003-02-01 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
* optabs.h (optab_index): Add OTI_clz, OTI_ctz, OTI_popcount and
OTI_parity.
(clz_optab, ctz_optab, popcount_optab, parity_optab): New.
* optabs.c (widen_clz, expand_parity): New.
(expand_unop): Handle clz and parity. Hardcode SImode as outmode
for libcalls to clz, ctz, popcount, and parity.
(init_optabs): Init clz_optab, ctz_optab, popcount_optab and
parity_optab, and set up libfunc handlers.
* libgcc2.c (__clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2,
__popcount_tab): New.
* libgcc2.h: Declare them.
* libgcc-std.ver (GCC_3.4): Add new functions from libgcc2.c.
* genopinit.c (optabs): Add clz_optab, ctz_optab, popcount_optab
and parity_optab.
* builtin-types.def (BT_FN_INT_LONG, BT_FN_INT_LONGLONG): New.
* builtins.def (BUILT_IN_CLZ, BUILT_IN_CTZ, BUILT_IN_POPCOUNT,
BUILT_IN_PARITY, BUILT_IN_FFSL, BUILT_IN_CLZL, BUILT_IN_CTZL,
BUILT_IN_POPCOUNTL, BUILT_IN_PARITYL, BUILT_IN_FFSLL,
BUILT_IN_CLZLL, BUILT_IN_CTZLL, BUILT_IN_POPCOUNTLL,
BUILT_IN_PARITYLL): New.
* builtins.c (expand_builtin_unop): Rename from expand_builtin_ffs
and add optab argument.
(expand_builtin): Expand BUILT_IN_{FFS,CLZ,POPCOUNT,PARITY}*.
* tree.def (CLZ_EXPR, CTZ_EXPR, POPCOUNT_EXPR, PARITY_EXPR): New.
* expr.c (expand_expr): Handle them.
* fold-const.c (tree_expr_nonnegative_p): Likewise.
* rtl.def (CLZ, CTZ, POPCOUNT, PARITY): New.
* reload1.c (eliminate_regs): Handle them.
(elimination_effects): Likewise.
* function.c (instantiate_virtual_regs_1): Likewise
* genattrtab.c (check_attr_value): Likewise.
* simplify-rtx.c (simplify_unary_operation): Likewise.
* c-common.c (c_common_truthvalue_conversion): Handle POPCOUNT_EXPR.
* combine.c (combine_simplify_rtx): Handle POPCOUNT and PARITY.
(nonzero_bits): Handle CLZ, CTZ, POPCOUNT and PARITY.
* config/alpha/alpha.md (clzdi2, ctzdi2, popcountdi2): New.
* config/arm/arm.c (arm_init_builtins): Rename __builtin_clz to
__builtin_arm_clz.
* Makefile.in (LIB2FUNCS_1, LIB2FUNCS_2): Move...
* mklibgcc.in (lib2funcs): ...here and merge. Add new members.
* doc/extend.texi (Other Builtins): Add new builtins.
* doc/md.texi (Standard Names): Add new patterns.
From-SVN: r62252
2003-02-01 20:00:02 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case POPCOUNT:
|
|
|
|
|
arg0 &= GET_MODE_MASK (mode);
|
|
|
|
|
val = 0;
|
|
|
|
|
while (arg0)
|
|
|
|
|
val++, arg0 &= arg0 - 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PARITY:
|
|
|
|
|
arg0 &= GET_MODE_MASK (mode);
|
|
|
|
|
val = 0;
|
|
|
|
|
while (arg0)
|
|
|
|
|
val++, arg0 &= arg0 - 1;
|
|
|
|
|
val &= 1;
|
|
|
|
|
break;
|
|
|
|
|
|
2006-11-01 06:14:40 +01:00
|
|
|
|
case BSWAP:
|
2007-02-08 18:10:56 +01:00
|
|
|
|
{
|
|
|
|
|
unsigned int s;
|
|
|
|
|
|
|
|
|
|
val = 0;
|
|
|
|
|
for (s = 0; s < width; s += 8)
|
|
|
|
|
{
|
|
|
|
|
unsigned int d = width - s - 8;
|
|
|
|
|
unsigned HOST_WIDE_INT byte;
|
|
|
|
|
byte = (arg0 >> s) & 0xff;
|
|
|
|
|
val |= byte << d;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2006-11-01 06:14:40 +01:00
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
case TRUNCATE:
|
|
|
|
|
val = arg0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZERO_EXTEND:
|
2002-02-21 00:15:00 +01:00
|
|
|
|
/* When zero-extending a CONST_INT, we need to know its
|
|
|
|
|
original mode. */
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (op_mode != VOIDmode);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
if (GET_MODE_BITSIZE (op_mode) == HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
|
|
|
|
/* If we were really extending the mode,
|
|
|
|
|
we would have to distinguish between zero-extension
|
|
|
|
|
and sign-extension. */
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (width == GET_MODE_BITSIZE (op_mode));
|
1999-11-01 01:18:23 +01:00
|
|
|
|
val = arg0;
|
|
|
|
|
}
|
|
|
|
|
else if (GET_MODE_BITSIZE (op_mode) < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
val = arg0 & ~((HOST_WIDE_INT) (-1) << GET_MODE_BITSIZE (op_mode));
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SIGN_EXTEND:
|
|
|
|
|
if (op_mode == VOIDmode)
|
|
|
|
|
op_mode = mode;
|
|
|
|
|
if (GET_MODE_BITSIZE (op_mode) == HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
|
|
|
|
/* If we were really extending the mode,
|
|
|
|
|
we would have to distinguish between zero-extension
|
|
|
|
|
and sign-extension. */
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (width == GET_MODE_BITSIZE (op_mode));
|
1999-11-01 01:18:23 +01:00
|
|
|
|
val = arg0;
|
|
|
|
|
}
|
|
|
|
|
else if (GET_MODE_BITSIZE (op_mode) < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
|
|
|
|
val
|
|
|
|
|
= arg0 & ~((HOST_WIDE_INT) (-1) << GET_MODE_BITSIZE (op_mode));
|
|
|
|
|
if (val
|
|
|
|
|
& ((HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (op_mode) - 1)))
|
|
|
|
|
val -= (HOST_WIDE_INT) 1 << GET_MODE_BITSIZE (op_mode);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SQRT:
|
2000-09-17 16:33:37 +02:00
|
|
|
|
case FLOAT_EXTEND:
|
|
|
|
|
case FLOAT_TRUNCATE:
|
2002-01-12 08:38:50 +01:00
|
|
|
|
case SS_TRUNCATE:
|
|
|
|
|
case US_TRUNCATE:
|
2006-04-24 21:35:38 +02:00
|
|
|
|
case SS_NEG:
|
c-lex.c (interpret_fixed): Declare.
* c-lex.c (interpret_fixed): Declare.
(interpret_float): Process _Fract and _Accum.
(interpret_fixed): New function.
* final.c (output_addr_const): Process CONST_FIXED.
* simplify-rtx.c (simplify_const_unary_operation): Handle US_NEG.
(simplify_binary_operation_1): Handle US_ASHIFT, SS_MULT, US_MULT,
SS_DIV, US_DIV.
(simplify_const_binary_operation): Handle SS_MULT, US_MULT, SS_DIV,
US_DIV, US_ASHIFT.
(simplify_immed_subreg): Support CONST_FIXED.
Process MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.
(simplify_subreg): Support CONST_FIXED.
From-SVN: r127941
2007-08-31 01:09:28 +02:00
|
|
|
|
case US_NEG:
|
1999-11-01 01:18:23 +01:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
default:
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_unreachable ();
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
2005-03-05 18:25:33 +01:00
|
|
|
|
return gen_int_mode (val, mode);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We can do some operations on integer CONST_DOUBLEs. Also allow
|
|
|
|
|
for a DImode operation on a CONST_INT. */
|
2005-02-28 16:29:43 +01:00
|
|
|
|
else if (GET_MODE (op) == VOIDmode
|
2002-02-21 00:15:00 +01:00
|
|
|
|
&& width <= HOST_BITS_PER_WIDE_INT * 2
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& (GET_CODE (op) == CONST_DOUBLE
|
2009-06-22 12:29:13 +02:00
|
|
|
|
|| CONST_INT_P (op)))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2000-05-23 20:06:22 +02:00
|
|
|
|
unsigned HOST_WIDE_INT l1, lv;
|
|
|
|
|
HOST_WIDE_INT h1, hv;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (GET_CODE (op) == CONST_DOUBLE)
|
|
|
|
|
l1 = CONST_DOUBLE_LOW (op), h1 = CONST_DOUBLE_HIGH (op);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
else
|
2005-02-28 16:29:43 +01:00
|
|
|
|
l1 = INTVAL (op), h1 = HWI_SIGN_EXTEND (l1);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case NOT:
|
|
|
|
|
lv = ~ l1;
|
|
|
|
|
hv = ~ h1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NEG:
|
|
|
|
|
neg_double (l1, h1, &lv, &hv);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ABS:
|
|
|
|
|
if (h1 < 0)
|
|
|
|
|
neg_double (l1, h1, &lv, &hv);
|
|
|
|
|
else
|
|
|
|
|
lv = l1, hv = h1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FFS:
|
|
|
|
|
hv = 0;
|
|
|
|
|
if (l1 == 0)
|
[multiple changes]
2003-02-01 Richard Henderson <rth@redhat.com>
* optabs.c (expand_unop): Use word_mode for outmode of bit scaners.
* libgcc2.c (__ffsdi2, __clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2): Change
return type to Wtype.
* libgcc-std.ver (GCC_3.4): Fix inheritance.
* config/i386/i386.md (ffssi2): Use nonimmediate_operand for
expander input constraint.
2003-02-01 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
* optabs.h (optab_index): Add OTI_clz, OTI_ctz, OTI_popcount and
OTI_parity.
(clz_optab, ctz_optab, popcount_optab, parity_optab): New.
* optabs.c (widen_clz, expand_parity): New.
(expand_unop): Handle clz and parity. Hardcode SImode as outmode
for libcalls to clz, ctz, popcount, and parity.
(init_optabs): Init clz_optab, ctz_optab, popcount_optab and
parity_optab, and set up libfunc handlers.
* libgcc2.c (__clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2,
__popcount_tab): New.
* libgcc2.h: Declare them.
* libgcc-std.ver (GCC_3.4): Add new functions from libgcc2.c.
* genopinit.c (optabs): Add clz_optab, ctz_optab, popcount_optab
and parity_optab.
* builtin-types.def (BT_FN_INT_LONG, BT_FN_INT_LONGLONG): New.
* builtins.def (BUILT_IN_CLZ, BUILT_IN_CTZ, BUILT_IN_POPCOUNT,
BUILT_IN_PARITY, BUILT_IN_FFSL, BUILT_IN_CLZL, BUILT_IN_CTZL,
BUILT_IN_POPCOUNTL, BUILT_IN_PARITYL, BUILT_IN_FFSLL,
BUILT_IN_CLZLL, BUILT_IN_CTZLL, BUILT_IN_POPCOUNTLL,
BUILT_IN_PARITYLL): New.
* builtins.c (expand_builtin_unop): Rename from expand_builtin_ffs
and add optab argument.
(expand_builtin): Expand BUILT_IN_{FFS,CLZ,POPCOUNT,PARITY}*.
* tree.def (CLZ_EXPR, CTZ_EXPR, POPCOUNT_EXPR, PARITY_EXPR): New.
* expr.c (expand_expr): Handle them.
* fold-const.c (tree_expr_nonnegative_p): Likewise.
* rtl.def (CLZ, CTZ, POPCOUNT, PARITY): New.
* reload1.c (eliminate_regs): Handle them.
(elimination_effects): Likewise.
* function.c (instantiate_virtual_regs_1): Likewise
* genattrtab.c (check_attr_value): Likewise.
* simplify-rtx.c (simplify_unary_operation): Likewise.
* c-common.c (c_common_truthvalue_conversion): Handle POPCOUNT_EXPR.
* combine.c (combine_simplify_rtx): Handle POPCOUNT and PARITY.
(nonzero_bits): Handle CLZ, CTZ, POPCOUNT and PARITY.
* config/alpha/alpha.md (clzdi2, ctzdi2, popcountdi2): New.
* config/arm/arm.c (arm_init_builtins): Rename __builtin_clz to
__builtin_arm_clz.
* Makefile.in (LIB2FUNCS_1, LIB2FUNCS_2): Move...
* mklibgcc.in (lib2funcs): ...here and merge. Add new members.
* doc/extend.texi (Other Builtins): Add new builtins.
* doc/md.texi (Standard Names): Add new patterns.
From-SVN: r62252
2003-02-01 20:00:02 +01:00
|
|
|
|
{
|
|
|
|
|
if (h1 == 0)
|
|
|
|
|
lv = 0;
|
|
|
|
|
else
|
|
|
|
|
lv = HOST_BITS_PER_WIDE_INT + exact_log2 (h1 & -h1) + 1;
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
else
|
[multiple changes]
2003-02-01 Richard Henderson <rth@redhat.com>
* optabs.c (expand_unop): Use word_mode for outmode of bit scaners.
* libgcc2.c (__ffsdi2, __clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2): Change
return type to Wtype.
* libgcc-std.ver (GCC_3.4): Fix inheritance.
* config/i386/i386.md (ffssi2): Use nonimmediate_operand for
expander input constraint.
2003-02-01 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
* optabs.h (optab_index): Add OTI_clz, OTI_ctz, OTI_popcount and
OTI_parity.
(clz_optab, ctz_optab, popcount_optab, parity_optab): New.
* optabs.c (widen_clz, expand_parity): New.
(expand_unop): Handle clz and parity. Hardcode SImode as outmode
for libcalls to clz, ctz, popcount, and parity.
(init_optabs): Init clz_optab, ctz_optab, popcount_optab and
parity_optab, and set up libfunc handlers.
* libgcc2.c (__clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2,
__popcount_tab): New.
* libgcc2.h: Declare them.
* libgcc-std.ver (GCC_3.4): Add new functions from libgcc2.c.
* genopinit.c (optabs): Add clz_optab, ctz_optab, popcount_optab
and parity_optab.
* builtin-types.def (BT_FN_INT_LONG, BT_FN_INT_LONGLONG): New.
* builtins.def (BUILT_IN_CLZ, BUILT_IN_CTZ, BUILT_IN_POPCOUNT,
BUILT_IN_PARITY, BUILT_IN_FFSL, BUILT_IN_CLZL, BUILT_IN_CTZL,
BUILT_IN_POPCOUNTL, BUILT_IN_PARITYL, BUILT_IN_FFSLL,
BUILT_IN_CLZLL, BUILT_IN_CTZLL, BUILT_IN_POPCOUNTLL,
BUILT_IN_PARITYLL): New.
* builtins.c (expand_builtin_unop): Rename from expand_builtin_ffs
and add optab argument.
(expand_builtin): Expand BUILT_IN_{FFS,CLZ,POPCOUNT,PARITY}*.
* tree.def (CLZ_EXPR, CTZ_EXPR, POPCOUNT_EXPR, PARITY_EXPR): New.
* expr.c (expand_expr): Handle them.
* fold-const.c (tree_expr_nonnegative_p): Likewise.
* rtl.def (CLZ, CTZ, POPCOUNT, PARITY): New.
* reload1.c (eliminate_regs): Handle them.
(elimination_effects): Likewise.
* function.c (instantiate_virtual_regs_1): Likewise
* genattrtab.c (check_attr_value): Likewise.
* simplify-rtx.c (simplify_unary_operation): Likewise.
* c-common.c (c_common_truthvalue_conversion): Handle POPCOUNT_EXPR.
* combine.c (combine_simplify_rtx): Handle POPCOUNT and PARITY.
(nonzero_bits): Handle CLZ, CTZ, POPCOUNT and PARITY.
* config/alpha/alpha.md (clzdi2, ctzdi2, popcountdi2): New.
* config/arm/arm.c (arm_init_builtins): Rename __builtin_clz to
__builtin_arm_clz.
* Makefile.in (LIB2FUNCS_1, LIB2FUNCS_2): Move...
* mklibgcc.in (lib2funcs): ...here and merge. Add new members.
* doc/extend.texi (Other Builtins): Add new builtins.
* doc/md.texi (Standard Names): Add new patterns.
From-SVN: r62252
2003-02-01 20:00:02 +01:00
|
|
|
|
lv = exact_log2 (l1 & -l1) + 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CLZ:
|
|
|
|
|
hv = 0;
|
2003-08-26 15:22:14 +02:00
|
|
|
|
if (h1 != 0)
|
[multiple changes]
2003-02-01 Richard Henderson <rth@redhat.com>
* optabs.c (expand_unop): Use word_mode for outmode of bit scaners.
* libgcc2.c (__ffsdi2, __clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2): Change
return type to Wtype.
* libgcc-std.ver (GCC_3.4): Fix inheritance.
* config/i386/i386.md (ffssi2): Use nonimmediate_operand for
expander input constraint.
2003-02-01 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
* optabs.h (optab_index): Add OTI_clz, OTI_ctz, OTI_popcount and
OTI_parity.
(clz_optab, ctz_optab, popcount_optab, parity_optab): New.
* optabs.c (widen_clz, expand_parity): New.
(expand_unop): Handle clz and parity. Hardcode SImode as outmode
for libcalls to clz, ctz, popcount, and parity.
(init_optabs): Init clz_optab, ctz_optab, popcount_optab and
parity_optab, and set up libfunc handlers.
* libgcc2.c (__clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2,
__popcount_tab): New.
* libgcc2.h: Declare them.
* libgcc-std.ver (GCC_3.4): Add new functions from libgcc2.c.
* genopinit.c (optabs): Add clz_optab, ctz_optab, popcount_optab
and parity_optab.
* builtin-types.def (BT_FN_INT_LONG, BT_FN_INT_LONGLONG): New.
* builtins.def (BUILT_IN_CLZ, BUILT_IN_CTZ, BUILT_IN_POPCOUNT,
BUILT_IN_PARITY, BUILT_IN_FFSL, BUILT_IN_CLZL, BUILT_IN_CTZL,
BUILT_IN_POPCOUNTL, BUILT_IN_PARITYL, BUILT_IN_FFSLL,
BUILT_IN_CLZLL, BUILT_IN_CTZLL, BUILT_IN_POPCOUNTLL,
BUILT_IN_PARITYLL): New.
* builtins.c (expand_builtin_unop): Rename from expand_builtin_ffs
and add optab argument.
(expand_builtin): Expand BUILT_IN_{FFS,CLZ,POPCOUNT,PARITY}*.
* tree.def (CLZ_EXPR, CTZ_EXPR, POPCOUNT_EXPR, PARITY_EXPR): New.
* expr.c (expand_expr): Handle them.
* fold-const.c (tree_expr_nonnegative_p): Likewise.
* rtl.def (CLZ, CTZ, POPCOUNT, PARITY): New.
* reload1.c (eliminate_regs): Handle them.
(elimination_effects): Likewise.
* function.c (instantiate_virtual_regs_1): Likewise
* genattrtab.c (check_attr_value): Likewise.
* simplify-rtx.c (simplify_unary_operation): Likewise.
* c-common.c (c_common_truthvalue_conversion): Handle POPCOUNT_EXPR.
* combine.c (combine_simplify_rtx): Handle POPCOUNT and PARITY.
(nonzero_bits): Handle CLZ, CTZ, POPCOUNT and PARITY.
* config/alpha/alpha.md (clzdi2, ctzdi2, popcountdi2): New.
* config/arm/arm.c (arm_init_builtins): Rename __builtin_clz to
__builtin_arm_clz.
* Makefile.in (LIB2FUNCS_1, LIB2FUNCS_2): Move...
* mklibgcc.in (lib2funcs): ...here and merge. Add new members.
* doc/extend.texi (Other Builtins): Add new builtins.
* doc/md.texi (Standard Names): Add new patterns.
From-SVN: r62252
2003-02-01 20:00:02 +01:00
|
|
|
|
lv = GET_MODE_BITSIZE (mode) - floor_log2 (h1) - 1
|
|
|
|
|
- HOST_BITS_PER_WIDE_INT;
|
2003-08-26 15:22:14 +02:00
|
|
|
|
else if (l1 != 0)
|
|
|
|
|
lv = GET_MODE_BITSIZE (mode) - floor_log2 (l1) - 1;
|
|
|
|
|
else if (! CLZ_DEFINED_VALUE_AT_ZERO (mode, lv))
|
|
|
|
|
lv = GET_MODE_BITSIZE (mode);
|
[multiple changes]
2003-02-01 Richard Henderson <rth@redhat.com>
* optabs.c (expand_unop): Use word_mode for outmode of bit scaners.
* libgcc2.c (__ffsdi2, __clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2): Change
return type to Wtype.
* libgcc-std.ver (GCC_3.4): Fix inheritance.
* config/i386/i386.md (ffssi2): Use nonimmediate_operand for
expander input constraint.
2003-02-01 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
* optabs.h (optab_index): Add OTI_clz, OTI_ctz, OTI_popcount and
OTI_parity.
(clz_optab, ctz_optab, popcount_optab, parity_optab): New.
* optabs.c (widen_clz, expand_parity): New.
(expand_unop): Handle clz and parity. Hardcode SImode as outmode
for libcalls to clz, ctz, popcount, and parity.
(init_optabs): Init clz_optab, ctz_optab, popcount_optab and
parity_optab, and set up libfunc handlers.
* libgcc2.c (__clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2,
__popcount_tab): New.
* libgcc2.h: Declare them.
* libgcc-std.ver (GCC_3.4): Add new functions from libgcc2.c.
* genopinit.c (optabs): Add clz_optab, ctz_optab, popcount_optab
and parity_optab.
* builtin-types.def (BT_FN_INT_LONG, BT_FN_INT_LONGLONG): New.
* builtins.def (BUILT_IN_CLZ, BUILT_IN_CTZ, BUILT_IN_POPCOUNT,
BUILT_IN_PARITY, BUILT_IN_FFSL, BUILT_IN_CLZL, BUILT_IN_CTZL,
BUILT_IN_POPCOUNTL, BUILT_IN_PARITYL, BUILT_IN_FFSLL,
BUILT_IN_CLZLL, BUILT_IN_CTZLL, BUILT_IN_POPCOUNTLL,
BUILT_IN_PARITYLL): New.
* builtins.c (expand_builtin_unop): Rename from expand_builtin_ffs
and add optab argument.
(expand_builtin): Expand BUILT_IN_{FFS,CLZ,POPCOUNT,PARITY}*.
* tree.def (CLZ_EXPR, CTZ_EXPR, POPCOUNT_EXPR, PARITY_EXPR): New.
* expr.c (expand_expr): Handle them.
* fold-const.c (tree_expr_nonnegative_p): Likewise.
* rtl.def (CLZ, CTZ, POPCOUNT, PARITY): New.
* reload1.c (eliminate_regs): Handle them.
(elimination_effects): Likewise.
* function.c (instantiate_virtual_regs_1): Likewise
* genattrtab.c (check_attr_value): Likewise.
* simplify-rtx.c (simplify_unary_operation): Likewise.
* c-common.c (c_common_truthvalue_conversion): Handle POPCOUNT_EXPR.
* combine.c (combine_simplify_rtx): Handle POPCOUNT and PARITY.
(nonzero_bits): Handle CLZ, CTZ, POPCOUNT and PARITY.
* config/alpha/alpha.md (clzdi2, ctzdi2, popcountdi2): New.
* config/arm/arm.c (arm_init_builtins): Rename __builtin_clz to
__builtin_arm_clz.
* Makefile.in (LIB2FUNCS_1, LIB2FUNCS_2): Move...
* mklibgcc.in (lib2funcs): ...here and merge. Add new members.
* doc/extend.texi (Other Builtins): Add new builtins.
* doc/md.texi (Standard Names): Add new patterns.
From-SVN: r62252
2003-02-01 20:00:02 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CTZ:
|
|
|
|
|
hv = 0;
|
2003-08-26 15:22:14 +02:00
|
|
|
|
if (l1 != 0)
|
[multiple changes]
2003-02-01 Richard Henderson <rth@redhat.com>
* optabs.c (expand_unop): Use word_mode for outmode of bit scaners.
* libgcc2.c (__ffsdi2, __clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2): Change
return type to Wtype.
* libgcc-std.ver (GCC_3.4): Fix inheritance.
* config/i386/i386.md (ffssi2): Use nonimmediate_operand for
expander input constraint.
2003-02-01 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
* optabs.h (optab_index): Add OTI_clz, OTI_ctz, OTI_popcount and
OTI_parity.
(clz_optab, ctz_optab, popcount_optab, parity_optab): New.
* optabs.c (widen_clz, expand_parity): New.
(expand_unop): Handle clz and parity. Hardcode SImode as outmode
for libcalls to clz, ctz, popcount, and parity.
(init_optabs): Init clz_optab, ctz_optab, popcount_optab and
parity_optab, and set up libfunc handlers.
* libgcc2.c (__clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2,
__popcount_tab): New.
* libgcc2.h: Declare them.
* libgcc-std.ver (GCC_3.4): Add new functions from libgcc2.c.
* genopinit.c (optabs): Add clz_optab, ctz_optab, popcount_optab
and parity_optab.
* builtin-types.def (BT_FN_INT_LONG, BT_FN_INT_LONGLONG): New.
* builtins.def (BUILT_IN_CLZ, BUILT_IN_CTZ, BUILT_IN_POPCOUNT,
BUILT_IN_PARITY, BUILT_IN_FFSL, BUILT_IN_CLZL, BUILT_IN_CTZL,
BUILT_IN_POPCOUNTL, BUILT_IN_PARITYL, BUILT_IN_FFSLL,
BUILT_IN_CLZLL, BUILT_IN_CTZLL, BUILT_IN_POPCOUNTLL,
BUILT_IN_PARITYLL): New.
* builtins.c (expand_builtin_unop): Rename from expand_builtin_ffs
and add optab argument.
(expand_builtin): Expand BUILT_IN_{FFS,CLZ,POPCOUNT,PARITY}*.
* tree.def (CLZ_EXPR, CTZ_EXPR, POPCOUNT_EXPR, PARITY_EXPR): New.
* expr.c (expand_expr): Handle them.
* fold-const.c (tree_expr_nonnegative_p): Likewise.
* rtl.def (CLZ, CTZ, POPCOUNT, PARITY): New.
* reload1.c (eliminate_regs): Handle them.
(elimination_effects): Likewise.
* function.c (instantiate_virtual_regs_1): Likewise
* genattrtab.c (check_attr_value): Likewise.
* simplify-rtx.c (simplify_unary_operation): Likewise.
* c-common.c (c_common_truthvalue_conversion): Handle POPCOUNT_EXPR.
* combine.c (combine_simplify_rtx): Handle POPCOUNT and PARITY.
(nonzero_bits): Handle CLZ, CTZ, POPCOUNT and PARITY.
* config/alpha/alpha.md (clzdi2, ctzdi2, popcountdi2): New.
* config/arm/arm.c (arm_init_builtins): Rename __builtin_clz to
__builtin_arm_clz.
* Makefile.in (LIB2FUNCS_1, LIB2FUNCS_2): Move...
* mklibgcc.in (lib2funcs): ...here and merge. Add new members.
* doc/extend.texi (Other Builtins): Add new builtins.
* doc/md.texi (Standard Names): Add new patterns.
From-SVN: r62252
2003-02-01 20:00:02 +01:00
|
|
|
|
lv = exact_log2 (l1 & -l1);
|
2003-08-26 15:22:14 +02:00
|
|
|
|
else if (h1 != 0)
|
|
|
|
|
lv = HOST_BITS_PER_WIDE_INT + exact_log2 (h1 & -h1);
|
|
|
|
|
else if (! CTZ_DEFINED_VALUE_AT_ZERO (mode, lv))
|
|
|
|
|
lv = GET_MODE_BITSIZE (mode);
|
[multiple changes]
2003-02-01 Richard Henderson <rth@redhat.com>
* optabs.c (expand_unop): Use word_mode for outmode of bit scaners.
* libgcc2.c (__ffsdi2, __clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2): Change
return type to Wtype.
* libgcc-std.ver (GCC_3.4): Fix inheritance.
* config/i386/i386.md (ffssi2): Use nonimmediate_operand for
expander input constraint.
2003-02-01 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
* optabs.h (optab_index): Add OTI_clz, OTI_ctz, OTI_popcount and
OTI_parity.
(clz_optab, ctz_optab, popcount_optab, parity_optab): New.
* optabs.c (widen_clz, expand_parity): New.
(expand_unop): Handle clz and parity. Hardcode SImode as outmode
for libcalls to clz, ctz, popcount, and parity.
(init_optabs): Init clz_optab, ctz_optab, popcount_optab and
parity_optab, and set up libfunc handlers.
* libgcc2.c (__clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
__popcountsi2, __popcountdi2, __paritysi2 __paritydi2,
__popcount_tab): New.
* libgcc2.h: Declare them.
* libgcc-std.ver (GCC_3.4): Add new functions from libgcc2.c.
* genopinit.c (optabs): Add clz_optab, ctz_optab, popcount_optab
and parity_optab.
* builtin-types.def (BT_FN_INT_LONG, BT_FN_INT_LONGLONG): New.
* builtins.def (BUILT_IN_CLZ, BUILT_IN_CTZ, BUILT_IN_POPCOUNT,
BUILT_IN_PARITY, BUILT_IN_FFSL, BUILT_IN_CLZL, BUILT_IN_CTZL,
BUILT_IN_POPCOUNTL, BUILT_IN_PARITYL, BUILT_IN_FFSLL,
BUILT_IN_CLZLL, BUILT_IN_CTZLL, BUILT_IN_POPCOUNTLL,
BUILT_IN_PARITYLL): New.
* builtins.c (expand_builtin_unop): Rename from expand_builtin_ffs
and add optab argument.
(expand_builtin): Expand BUILT_IN_{FFS,CLZ,POPCOUNT,PARITY}*.
* tree.def (CLZ_EXPR, CTZ_EXPR, POPCOUNT_EXPR, PARITY_EXPR): New.
* expr.c (expand_expr): Handle them.
* fold-const.c (tree_expr_nonnegative_p): Likewise.
* rtl.def (CLZ, CTZ, POPCOUNT, PARITY): New.
* reload1.c (eliminate_regs): Handle them.
(elimination_effects): Likewise.
* function.c (instantiate_virtual_regs_1): Likewise
* genattrtab.c (check_attr_value): Likewise.
* simplify-rtx.c (simplify_unary_operation): Likewise.
* c-common.c (c_common_truthvalue_conversion): Handle POPCOUNT_EXPR.
* combine.c (combine_simplify_rtx): Handle POPCOUNT and PARITY.
(nonzero_bits): Handle CLZ, CTZ, POPCOUNT and PARITY.
* config/alpha/alpha.md (clzdi2, ctzdi2, popcountdi2): New.
* config/arm/arm.c (arm_init_builtins): Rename __builtin_clz to
__builtin_arm_clz.
* Makefile.in (LIB2FUNCS_1, LIB2FUNCS_2): Move...
* mklibgcc.in (lib2funcs): ...here and merge. Add new members.
* doc/extend.texi (Other Builtins): Add new builtins.
* doc/md.texi (Standard Names): Add new patterns.
From-SVN: r62252
2003-02-01 20:00:02 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case POPCOUNT:
|
|
|
|
|
hv = 0;
|
|
|
|
|
lv = 0;
|
|
|
|
|
while (l1)
|
|
|
|
|
lv++, l1 &= l1 - 1;
|
|
|
|
|
while (h1)
|
|
|
|
|
lv++, h1 &= h1 - 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PARITY:
|
|
|
|
|
hv = 0;
|
|
|
|
|
lv = 0;
|
|
|
|
|
while (l1)
|
|
|
|
|
lv++, l1 &= l1 - 1;
|
|
|
|
|
while (h1)
|
|
|
|
|
lv++, h1 &= h1 - 1;
|
|
|
|
|
lv &= 1;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
break;
|
|
|
|
|
|
2007-02-08 18:10:56 +01:00
|
|
|
|
case BSWAP:
|
|
|
|
|
{
|
|
|
|
|
unsigned int s;
|
|
|
|
|
|
|
|
|
|
hv = 0;
|
|
|
|
|
lv = 0;
|
|
|
|
|
for (s = 0; s < width; s += 8)
|
|
|
|
|
{
|
|
|
|
|
unsigned int d = width - s - 8;
|
|
|
|
|
unsigned HOST_WIDE_INT byte;
|
|
|
|
|
|
|
|
|
|
if (s < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
byte = (l1 >> s) & 0xff;
|
|
|
|
|
else
|
|
|
|
|
byte = (h1 >> (s - HOST_BITS_PER_WIDE_INT)) & 0xff;
|
|
|
|
|
|
|
|
|
|
if (d < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
lv |= byte << d;
|
|
|
|
|
else
|
|
|
|
|
hv |= byte << (d - HOST_BITS_PER_WIDE_INT);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
case TRUNCATE:
|
|
|
|
|
/* This is just a change-of-mode, so do nothing. */
|
|
|
|
|
lv = l1, hv = h1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZERO_EXTEND:
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (op_mode != VOIDmode);
|
2002-02-21 00:15:00 +01:00
|
|
|
|
|
|
|
|
|
if (GET_MODE_BITSIZE (op_mode) > HOST_BITS_PER_WIDE_INT)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
hv = 0;
|
|
|
|
|
lv = l1 & GET_MODE_MASK (op_mode);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SIGN_EXTEND:
|
|
|
|
|
if (op_mode == VOIDmode
|
|
|
|
|
|| GET_MODE_BITSIZE (op_mode) > HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lv = l1 & GET_MODE_MASK (op_mode);
|
|
|
|
|
if (GET_MODE_BITSIZE (op_mode) < HOST_BITS_PER_WIDE_INT
|
|
|
|
|
&& (lv & ((HOST_WIDE_INT) 1
|
|
|
|
|
<< (GET_MODE_BITSIZE (op_mode) - 1))) != 0)
|
|
|
|
|
lv -= (HOST_WIDE_INT) 1 << GET_MODE_BITSIZE (op_mode);
|
|
|
|
|
|
2000-05-24 22:26:54 +02:00
|
|
|
|
hv = HWI_SIGN_EXTEND (lv);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SQRT:
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return immed_double_const (lv, hv, mode);
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
else if (GET_CODE (op) == CONST_DOUBLE
|
2005-11-21 21:53:27 +01:00
|
|
|
|
&& SCALAR_FLOAT_MODE_P (mode))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
REAL_VALUE_TYPE d, t;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
REAL_VALUE_FROM_CONST_DOUBLE (d, op);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2002-03-25 21:52:28 +01:00
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case SQRT:
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (HONOR_SNANS (mode) && real_isnan (&d))
|
|
|
|
|
return 0;
|
|
|
|
|
real_sqrt (&t, mode, &d);
|
|
|
|
|
d = t;
|
|
|
|
|
break;
|
2002-09-17 04:02:08 +02:00
|
|
|
|
case ABS:
|
|
|
|
|
d = REAL_VALUE_ABS (d);
|
|
|
|
|
break;
|
|
|
|
|
case NEG:
|
|
|
|
|
d = REAL_VALUE_NEGATE (d);
|
|
|
|
|
break;
|
|
|
|
|
case FLOAT_TRUNCATE:
|
|
|
|
|
d = real_value_truncate (mode, d);
|
|
|
|
|
break;
|
|
|
|
|
case FLOAT_EXTEND:
|
|
|
|
|
/* All this does is change the mode. */
|
|
|
|
|
break;
|
|
|
|
|
case FIX:
|
|
|
|
|
real_arithmetic (&d, FIX_TRUNC_EXPR, &d, NULL);
|
|
|
|
|
break;
|
simplify-rtx.c (simplify_unary_operation): Deal with logicals on floats.
* simplify-rtx.c (simplify_unary_operation): Deal with logicals on
floats.
(simplify_binary_operation): Deal with logicals on floats.
* i386.md (SSE fabs splitters): Emit new patterns.
(SSE cmov splitters): Likewise.
(sse_andv4sf3, sse_nandv4sf3, sse_iorv4sf3, sse_xorv4sf3
(sse_andv2df3, sse_nandv2df3, sse_iorv2df3, sse_xorv2df3): Do not use
subregs.
(sse_andsf3, sse_nandsf3, sse_xorsf3): Kill.
(sse_anddf3, sse_nanddf3, sse_xordf3): Kill.
From-SVN: r78045
2004-02-18 21:55:29 +01:00
|
|
|
|
case NOT:
|
|
|
|
|
{
|
|
|
|
|
long tmp[4];
|
|
|
|
|
int i;
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
real_to_target (tmp, &d, GET_MODE (op));
|
simplify-rtx.c (simplify_unary_operation): Deal with logicals on floats.
* simplify-rtx.c (simplify_unary_operation): Deal with logicals on
floats.
(simplify_binary_operation): Deal with logicals on floats.
* i386.md (SSE fabs splitters): Emit new patterns.
(SSE cmov splitters): Likewise.
(sse_andv4sf3, sse_nandv4sf3, sse_iorv4sf3, sse_xorv4sf3
(sse_andv2df3, sse_nandv2df3, sse_iorv2df3, sse_xorv2df3): Do not use
subregs.
(sse_andsf3, sse_nandsf3, sse_xorsf3): Kill.
(sse_anddf3, sse_nanddf3, sse_xordf3): Kill.
From-SVN: r78045
2004-02-18 21:55:29 +01:00
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
|
tmp[i] = ~tmp[i];
|
|
|
|
|
real_from_target (&d, tmp, mode);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
break;
|
simplify-rtx.c (simplify_unary_operation): Deal with logicals on floats.
* simplify-rtx.c (simplify_unary_operation): Deal with logicals on
floats.
(simplify_binary_operation): Deal with logicals on floats.
* i386.md (SSE fabs splitters): Emit new patterns.
(SSE cmov splitters): Likewise.
(sse_andv4sf3, sse_nandv4sf3, sse_iorv4sf3, sse_xorv4sf3
(sse_andv2df3, sse_nandv2df3, sse_iorv2df3, sse_xorv2df3): Do not use
subregs.
(sse_andsf3, sse_nandsf3, sse_xorsf3): Kill.
(sse_anddf3, sse_nanddf3, sse_xordf3): Kill.
From-SVN: r78045
2004-02-18 21:55:29 +01:00
|
|
|
|
}
|
2002-03-25 21:52:28 +01:00
|
|
|
|
default:
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_unreachable ();
|
2002-03-25 21:52:28 +01:00
|
|
|
|
}
|
|
|
|
|
return CONST_DOUBLE_FROM_REAL_VALUE (d, mode);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
else if (GET_CODE (op) == CONST_DOUBLE
|
2005-11-21 21:53:27 +01:00
|
|
|
|
&& SCALAR_FLOAT_MODE_P (GET_MODE (op))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
&& GET_MODE_CLASS (mode) == MODE_INT
|
2003-10-03 23:33:57 +02:00
|
|
|
|
&& width <= 2*HOST_BITS_PER_WIDE_INT && width > 0)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2003-10-03 23:33:57 +02:00
|
|
|
|
/* Although the overflow semantics of RTL's FIX and UNSIGNED_FIX
|
2003-10-05 21:50:56 +02:00
|
|
|
|
operators are intentionally left unspecified (to ease implementation
|
2003-10-03 23:33:57 +02:00
|
|
|
|
by target backends), for consistency, this routine implements the
|
|
|
|
|
same semantics for constant folding as used by the middle-end. */
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* This was formerly used only for non-IEEE float.
|
|
|
|
|
eggert@twinsun.com says it is safe for IEEE also. */
|
2003-10-03 23:33:57 +02:00
|
|
|
|
HOST_WIDE_INT xh, xl, th, tl;
|
|
|
|
|
REAL_VALUE_TYPE x, t;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
REAL_VALUE_FROM_CONST_DOUBLE (x, op);
|
2002-03-25 21:52:28 +01:00
|
|
|
|
switch (code)
|
|
|
|
|
{
|
2003-10-03 23:33:57 +02:00
|
|
|
|
case FIX:
|
|
|
|
|
if (REAL_VALUE_ISNAN (x))
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
|
|
|
|
|
/* Test against the signed upper bound. */
|
|
|
|
|
if (width > HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
|
|
|
|
th = ((unsigned HOST_WIDE_INT) 1
|
|
|
|
|
<< (width - HOST_BITS_PER_WIDE_INT - 1)) - 1;
|
|
|
|
|
tl = -1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
th = 0;
|
|
|
|
|
tl = ((unsigned HOST_WIDE_INT) 1 << (width - 1)) - 1;
|
|
|
|
|
}
|
|
|
|
|
real_from_integer (&t, VOIDmode, tl, th, 0);
|
|
|
|
|
if (REAL_VALUES_LESS (t, x))
|
|
|
|
|
{
|
|
|
|
|
xh = th;
|
|
|
|
|
xl = tl;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Test against the signed lower bound. */
|
|
|
|
|
if (width > HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
|
|
|
|
th = (HOST_WIDE_INT) -1 << (width - HOST_BITS_PER_WIDE_INT - 1);
|
|
|
|
|
tl = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
th = -1;
|
|
|
|
|
tl = (HOST_WIDE_INT) -1 << (width - 1);
|
|
|
|
|
}
|
|
|
|
|
real_from_integer (&t, VOIDmode, tl, th, 0);
|
|
|
|
|
if (REAL_VALUES_LESS (x, t))
|
|
|
|
|
{
|
|
|
|
|
xh = th;
|
|
|
|
|
xl = tl;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
REAL_VALUE_TO_INT (&xl, &xh, x);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case UNSIGNED_FIX:
|
|
|
|
|
if (REAL_VALUE_ISNAN (x) || REAL_VALUE_NEGATIVE (x))
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
|
|
|
|
|
/* Test against the unsigned upper bound. */
|
|
|
|
|
if (width == 2*HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
|
|
|
|
th = -1;
|
|
|
|
|
tl = -1;
|
|
|
|
|
}
|
|
|
|
|
else if (width >= HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
|
|
|
|
th = ((unsigned HOST_WIDE_INT) 1
|
|
|
|
|
<< (width - HOST_BITS_PER_WIDE_INT)) - 1;
|
|
|
|
|
tl = -1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
th = 0;
|
|
|
|
|
tl = ((unsigned HOST_WIDE_INT) 1 << width) - 1;
|
|
|
|
|
}
|
|
|
|
|
real_from_integer (&t, VOIDmode, tl, th, 1);
|
|
|
|
|
if (REAL_VALUES_LESS (t, x))
|
|
|
|
|
{
|
|
|
|
|
xh = th;
|
|
|
|
|
xl = tl;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
REAL_VALUE_TO_INT (&xl, &xh, x);
|
|
|
|
|
break;
|
|
|
|
|
|
2002-03-25 21:52:28 +01:00
|
|
|
|
default:
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_unreachable ();
|
2002-03-25 21:52:28 +01:00
|
|
|
|
}
|
2003-10-03 23:33:57 +02:00
|
|
|
|
return immed_double_const (xl, xh, mode);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
emit-rtl.c, [...]: Remove all #ifndef REAL_ARITHMETIC blocks...
* emit-rtl.c, final.c, fold-const.c, gengenrtl.c, optabs.c,
print-tree.c, real.c, real.h, recog.c, rtl.c, simplify-rtx.c,
tree.c, config/m68k/m68k.c, f/com.c, f/target.h, java/expr.c,
java/jcf-parse.c, java/lex.c:
Remove all #ifndef REAL_ARITHMETIC blocks, make all #ifdef
REAL_ARITHMETIC blocks unconditional. Delete some further
#ifdef blocks predicated on REAL_ARITHMETIC.
* flags.h, toplev.c: Delete remaining references to
flag_pretend_float.
* doc/invoke.texi: Remove documentation of -fpretend-float.
* doc/tm.texi: Describe the various REAL_* macros as provided by
real.h, not by the target configuration files.
* config/alpha/alpha.h, config/alpha/unicosmk.h, config/arm/arm.h,
config/avr/avr.h, config/c4x/c4x.h, config/convex/convex.h,
config/cris/cris.h, config/d30v/d30v.h, config/dsp16xx/dsp16xx.h,
config/h8300/h8300.h, config/i370/i370.h, config/i386/i386.h,
config/i386/osf1elf.h, config/i960/i960.h, config/ia64/ia64.h,
config/m32r/m32r.h, config/m68hc11/m68hc11.h, config/m68k/dpx2.h,
config/m68k/linux-aout.h, config/m68k/linux.h, config/m68k/m68k.h,
config/m68k/sun3.h, config/m68k/vxm68k.h, config/mcore/mcore.h,
config/mips/mips.h, config/mmix/mmix.h, config/mn10200/mn10200.h,
config/mn10300/mn10300.h, config/pa/pa.h, config/pj/pj.h,
config/rs6000/rs6000.h, config/s390/s390.h, config/sh/sh.h,
config/sparc/freebsd.h, config/sparc/linux.h, config/sparc/linux64.h,
config/sparc/sol2.h, config/sparc/sparc.h, config/sparc/vxsim.h,
config/stormy16/stormy16.h, config/v850/v850.h, config/vax/vax.h,
config/xtensa/xtensa.h:
Do not define, undefine, or mention in comments any of
REAL_ARITHMETIC, REAL_VALUE_ATOF, REAL_VALUE_HTOF,
REAL_VALUE_ISNAN, REAL_VALUE_ISINF,
REAL_VALUE_TO_TARGET_SINGLE, REAL_VALUE_TO_TARGET_DOUBLE,
REAL_VALUE_TO_TARGET_LONG_DOUBLE, REAL_VALUE_TO_DECIMAL,
REAL_VALUE_TYPE, REAL_VALUES_EQUAL, REAL_VALUES_LESS,
REAL_VALUE_LDEXP, REAL_VALUE_FIX, REAL_VALUE_UNSIGNED_FIX,
REAL_VALUE_RNDZINT, REAL_VALUE_UNSIGNED_RNDZINT,
REAL_INFINITY, REAL_VALUE_NEGATE, REAL_VALUE_TRUNCATE,
REAL_VALUE_TO_INT, or REAL_VALUE_FROM_INT.
From-SVN: r50263
2002-03-03 22:10:09 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return NULL_RTX;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
2004-01-19 22:51:06 +01:00
|
|
|
|
/* Subroutine of simplify_binary_operation to simplify a commutative,
|
|
|
|
|
associative binary operation CODE with result mode MODE, operating
|
|
|
|
|
on OP0 and OP1. CODE is currently one of PLUS, MULT, AND, IOR, XOR,
|
|
|
|
|
SMIN, SMAX, UMIN or UMAX. Return zero if no simplification or
|
|
|
|
|
canonicalization is possible. */
|
2003-08-17 21:24:09 +02:00
|
|
|
|
|
|
|
|
|
static rtx
|
|
|
|
|
simplify_associative_operation (enum rtx_code code, enum machine_mode mode,
|
|
|
|
|
rtx op0, rtx op1)
|
|
|
|
|
{
|
|
|
|
|
rtx tem;
|
|
|
|
|
|
2004-01-19 22:51:06 +01:00
|
|
|
|
/* Linearize the operator to the left. */
|
|
|
|
|
if (GET_CODE (op1) == code)
|
2003-08-17 21:24:09 +02:00
|
|
|
|
{
|
2004-01-19 22:51:06 +01:00
|
|
|
|
/* "(a op b) op (c op d)" becomes "((a op b) op c) op d)". */
|
|
|
|
|
if (GET_CODE (op0) == code)
|
|
|
|
|
{
|
|
|
|
|
tem = simplify_gen_binary (code, mode, op0, XEXP (op1, 0));
|
|
|
|
|
return simplify_gen_binary (code, mode, tem, XEXP (op1, 1));
|
|
|
|
|
}
|
2003-08-17 21:24:09 +02:00
|
|
|
|
|
2004-01-19 22:51:06 +01:00
|
|
|
|
/* "a op (b op c)" becomes "(b op c) op a". */
|
|
|
|
|
if (! swap_commutative_operands_p (op1, op0))
|
|
|
|
|
return simplify_gen_binary (code, mode, op1, op0);
|
2003-08-17 21:24:09 +02:00
|
|
|
|
|
2004-01-19 22:51:06 +01:00
|
|
|
|
tem = op0;
|
|
|
|
|
op0 = op1;
|
|
|
|
|
op1 = tem;
|
2003-08-17 21:24:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-01-19 22:51:06 +01:00
|
|
|
|
if (GET_CODE (op0) == code)
|
2003-08-17 21:24:09 +02:00
|
|
|
|
{
|
2004-01-19 22:51:06 +01:00
|
|
|
|
/* Canonicalize "(x op c) op y" as "(x op y) op c". */
|
|
|
|
|
if (swap_commutative_operands_p (XEXP (op0, 1), op1))
|
|
|
|
|
{
|
|
|
|
|
tem = simplify_gen_binary (code, mode, XEXP (op0, 0), op1);
|
|
|
|
|
return simplify_gen_binary (code, mode, tem, XEXP (op0, 1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Attempt to simplify "(a op b) op c" as "a op (b op c)". */
|
2007-07-23 18:43:24 +02:00
|
|
|
|
tem = simplify_binary_operation (code, mode, XEXP (op0, 1), op1);
|
2004-01-19 22:51:06 +01:00
|
|
|
|
if (tem != 0)
|
|
|
|
|
return simplify_gen_binary (code, mode, XEXP (op0, 0), tem);
|
|
|
|
|
|
|
|
|
|
/* Attempt to simplify "(a op b) op c" as "(a op c) op b". */
|
2007-07-23 18:43:24 +02:00
|
|
|
|
tem = simplify_binary_operation (code, mode, XEXP (op0, 0), op1);
|
2004-01-19 22:51:06 +01:00
|
|
|
|
if (tem != 0)
|
|
|
|
|
return simplify_gen_binary (code, mode, tem, XEXP (op0, 1));
|
2003-08-17 21:24:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
/* Simplify a binary operation CODE with result mode MODE, operating on OP0
|
|
|
|
|
and OP1. Return 0 if no simplification is possible.
|
|
|
|
|
|
|
|
|
|
Don't use this for relational operations such as EQ or LT.
|
|
|
|
|
Use simplify_relational_operation instead. */
|
|
|
|
|
rtx
|
2003-07-06 14:35:56 +02:00
|
|
|
|
simplify_binary_operation (enum rtx_code code, enum machine_mode mode,
|
|
|
|
|
rtx op0, rtx op1)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2004-01-19 22:51:06 +01:00
|
|
|
|
rtx trueop0, trueop1;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
rtx tem;
|
|
|
|
|
|
|
|
|
|
/* Relational operations don't work here. We must know the mode
|
|
|
|
|
of the operands in order to do the comparison correctly.
|
|
|
|
|
Assuming a full word can give incorrect results.
|
|
|
|
|
Consider comparing 128 with -128 in QImode. */
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (GET_RTX_CLASS (code) != RTX_COMPARE);
|
|
|
|
|
gcc_assert (GET_RTX_CLASS (code) != RTX_COMM_COMPARE);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2001-07-17 17:11:56 +02:00
|
|
|
|
/* Make sure the constant is second. */
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
if (GET_RTX_CLASS (code) == RTX_COMM_ARITH
|
2004-01-19 22:51:06 +01:00
|
|
|
|
&& swap_commutative_operands_p (op0, op1))
|
2001-07-17 17:11:56 +02:00
|
|
|
|
{
|
|
|
|
|
tem = op0, op0 = op1, op1 = tem;
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-19 22:51:06 +01:00
|
|
|
|
trueop0 = avoid_constant_pool_reference (op0);
|
|
|
|
|
trueop1 = avoid_constant_pool_reference (op1);
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
tem = simplify_const_binary_operation (code, mode, trueop0, trueop1);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
|
|
|
|
return simplify_binary_operation_1 (code, mode, op0, op1, trueop0, trueop1);
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-29 18:22:05 +02:00
|
|
|
|
/* Subroutine of simplify_binary_operation. Simplify a binary operation
|
|
|
|
|
CODE with result mode MODE, operating on OP0 and OP1. If OP0 and/or
|
|
|
|
|
OP1 are constant pool references, TRUEOP0 and TRUEOP1 represent the
|
|
|
|
|
actual constants. */
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
static rtx
|
|
|
|
|
simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
|
|
|
|
|
rtx op0, rtx op1, rtx trueop0, rtx trueop1)
|
|
|
|
|
{
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
rtx tem, reversed, opleft, opright;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
HOST_WIDE_INT val;
|
|
|
|
|
unsigned int width = GET_MODE_BITSIZE (mode);
|
|
|
|
|
|
|
|
|
|
/* Even if we can't compute a constant result,
|
|
|
|
|
there are some cases worth simplifying. */
|
|
|
|
|
|
|
|
|
|
switch (code)
|
2003-02-09 23:55:35 +01:00
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case PLUS:
|
|
|
|
|
/* Maybe simplify x + 0 to x. The two expressions are equivalent
|
|
|
|
|
when x is NaN, infinite, or finite and nonzero. They aren't
|
|
|
|
|
when x is -0 and the rounding mode is not towards -infinity,
|
|
|
|
|
since (-0) + 0 is then 0. */
|
|
|
|
|
if (!HONOR_SIGNED_ZEROS (mode) && trueop1 == CONST0_RTX (mode))
|
|
|
|
|
return op0;
|
|
|
|
|
|
|
|
|
|
/* ((-a) + b) -> (b - a) and similarly for (a + (-b)). These
|
|
|
|
|
transformations are safe even for IEEE. */
|
|
|
|
|
if (GET_CODE (op0) == NEG)
|
|
|
|
|
return simplify_gen_binary (MINUS, mode, op1, XEXP (op0, 0));
|
|
|
|
|
else if (GET_CODE (op1) == NEG)
|
|
|
|
|
return simplify_gen_binary (MINUS, mode, op0, XEXP (op1, 0));
|
|
|
|
|
|
|
|
|
|
/* (~a) + 1 -> -a */
|
|
|
|
|
if (INTEGRAL_MODE_P (mode)
|
|
|
|
|
&& GET_CODE (op0) == NOT
|
|
|
|
|
&& trueop1 == const1_rtx)
|
|
|
|
|
return simplify_gen_unary (NEG, mode, XEXP (op0, 0), mode);
|
|
|
|
|
|
|
|
|
|
/* Handle both-operands-constant cases. We can only add
|
|
|
|
|
CONST_INTs to constants since the sum of relocatable symbols
|
|
|
|
|
can't be handled by most assemblers. Don't add CONST_INT
|
|
|
|
|
to CONST_INT since overflow won't be computed properly if wider
|
|
|
|
|
than HOST_BITS_PER_WIDE_INT. */
|
|
|
|
|
|
2008-09-02 20:39:32 +02:00
|
|
|
|
if ((GET_CODE (op0) == CONST
|
|
|
|
|
|| GET_CODE (op0) == SYMBOL_REF
|
|
|
|
|
|| GET_CODE (op0) == LABEL_REF)
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (op1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return plus_constant (op0, INTVAL (op1));
|
2008-09-02 20:39:32 +02:00
|
|
|
|
else if ((GET_CODE (op1) == CONST
|
|
|
|
|
|| GET_CODE (op1) == SYMBOL_REF
|
|
|
|
|
|| GET_CODE (op1) == LABEL_REF)
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (op0))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return plus_constant (op1, INTVAL (op0));
|
|
|
|
|
|
|
|
|
|
/* See if this is something like X * C - X or vice versa or
|
|
|
|
|
if the multiplication is written as a shift. If so, we can
|
|
|
|
|
distribute and make a new multiply, shift, or maybe just
|
|
|
|
|
have X (if C is 2 in the example above). But don't make
|
|
|
|
|
something more expensive than we had before. */
|
|
|
|
|
|
2005-04-23 21:16:54 +02:00
|
|
|
|
if (SCALAR_INT_MODE_P (mode))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
{
|
2005-03-24 06:57:52 +01:00
|
|
|
|
HOST_WIDE_INT coeff0h = 0, coeff1h = 0;
|
|
|
|
|
unsigned HOST_WIDE_INT coeff0l = 1, coeff1l = 1;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
rtx lhs = op0, rhs = op1;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (lhs) == NEG)
|
2005-03-24 06:57:52 +01:00
|
|
|
|
{
|
|
|
|
|
coeff0l = -1;
|
|
|
|
|
coeff0h = -1;
|
|
|
|
|
lhs = XEXP (lhs, 0);
|
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
else if (GET_CODE (lhs) == MULT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (lhs, 1)))
|
2005-03-24 06:57:52 +01:00
|
|
|
|
{
|
|
|
|
|
coeff0l = INTVAL (XEXP (lhs, 1));
|
|
|
|
|
coeff0h = INTVAL (XEXP (lhs, 1)) < 0 ? -1 : 0;
|
|
|
|
|
lhs = XEXP (lhs, 0);
|
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
else if (GET_CODE (lhs) == ASHIFT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (lhs, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& INTVAL (XEXP (lhs, 1)) >= 0
|
|
|
|
|
&& INTVAL (XEXP (lhs, 1)) < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
2005-03-24 06:57:52 +01:00
|
|
|
|
coeff0l = ((HOST_WIDE_INT) 1) << INTVAL (XEXP (lhs, 1));
|
|
|
|
|
coeff0h = 0;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
lhs = XEXP (lhs, 0);
|
|
|
|
|
}
|
2003-02-09 23:55:35 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (GET_CODE (rhs) == NEG)
|
2005-03-24 06:57:52 +01:00
|
|
|
|
{
|
|
|
|
|
coeff1l = -1;
|
|
|
|
|
coeff1h = -1;
|
|
|
|
|
rhs = XEXP (rhs, 0);
|
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
else if (GET_CODE (rhs) == MULT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (rhs, 1)))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
{
|
2005-03-24 06:57:52 +01:00
|
|
|
|
coeff1l = INTVAL (XEXP (rhs, 1));
|
|
|
|
|
coeff1h = INTVAL (XEXP (rhs, 1)) < 0 ? -1 : 0;
|
|
|
|
|
rhs = XEXP (rhs, 0);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
}
|
|
|
|
|
else if (GET_CODE (rhs) == ASHIFT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (rhs, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& INTVAL (XEXP (rhs, 1)) >= 0
|
|
|
|
|
&& INTVAL (XEXP (rhs, 1)) < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
2005-03-24 06:57:52 +01:00
|
|
|
|
coeff1l = ((HOST_WIDE_INT) 1) << INTVAL (XEXP (rhs, 1));
|
|
|
|
|
coeff1h = 0;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
rhs = XEXP (rhs, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (rtx_equal_p (lhs, rhs))
|
|
|
|
|
{
|
|
|
|
|
rtx orig = gen_rtx_PLUS (mode, op0, op1);
|
2005-03-24 06:57:52 +01:00
|
|
|
|
rtx coeff;
|
|
|
|
|
unsigned HOST_WIDE_INT l;
|
|
|
|
|
HOST_WIDE_INT h;
|
fwprop.c (should_replace_address): Add speed attribute.
* fwprop.c (should_replace_address): Add speed attribute.
(PR_OPTIMIZE_FOR_SPEED): New flag.
(propagate_rtx_1): Use it.
(propagate_rtx): Set it.
(try_fwprop_subst): Update call of rtx_costs.
(forward_propagate_and_simplify): LIkewise.
* hooks.c (hook_int_rtx_bool_0): New
(hook_bool_rtx_int_int_intp_false): Replace by ...
(hook_bool_rtx_int_int_intp_bool_false): .. thisone.
* hooks.h (hook_int_rtx_bool_0): New
(hook_bool_rtx_int_int_intp_false): Replace by ...
(hook_bool_rtx_int_int_intp_bool_false): .. thisone.
* optabs.c (avoid_expensive_constant): UPdate call of rtx_cost.
(prepare_cmp_insn): UPdate call of rtx_cost.
* postreload.c (reload_cse_simplify_set): Update call of rtx_cost.
(reload_cse_simplify_operands): Update call of rtx_cost.
(reload_cse_move2add): call of rtx_cost.
* target.h (struct gcc_target): Update rtx_costs and address_costs.
* rtlanal.c (rtx_cost): Add speed argument.
(address_cost): Add speed argument
(default_address_cost): Likewise.
(insn_rtx_cost): Likewise.
* cfgloopanal.c (seq_cost): Add speed argument.
(target_reg_cost, target_spill_cost): Turn to array.
(init_set_costs): Update for speed.
(estimate_reg_pressure_cost): Add speed argument.
* auto-inc-dec.c (attempt_change): Update call of rtx_cost.
* dojump.c (prefer_and_bit_test): UPdate call of rtx_cost.
* tree-ssa-loop-ivopts.c (struct ivopts_data): New field speed.
(seq_cost): Add speed argument.
(computation_cost): Add speed arugment.
(add_cost, multiply_by_const, get_address_cost): add speed argument.
(force_expr_to_var_cost): Update for profile info.
(force_var_cost): Likewise.
(split_address_cost): Likewise.
(ptr_difference_cost): Likewise.
(difference_cost): Likewise.
(get_computation_cost_at): Likewise.
(determine_iv_cost): Likewise.
(ivopts_global_cost_for_size): Likewise.
(rewrite_use_address): Likewise.
(tree_ssa_iv_optimize_loop): Initialize speed field.
* cse.c (optimize_this_for_speed_p): New static var.
(notreg_cost): Update call of rtx_cost.
(cse_extended_basic_block): set optimize_this_for_speed_p.
* ifcvt.c (cheap_bb_rtx_cost_p): Update call of rtx_cost.
(noce_try_cmove_arith): Likewise.
(noce_try_sign_mask): LIkewise.
* expr.c (compress_float_constant): Update rtx_cost calls.
* tree-ssa-address.c (most_expensive_mult_to_index): Add speed argument.
(addr_to_parts): Likewise.
(create_mem_ref): Likewise.
* dse.c (find_shift_sequence): Add speed argument.
(replace_read): Update call.
* calls.c (precompute_register_parameters): Update call of rtx_cost.
* expmed.c (sdiv_pow2_cheap, smod_pow2_cheap, zero_cost, add_cost,
* neg_cost, shift_cost, shiftadd_cost,
shiftsub_cost, mul_cost, sdiv_cost, udiv_cost ,mul_widen_cost,
mul_highpart_cost): Increase dimension.
(init_expmed): Initialize for both size and speed.
(expand_shift): Use profile.
(synth_mult): Use profile.
(choose_mult_variant): Use profile.
(expand_mult): Use profile.
(expand_mult_highpart_optab): Use profile.
(expand_mult_highpart): Use profile.
(expand_smod_pow2): Use profile.
(expand_divmod): Use profile.
* simplify-rtx.c (simplify_binary_operation_1): Update call of rtx_cost.
* loop-invariant.c (create_new_invariant): Use profile.
(gain_for_invariant): Add speed parameter.
(best_gain_for_invariant): Likewise.
(find_invariants_to_move): Likewise.
(move_single_loop_invariants): Set it.
* target-def.h (TARGET_RTX_COSTS): Use hook.
* rtl.h (rtx_cost, address_cost, insn_rtx_cost): Update prototpe.
(optimize_insn_for_size_p, optimize_insn_for_speed_p): Declare.
* output.h (default_address_cost): Update prototype.
* combine.c (optimize_this_for_speed_p): New static var.
(combine_validate_cost): Update call of rtx_cost.
(combine_instructions): Set optimize_this_for_speed_p.
(expand_compound_operation): Update call of rtx_cost.
(make_extraction):Update call of rtx_cost.
(force_to_mode):Update call of rtx_cost.
(distribute_and_simplify_rtx):Update call of rtx_cost.
* cfgloop.h (target_reg_cost, target_spill_cost): Turn to array.
(estimate_reg_pressure_cost): Update prototype.
* tree-flow.h (multiply_by_cost, create_mem_ref): Update prototype.
* basic-block.h (optimize_insn_for_size_p, optimize_insn_for_speed_p):
Remove.
* config/alpha/alpha.c (alpha_rtx_costs): Update.
(alpha_rtx_costs): Update.
* config/frv/frv.c (frv_rtx_costs): Update.
* config/s390/s390.c (s390_rtx_costs): Update.
* config/m32c/m32c.c (m32c_memory_move_cost): Update.
(m32c_rtx_costs): Update.
* config/spu/spu.c (TARGET_ADDRESS_COST): Upate.
(spu_rtx_costs): Update.
* config/sparc/sparc.c (sparc_rtx_costs): Update.
* config/m32r/m32r.c (m32r_rtx_costs): Update.
* config/i386/i386.c (:ix86_address_cost): Update.
(ix86_rtx_costs): Update.
* config/sh/sh.c (sh_rtx_costs, sh_address_cost): Update.
* config/pdp11/pdp11.c (pdp11_rtx_costs): Update.
* config/avr/avr.c (avr_rtx_costs, avr_address_cost): Update.
* config/crx/crx.c (crx_address_cost): Update.
* config/xtensa/xtensa.c (xtensa_rtx_costs): Update.
* config/stormy16/stormy16.c
(xstormy16_address_cost, xstormy16_rtx_costs): Update.
* config/m68hc11/m68hc11.c
(m68hc11_address_cost, m68hc11_rtx_costs): Update.
* config/cris/cris.c (cris_rtx_costs, cris_address_cost): Update.
* config/iq2000/iq2000.c (iq2000_rtx_costs, iq2000_address_cost): Update.
* config/mn10300/mn10300.c (mn10300_address_cost, mn10300_rtx_costs): Update
* config/ia64/ia64.c (ia64_rtx_costs): Update.
* config/m68k/m68k.c (m68k_rtx_costs): Update.
* config/rs6000/rs6000.c (rs6000_rtx_costs): Update.
* config/arc/arc.c (arc_rtx_costs, arc_address_cost): Update.
* config/mcore/mcore.c (TARGET_ADDRESS_COST): Update.
(mcore_rtx_costs): update.
* config/score/score3.c (score3_rtx_costs): Update.
* config/score/score7.c (score7_rtx_costs): Update.
* config/score/score3.h (score3_rtx_costs):Update.
* config/score/score7.h (score7_rtx_costs): Update.
* config/score/score.c (score_rtx_costs): Update.
* config/arm/arm.c (arm_address_cost): Update.
(arm_rtx_costs_1): Update.
(arm_rtx_costs_1): Update.
(arm_size_rtx_costs): Update.
(arm_size_rtx_costs): Update.
(arm_size_rtx_costs): Update.
(arm_xscale_rtx_costs): Update.
(arm_thumb_address_cost): Update.
* config/pa/pa.c (hppa_address_cost): Update.
* config/mips/mips.c (mips_rtx_costs): Update.
* config/vax/vax.c (vax_address_cost): Update.
* config/h8300/h8300.c (h8300_shift_costs): Update.
(h8300_rtx_costs): Update.
* config/v850/v850.c (TARGET_ADDRESS_COST): Update.
(v850_rtx_costs): Update.
* config/mmix/mmix.c (mmix_rtx_costs, mmix_rtx_costs): Update.
* config/bfin/bfin.c
(bfin_address_cost): Update.
(bfin_rtx_costs): Update.
* stmt.c (lshift_cheap_p): Update.
From-SVN: r139821
2008-08-31 11:44:25 +02:00
|
|
|
|
bool speed = optimize_function_for_speed_p (cfun);
|
2005-03-24 06:57:52 +01:00
|
|
|
|
|
|
|
|
|
add_double (coeff0l, coeff0h, coeff1l, coeff1h, &l, &h);
|
|
|
|
|
coeff = immed_double_const (l, h, mode);
|
|
|
|
|
|
|
|
|
|
tem = simplify_gen_binary (MULT, mode, lhs, coeff);
|
fwprop.c (should_replace_address): Add speed attribute.
* fwprop.c (should_replace_address): Add speed attribute.
(PR_OPTIMIZE_FOR_SPEED): New flag.
(propagate_rtx_1): Use it.
(propagate_rtx): Set it.
(try_fwprop_subst): Update call of rtx_costs.
(forward_propagate_and_simplify): LIkewise.
* hooks.c (hook_int_rtx_bool_0): New
(hook_bool_rtx_int_int_intp_false): Replace by ...
(hook_bool_rtx_int_int_intp_bool_false): .. thisone.
* hooks.h (hook_int_rtx_bool_0): New
(hook_bool_rtx_int_int_intp_false): Replace by ...
(hook_bool_rtx_int_int_intp_bool_false): .. thisone.
* optabs.c (avoid_expensive_constant): UPdate call of rtx_cost.
(prepare_cmp_insn): UPdate call of rtx_cost.
* postreload.c (reload_cse_simplify_set): Update call of rtx_cost.
(reload_cse_simplify_operands): Update call of rtx_cost.
(reload_cse_move2add): call of rtx_cost.
* target.h (struct gcc_target): Update rtx_costs and address_costs.
* rtlanal.c (rtx_cost): Add speed argument.
(address_cost): Add speed argument
(default_address_cost): Likewise.
(insn_rtx_cost): Likewise.
* cfgloopanal.c (seq_cost): Add speed argument.
(target_reg_cost, target_spill_cost): Turn to array.
(init_set_costs): Update for speed.
(estimate_reg_pressure_cost): Add speed argument.
* auto-inc-dec.c (attempt_change): Update call of rtx_cost.
* dojump.c (prefer_and_bit_test): UPdate call of rtx_cost.
* tree-ssa-loop-ivopts.c (struct ivopts_data): New field speed.
(seq_cost): Add speed argument.
(computation_cost): Add speed arugment.
(add_cost, multiply_by_const, get_address_cost): add speed argument.
(force_expr_to_var_cost): Update for profile info.
(force_var_cost): Likewise.
(split_address_cost): Likewise.
(ptr_difference_cost): Likewise.
(difference_cost): Likewise.
(get_computation_cost_at): Likewise.
(determine_iv_cost): Likewise.
(ivopts_global_cost_for_size): Likewise.
(rewrite_use_address): Likewise.
(tree_ssa_iv_optimize_loop): Initialize speed field.
* cse.c (optimize_this_for_speed_p): New static var.
(notreg_cost): Update call of rtx_cost.
(cse_extended_basic_block): set optimize_this_for_speed_p.
* ifcvt.c (cheap_bb_rtx_cost_p): Update call of rtx_cost.
(noce_try_cmove_arith): Likewise.
(noce_try_sign_mask): LIkewise.
* expr.c (compress_float_constant): Update rtx_cost calls.
* tree-ssa-address.c (most_expensive_mult_to_index): Add speed argument.
(addr_to_parts): Likewise.
(create_mem_ref): Likewise.
* dse.c (find_shift_sequence): Add speed argument.
(replace_read): Update call.
* calls.c (precompute_register_parameters): Update call of rtx_cost.
* expmed.c (sdiv_pow2_cheap, smod_pow2_cheap, zero_cost, add_cost,
* neg_cost, shift_cost, shiftadd_cost,
shiftsub_cost, mul_cost, sdiv_cost, udiv_cost ,mul_widen_cost,
mul_highpart_cost): Increase dimension.
(init_expmed): Initialize for both size and speed.
(expand_shift): Use profile.
(synth_mult): Use profile.
(choose_mult_variant): Use profile.
(expand_mult): Use profile.
(expand_mult_highpart_optab): Use profile.
(expand_mult_highpart): Use profile.
(expand_smod_pow2): Use profile.
(expand_divmod): Use profile.
* simplify-rtx.c (simplify_binary_operation_1): Update call of rtx_cost.
* loop-invariant.c (create_new_invariant): Use profile.
(gain_for_invariant): Add speed parameter.
(best_gain_for_invariant): Likewise.
(find_invariants_to_move): Likewise.
(move_single_loop_invariants): Set it.
* target-def.h (TARGET_RTX_COSTS): Use hook.
* rtl.h (rtx_cost, address_cost, insn_rtx_cost): Update prototpe.
(optimize_insn_for_size_p, optimize_insn_for_speed_p): Declare.
* output.h (default_address_cost): Update prototype.
* combine.c (optimize_this_for_speed_p): New static var.
(combine_validate_cost): Update call of rtx_cost.
(combine_instructions): Set optimize_this_for_speed_p.
(expand_compound_operation): Update call of rtx_cost.
(make_extraction):Update call of rtx_cost.
(force_to_mode):Update call of rtx_cost.
(distribute_and_simplify_rtx):Update call of rtx_cost.
* cfgloop.h (target_reg_cost, target_spill_cost): Turn to array.
(estimate_reg_pressure_cost): Update prototype.
* tree-flow.h (multiply_by_cost, create_mem_ref): Update prototype.
* basic-block.h (optimize_insn_for_size_p, optimize_insn_for_speed_p):
Remove.
* config/alpha/alpha.c (alpha_rtx_costs): Update.
(alpha_rtx_costs): Update.
* config/frv/frv.c (frv_rtx_costs): Update.
* config/s390/s390.c (s390_rtx_costs): Update.
* config/m32c/m32c.c (m32c_memory_move_cost): Update.
(m32c_rtx_costs): Update.
* config/spu/spu.c (TARGET_ADDRESS_COST): Upate.
(spu_rtx_costs): Update.
* config/sparc/sparc.c (sparc_rtx_costs): Update.
* config/m32r/m32r.c (m32r_rtx_costs): Update.
* config/i386/i386.c (:ix86_address_cost): Update.
(ix86_rtx_costs): Update.
* config/sh/sh.c (sh_rtx_costs, sh_address_cost): Update.
* config/pdp11/pdp11.c (pdp11_rtx_costs): Update.
* config/avr/avr.c (avr_rtx_costs, avr_address_cost): Update.
* config/crx/crx.c (crx_address_cost): Update.
* config/xtensa/xtensa.c (xtensa_rtx_costs): Update.
* config/stormy16/stormy16.c
(xstormy16_address_cost, xstormy16_rtx_costs): Update.
* config/m68hc11/m68hc11.c
(m68hc11_address_cost, m68hc11_rtx_costs): Update.
* config/cris/cris.c (cris_rtx_costs, cris_address_cost): Update.
* config/iq2000/iq2000.c (iq2000_rtx_costs, iq2000_address_cost): Update.
* config/mn10300/mn10300.c (mn10300_address_cost, mn10300_rtx_costs): Update
* config/ia64/ia64.c (ia64_rtx_costs): Update.
* config/m68k/m68k.c (m68k_rtx_costs): Update.
* config/rs6000/rs6000.c (rs6000_rtx_costs): Update.
* config/arc/arc.c (arc_rtx_costs, arc_address_cost): Update.
* config/mcore/mcore.c (TARGET_ADDRESS_COST): Update.
(mcore_rtx_costs): update.
* config/score/score3.c (score3_rtx_costs): Update.
* config/score/score7.c (score7_rtx_costs): Update.
* config/score/score3.h (score3_rtx_costs):Update.
* config/score/score7.h (score7_rtx_costs): Update.
* config/score/score.c (score_rtx_costs): Update.
* config/arm/arm.c (arm_address_cost): Update.
(arm_rtx_costs_1): Update.
(arm_rtx_costs_1): Update.
(arm_size_rtx_costs): Update.
(arm_size_rtx_costs): Update.
(arm_size_rtx_costs): Update.
(arm_xscale_rtx_costs): Update.
(arm_thumb_address_cost): Update.
* config/pa/pa.c (hppa_address_cost): Update.
* config/mips/mips.c (mips_rtx_costs): Update.
* config/vax/vax.c (vax_address_cost): Update.
* config/h8300/h8300.c (h8300_shift_costs): Update.
(h8300_rtx_costs): Update.
* config/v850/v850.c (TARGET_ADDRESS_COST): Update.
(v850_rtx_costs): Update.
* config/mmix/mmix.c (mmix_rtx_costs, mmix_rtx_costs): Update.
* config/bfin/bfin.c
(bfin_address_cost): Update.
(bfin_rtx_costs): Update.
* stmt.c (lshift_cheap_p): Update.
From-SVN: r139821
2008-08-31 11:44:25 +02:00
|
|
|
|
return rtx_cost (tem, SET, speed) <= rtx_cost (orig, SET, speed)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
? tem : 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (plus (xor X C1) C2) is (xor X (C1^C2)) if C2 is signbit. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if ((CONST_INT_P (op1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|| GET_CODE (op1) == CONST_DOUBLE)
|
|
|
|
|
&& GET_CODE (op0) == XOR
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& (CONST_INT_P (XEXP (op0, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|| GET_CODE (XEXP (op0, 1)) == CONST_DOUBLE)
|
|
|
|
|
&& mode_signbit_p (mode, op1))
|
|
|
|
|
return simplify_gen_binary (XOR, mode, XEXP (op0, 0),
|
|
|
|
|
simplify_gen_binary (XOR, mode, op1,
|
|
|
|
|
XEXP (op0, 1)));
|
|
|
|
|
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
/* Canonicalize (plus (mult (neg B) C) A) to (minus A (mult B C)). */
|
2007-04-11 13:13:54 +02:00
|
|
|
|
if (!HONOR_SIGN_DEPENDENT_ROUNDING (mode)
|
|
|
|
|
&& GET_CODE (op0) == MULT
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& GET_CODE (XEXP (op0, 0)) == NEG)
|
|
|
|
|
{
|
|
|
|
|
rtx in1, in2;
|
|
|
|
|
|
|
|
|
|
in1 = XEXP (XEXP (op0, 0), 0);
|
|
|
|
|
in2 = XEXP (op0, 1);
|
|
|
|
|
return simplify_gen_binary (MINUS, mode, op1,
|
|
|
|
|
simplify_gen_binary (MULT, mode,
|
|
|
|
|
in1, in2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (plus (comparison A B) C) can become (neg (rev-comp A B)) if
|
|
|
|
|
C is 1 and STORE_FLAG_VALUE is -1 or if C is -1 and STORE_FLAG_VALUE
|
|
|
|
|
is 1. */
|
|
|
|
|
if (COMPARISON_P (op0)
|
|
|
|
|
&& ((STORE_FLAG_VALUE == -1 && trueop1 == const1_rtx)
|
|
|
|
|
|| (STORE_FLAG_VALUE == 1 && trueop1 == constm1_rtx))
|
|
|
|
|
&& (reversed = reversed_comparison (op0, mode)))
|
|
|
|
|
return
|
|
|
|
|
simplify_gen_unary (NEG, mode, reversed, mode);
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* If one of the operands is a PLUS or a MINUS, see if we can
|
|
|
|
|
simplify this by the associative law.
|
|
|
|
|
Don't use the associative law for floating point.
|
|
|
|
|
The inaccuracy makes it nonassociative,
|
|
|
|
|
and subtle programs can break if operations are associated. */
|
|
|
|
|
|
|
|
|
|
if (INTEGRAL_MODE_P (mode)
|
|
|
|
|
&& (plus_minus_operand_p (op0)
|
|
|
|
|
|| plus_minus_operand_p (op1))
|
2005-11-30 09:20:23 +01:00
|
|
|
|
&& (tem = simplify_plus_minus (code, mode, op0, op1)) != 0)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return tem;
|
|
|
|
|
|
|
|
|
|
/* Reassociate floating point addition only when the user
|
2007-09-04 14:11:11 +02:00
|
|
|
|
specifies associative math operations. */
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (FLOAT_MODE_P (mode)
|
2007-09-04 14:11:11 +02:00
|
|
|
|
&& flag_associative_math)
|
2003-02-09 23:55:35 +01:00
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
tem = simplify_associative_operation (code, mode, op0, op1);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
2003-02-09 23:55:35 +01:00
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
break;
|
2003-02-09 23:55:35 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case COMPARE:
|
|
|
|
|
/* Convert (compare (gt (flags) 0) (lt (flags) 0)) to (flags). */
|
|
|
|
|
if (((GET_CODE (op0) == GT && GET_CODE (op1) == LT)
|
|
|
|
|
|| (GET_CODE (op0) == GTU && GET_CODE (op1) == LTU))
|
|
|
|
|
&& XEXP (op0, 1) == const0_rtx && XEXP (op1, 1) == const0_rtx)
|
2005-01-03 20:41:06 +01:00
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
rtx xop00 = XEXP (op0, 0);
|
|
|
|
|
rtx xop10 = XEXP (op1, 0);
|
2005-01-03 20:41:06 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
#ifdef HAVE_cc0
|
|
|
|
|
if (GET_CODE (xop00) == CC0 && GET_CODE (xop10) == CC0)
|
|
|
|
|
#else
|
|
|
|
|
if (REG_P (xop00) && REG_P (xop10)
|
|
|
|
|
&& GET_MODE (xop00) == GET_MODE (xop10)
|
|
|
|
|
&& REGNO (xop00) == REGNO (xop10)
|
|
|
|
|
&& GET_MODE_CLASS (GET_MODE (xop00)) == MODE_CC
|
|
|
|
|
&& GET_MODE_CLASS (GET_MODE (xop10)) == MODE_CC)
|
|
|
|
|
#endif
|
|
|
|
|
return xop00;
|
2005-01-03 20:41:06 +01:00
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MINUS:
|
|
|
|
|
/* We can't assume x-x is 0 even with non-IEEE floating point,
|
|
|
|
|
but since it is zero except in very strange circumstances, we
|
2007-08-22 16:38:16 +02:00
|
|
|
|
will treat it as zero with -ffinite-math-only. */
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (rtx_equal_p (trueop0, trueop1)
|
|
|
|
|
&& ! side_effects_p (op0)
|
2007-08-22 16:38:16 +02:00
|
|
|
|
&& (!FLOAT_MODE_P (mode) || !HONOR_NANS (mode)))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return CONST0_RTX (mode);
|
|
|
|
|
|
|
|
|
|
/* Change subtraction from zero into negation. (0 - x) is the
|
|
|
|
|
same as -x when x is NaN, infinite, or finite and nonzero.
|
|
|
|
|
But if the mode has signed zeros, and does not round towards
|
|
|
|
|
-infinity, then 0 - 0 is 0, not -0. */
|
|
|
|
|
if (!HONOR_SIGNED_ZEROS (mode) && trueop0 == CONST0_RTX (mode))
|
|
|
|
|
return simplify_gen_unary (NEG, mode, op1, mode);
|
|
|
|
|
|
|
|
|
|
/* (-1 - a) is ~a. */
|
|
|
|
|
if (trueop0 == constm1_rtx)
|
|
|
|
|
return simplify_gen_unary (NOT, mode, op1, mode);
|
|
|
|
|
|
|
|
|
|
/* Subtracting 0 has no effect unless the mode has signed zeros
|
|
|
|
|
and supports rounding towards -infinity. In such a case,
|
|
|
|
|
0 - 0 is -0. */
|
|
|
|
|
if (!(HONOR_SIGNED_ZEROS (mode)
|
|
|
|
|
&& HONOR_SIGN_DEPENDENT_ROUNDING (mode))
|
|
|
|
|
&& trueop1 == CONST0_RTX (mode))
|
|
|
|
|
return op0;
|
|
|
|
|
|
|
|
|
|
/* See if this is something like X * C - X or vice versa or
|
|
|
|
|
if the multiplication is written as a shift. If so, we can
|
|
|
|
|
distribute and make a new multiply, shift, or maybe just
|
|
|
|
|
have X (if C is 2 in the example above). But don't make
|
|
|
|
|
something more expensive than we had before. */
|
|
|
|
|
|
2005-04-23 21:16:54 +02:00
|
|
|
|
if (SCALAR_INT_MODE_P (mode))
|
2005-01-03 20:41:06 +01:00
|
|
|
|
{
|
2005-03-24 06:57:52 +01:00
|
|
|
|
HOST_WIDE_INT coeff0h = 0, negcoeff1h = -1;
|
|
|
|
|
unsigned HOST_WIDE_INT coeff0l = 1, negcoeff1l = -1;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
rtx lhs = op0, rhs = op1;
|
2005-01-03 20:41:06 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (GET_CODE (lhs) == NEG)
|
2005-03-24 06:57:52 +01:00
|
|
|
|
{
|
|
|
|
|
coeff0l = -1;
|
|
|
|
|
coeff0h = -1;
|
|
|
|
|
lhs = XEXP (lhs, 0);
|
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
else if (GET_CODE (lhs) == MULT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (lhs, 1)))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
{
|
2005-03-24 06:57:52 +01:00
|
|
|
|
coeff0l = INTVAL (XEXP (lhs, 1));
|
|
|
|
|
coeff0h = INTVAL (XEXP (lhs, 1)) < 0 ? -1 : 0;
|
|
|
|
|
lhs = XEXP (lhs, 0);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
}
|
|
|
|
|
else if (GET_CODE (lhs) == ASHIFT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (lhs, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& INTVAL (XEXP (lhs, 1)) >= 0
|
|
|
|
|
&& INTVAL (XEXP (lhs, 1)) < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
2005-03-24 06:57:52 +01:00
|
|
|
|
coeff0l = ((HOST_WIDE_INT) 1) << INTVAL (XEXP (lhs, 1));
|
|
|
|
|
coeff0h = 0;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
lhs = XEXP (lhs, 0);
|
|
|
|
|
}
|
2005-01-03 20:41:06 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (GET_CODE (rhs) == NEG)
|
2005-03-24 06:57:52 +01:00
|
|
|
|
{
|
|
|
|
|
negcoeff1l = 1;
|
|
|
|
|
negcoeff1h = 0;
|
|
|
|
|
rhs = XEXP (rhs, 0);
|
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
else if (GET_CODE (rhs) == MULT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (rhs, 1)))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
{
|
2005-03-24 06:57:52 +01:00
|
|
|
|
negcoeff1l = -INTVAL (XEXP (rhs, 1));
|
|
|
|
|
negcoeff1h = INTVAL (XEXP (rhs, 1)) <= 0 ? 0 : -1;
|
|
|
|
|
rhs = XEXP (rhs, 0);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
}
|
|
|
|
|
else if (GET_CODE (rhs) == ASHIFT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (rhs, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& INTVAL (XEXP (rhs, 1)) >= 0
|
|
|
|
|
&& INTVAL (XEXP (rhs, 1)) < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
2005-03-24 06:57:52 +01:00
|
|
|
|
negcoeff1l = -(((HOST_WIDE_INT) 1) << INTVAL (XEXP (rhs, 1)));
|
|
|
|
|
negcoeff1h = -1;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
rhs = XEXP (rhs, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (rtx_equal_p (lhs, rhs))
|
|
|
|
|
{
|
|
|
|
|
rtx orig = gen_rtx_MINUS (mode, op0, op1);
|
2005-03-24 06:57:52 +01:00
|
|
|
|
rtx coeff;
|
|
|
|
|
unsigned HOST_WIDE_INT l;
|
|
|
|
|
HOST_WIDE_INT h;
|
fwprop.c (should_replace_address): Add speed attribute.
* fwprop.c (should_replace_address): Add speed attribute.
(PR_OPTIMIZE_FOR_SPEED): New flag.
(propagate_rtx_1): Use it.
(propagate_rtx): Set it.
(try_fwprop_subst): Update call of rtx_costs.
(forward_propagate_and_simplify): LIkewise.
* hooks.c (hook_int_rtx_bool_0): New
(hook_bool_rtx_int_int_intp_false): Replace by ...
(hook_bool_rtx_int_int_intp_bool_false): .. thisone.
* hooks.h (hook_int_rtx_bool_0): New
(hook_bool_rtx_int_int_intp_false): Replace by ...
(hook_bool_rtx_int_int_intp_bool_false): .. thisone.
* optabs.c (avoid_expensive_constant): UPdate call of rtx_cost.
(prepare_cmp_insn): UPdate call of rtx_cost.
* postreload.c (reload_cse_simplify_set): Update call of rtx_cost.
(reload_cse_simplify_operands): Update call of rtx_cost.
(reload_cse_move2add): call of rtx_cost.
* target.h (struct gcc_target): Update rtx_costs and address_costs.
* rtlanal.c (rtx_cost): Add speed argument.
(address_cost): Add speed argument
(default_address_cost): Likewise.
(insn_rtx_cost): Likewise.
* cfgloopanal.c (seq_cost): Add speed argument.
(target_reg_cost, target_spill_cost): Turn to array.
(init_set_costs): Update for speed.
(estimate_reg_pressure_cost): Add speed argument.
* auto-inc-dec.c (attempt_change): Update call of rtx_cost.
* dojump.c (prefer_and_bit_test): UPdate call of rtx_cost.
* tree-ssa-loop-ivopts.c (struct ivopts_data): New field speed.
(seq_cost): Add speed argument.
(computation_cost): Add speed arugment.
(add_cost, multiply_by_const, get_address_cost): add speed argument.
(force_expr_to_var_cost): Update for profile info.
(force_var_cost): Likewise.
(split_address_cost): Likewise.
(ptr_difference_cost): Likewise.
(difference_cost): Likewise.
(get_computation_cost_at): Likewise.
(determine_iv_cost): Likewise.
(ivopts_global_cost_for_size): Likewise.
(rewrite_use_address): Likewise.
(tree_ssa_iv_optimize_loop): Initialize speed field.
* cse.c (optimize_this_for_speed_p): New static var.
(notreg_cost): Update call of rtx_cost.
(cse_extended_basic_block): set optimize_this_for_speed_p.
* ifcvt.c (cheap_bb_rtx_cost_p): Update call of rtx_cost.
(noce_try_cmove_arith): Likewise.
(noce_try_sign_mask): LIkewise.
* expr.c (compress_float_constant): Update rtx_cost calls.
* tree-ssa-address.c (most_expensive_mult_to_index): Add speed argument.
(addr_to_parts): Likewise.
(create_mem_ref): Likewise.
* dse.c (find_shift_sequence): Add speed argument.
(replace_read): Update call.
* calls.c (precompute_register_parameters): Update call of rtx_cost.
* expmed.c (sdiv_pow2_cheap, smod_pow2_cheap, zero_cost, add_cost,
* neg_cost, shift_cost, shiftadd_cost,
shiftsub_cost, mul_cost, sdiv_cost, udiv_cost ,mul_widen_cost,
mul_highpart_cost): Increase dimension.
(init_expmed): Initialize for both size and speed.
(expand_shift): Use profile.
(synth_mult): Use profile.
(choose_mult_variant): Use profile.
(expand_mult): Use profile.
(expand_mult_highpart_optab): Use profile.
(expand_mult_highpart): Use profile.
(expand_smod_pow2): Use profile.
(expand_divmod): Use profile.
* simplify-rtx.c (simplify_binary_operation_1): Update call of rtx_cost.
* loop-invariant.c (create_new_invariant): Use profile.
(gain_for_invariant): Add speed parameter.
(best_gain_for_invariant): Likewise.
(find_invariants_to_move): Likewise.
(move_single_loop_invariants): Set it.
* target-def.h (TARGET_RTX_COSTS): Use hook.
* rtl.h (rtx_cost, address_cost, insn_rtx_cost): Update prototpe.
(optimize_insn_for_size_p, optimize_insn_for_speed_p): Declare.
* output.h (default_address_cost): Update prototype.
* combine.c (optimize_this_for_speed_p): New static var.
(combine_validate_cost): Update call of rtx_cost.
(combine_instructions): Set optimize_this_for_speed_p.
(expand_compound_operation): Update call of rtx_cost.
(make_extraction):Update call of rtx_cost.
(force_to_mode):Update call of rtx_cost.
(distribute_and_simplify_rtx):Update call of rtx_cost.
* cfgloop.h (target_reg_cost, target_spill_cost): Turn to array.
(estimate_reg_pressure_cost): Update prototype.
* tree-flow.h (multiply_by_cost, create_mem_ref): Update prototype.
* basic-block.h (optimize_insn_for_size_p, optimize_insn_for_speed_p):
Remove.
* config/alpha/alpha.c (alpha_rtx_costs): Update.
(alpha_rtx_costs): Update.
* config/frv/frv.c (frv_rtx_costs): Update.
* config/s390/s390.c (s390_rtx_costs): Update.
* config/m32c/m32c.c (m32c_memory_move_cost): Update.
(m32c_rtx_costs): Update.
* config/spu/spu.c (TARGET_ADDRESS_COST): Upate.
(spu_rtx_costs): Update.
* config/sparc/sparc.c (sparc_rtx_costs): Update.
* config/m32r/m32r.c (m32r_rtx_costs): Update.
* config/i386/i386.c (:ix86_address_cost): Update.
(ix86_rtx_costs): Update.
* config/sh/sh.c (sh_rtx_costs, sh_address_cost): Update.
* config/pdp11/pdp11.c (pdp11_rtx_costs): Update.
* config/avr/avr.c (avr_rtx_costs, avr_address_cost): Update.
* config/crx/crx.c (crx_address_cost): Update.
* config/xtensa/xtensa.c (xtensa_rtx_costs): Update.
* config/stormy16/stormy16.c
(xstormy16_address_cost, xstormy16_rtx_costs): Update.
* config/m68hc11/m68hc11.c
(m68hc11_address_cost, m68hc11_rtx_costs): Update.
* config/cris/cris.c (cris_rtx_costs, cris_address_cost): Update.
* config/iq2000/iq2000.c (iq2000_rtx_costs, iq2000_address_cost): Update.
* config/mn10300/mn10300.c (mn10300_address_cost, mn10300_rtx_costs): Update
* config/ia64/ia64.c (ia64_rtx_costs): Update.
* config/m68k/m68k.c (m68k_rtx_costs): Update.
* config/rs6000/rs6000.c (rs6000_rtx_costs): Update.
* config/arc/arc.c (arc_rtx_costs, arc_address_cost): Update.
* config/mcore/mcore.c (TARGET_ADDRESS_COST): Update.
(mcore_rtx_costs): update.
* config/score/score3.c (score3_rtx_costs): Update.
* config/score/score7.c (score7_rtx_costs): Update.
* config/score/score3.h (score3_rtx_costs):Update.
* config/score/score7.h (score7_rtx_costs): Update.
* config/score/score.c (score_rtx_costs): Update.
* config/arm/arm.c (arm_address_cost): Update.
(arm_rtx_costs_1): Update.
(arm_rtx_costs_1): Update.
(arm_size_rtx_costs): Update.
(arm_size_rtx_costs): Update.
(arm_size_rtx_costs): Update.
(arm_xscale_rtx_costs): Update.
(arm_thumb_address_cost): Update.
* config/pa/pa.c (hppa_address_cost): Update.
* config/mips/mips.c (mips_rtx_costs): Update.
* config/vax/vax.c (vax_address_cost): Update.
* config/h8300/h8300.c (h8300_shift_costs): Update.
(h8300_rtx_costs): Update.
* config/v850/v850.c (TARGET_ADDRESS_COST): Update.
(v850_rtx_costs): Update.
* config/mmix/mmix.c (mmix_rtx_costs, mmix_rtx_costs): Update.
* config/bfin/bfin.c
(bfin_address_cost): Update.
(bfin_rtx_costs): Update.
* stmt.c (lshift_cheap_p): Update.
From-SVN: r139821
2008-08-31 11:44:25 +02:00
|
|
|
|
bool speed = optimize_function_for_speed_p (cfun);
|
2005-03-24 06:57:52 +01:00
|
|
|
|
|
|
|
|
|
add_double (coeff0l, coeff0h, negcoeff1l, negcoeff1h, &l, &h);
|
|
|
|
|
coeff = immed_double_const (l, h, mode);
|
|
|
|
|
|
|
|
|
|
tem = simplify_gen_binary (MULT, mode, lhs, coeff);
|
fwprop.c (should_replace_address): Add speed attribute.
* fwprop.c (should_replace_address): Add speed attribute.
(PR_OPTIMIZE_FOR_SPEED): New flag.
(propagate_rtx_1): Use it.
(propagate_rtx): Set it.
(try_fwprop_subst): Update call of rtx_costs.
(forward_propagate_and_simplify): LIkewise.
* hooks.c (hook_int_rtx_bool_0): New
(hook_bool_rtx_int_int_intp_false): Replace by ...
(hook_bool_rtx_int_int_intp_bool_false): .. thisone.
* hooks.h (hook_int_rtx_bool_0): New
(hook_bool_rtx_int_int_intp_false): Replace by ...
(hook_bool_rtx_int_int_intp_bool_false): .. thisone.
* optabs.c (avoid_expensive_constant): UPdate call of rtx_cost.
(prepare_cmp_insn): UPdate call of rtx_cost.
* postreload.c (reload_cse_simplify_set): Update call of rtx_cost.
(reload_cse_simplify_operands): Update call of rtx_cost.
(reload_cse_move2add): call of rtx_cost.
* target.h (struct gcc_target): Update rtx_costs and address_costs.
* rtlanal.c (rtx_cost): Add speed argument.
(address_cost): Add speed argument
(default_address_cost): Likewise.
(insn_rtx_cost): Likewise.
* cfgloopanal.c (seq_cost): Add speed argument.
(target_reg_cost, target_spill_cost): Turn to array.
(init_set_costs): Update for speed.
(estimate_reg_pressure_cost): Add speed argument.
* auto-inc-dec.c (attempt_change): Update call of rtx_cost.
* dojump.c (prefer_and_bit_test): UPdate call of rtx_cost.
* tree-ssa-loop-ivopts.c (struct ivopts_data): New field speed.
(seq_cost): Add speed argument.
(computation_cost): Add speed arugment.
(add_cost, multiply_by_const, get_address_cost): add speed argument.
(force_expr_to_var_cost): Update for profile info.
(force_var_cost): Likewise.
(split_address_cost): Likewise.
(ptr_difference_cost): Likewise.
(difference_cost): Likewise.
(get_computation_cost_at): Likewise.
(determine_iv_cost): Likewise.
(ivopts_global_cost_for_size): Likewise.
(rewrite_use_address): Likewise.
(tree_ssa_iv_optimize_loop): Initialize speed field.
* cse.c (optimize_this_for_speed_p): New static var.
(notreg_cost): Update call of rtx_cost.
(cse_extended_basic_block): set optimize_this_for_speed_p.
* ifcvt.c (cheap_bb_rtx_cost_p): Update call of rtx_cost.
(noce_try_cmove_arith): Likewise.
(noce_try_sign_mask): LIkewise.
* expr.c (compress_float_constant): Update rtx_cost calls.
* tree-ssa-address.c (most_expensive_mult_to_index): Add speed argument.
(addr_to_parts): Likewise.
(create_mem_ref): Likewise.
* dse.c (find_shift_sequence): Add speed argument.
(replace_read): Update call.
* calls.c (precompute_register_parameters): Update call of rtx_cost.
* expmed.c (sdiv_pow2_cheap, smod_pow2_cheap, zero_cost, add_cost,
* neg_cost, shift_cost, shiftadd_cost,
shiftsub_cost, mul_cost, sdiv_cost, udiv_cost ,mul_widen_cost,
mul_highpart_cost): Increase dimension.
(init_expmed): Initialize for both size and speed.
(expand_shift): Use profile.
(synth_mult): Use profile.
(choose_mult_variant): Use profile.
(expand_mult): Use profile.
(expand_mult_highpart_optab): Use profile.
(expand_mult_highpart): Use profile.
(expand_smod_pow2): Use profile.
(expand_divmod): Use profile.
* simplify-rtx.c (simplify_binary_operation_1): Update call of rtx_cost.
* loop-invariant.c (create_new_invariant): Use profile.
(gain_for_invariant): Add speed parameter.
(best_gain_for_invariant): Likewise.
(find_invariants_to_move): Likewise.
(move_single_loop_invariants): Set it.
* target-def.h (TARGET_RTX_COSTS): Use hook.
* rtl.h (rtx_cost, address_cost, insn_rtx_cost): Update prototpe.
(optimize_insn_for_size_p, optimize_insn_for_speed_p): Declare.
* output.h (default_address_cost): Update prototype.
* combine.c (optimize_this_for_speed_p): New static var.
(combine_validate_cost): Update call of rtx_cost.
(combine_instructions): Set optimize_this_for_speed_p.
(expand_compound_operation): Update call of rtx_cost.
(make_extraction):Update call of rtx_cost.
(force_to_mode):Update call of rtx_cost.
(distribute_and_simplify_rtx):Update call of rtx_cost.
* cfgloop.h (target_reg_cost, target_spill_cost): Turn to array.
(estimate_reg_pressure_cost): Update prototype.
* tree-flow.h (multiply_by_cost, create_mem_ref): Update prototype.
* basic-block.h (optimize_insn_for_size_p, optimize_insn_for_speed_p):
Remove.
* config/alpha/alpha.c (alpha_rtx_costs): Update.
(alpha_rtx_costs): Update.
* config/frv/frv.c (frv_rtx_costs): Update.
* config/s390/s390.c (s390_rtx_costs): Update.
* config/m32c/m32c.c (m32c_memory_move_cost): Update.
(m32c_rtx_costs): Update.
* config/spu/spu.c (TARGET_ADDRESS_COST): Upate.
(spu_rtx_costs): Update.
* config/sparc/sparc.c (sparc_rtx_costs): Update.
* config/m32r/m32r.c (m32r_rtx_costs): Update.
* config/i386/i386.c (:ix86_address_cost): Update.
(ix86_rtx_costs): Update.
* config/sh/sh.c (sh_rtx_costs, sh_address_cost): Update.
* config/pdp11/pdp11.c (pdp11_rtx_costs): Update.
* config/avr/avr.c (avr_rtx_costs, avr_address_cost): Update.
* config/crx/crx.c (crx_address_cost): Update.
* config/xtensa/xtensa.c (xtensa_rtx_costs): Update.
* config/stormy16/stormy16.c
(xstormy16_address_cost, xstormy16_rtx_costs): Update.
* config/m68hc11/m68hc11.c
(m68hc11_address_cost, m68hc11_rtx_costs): Update.
* config/cris/cris.c (cris_rtx_costs, cris_address_cost): Update.
* config/iq2000/iq2000.c (iq2000_rtx_costs, iq2000_address_cost): Update.
* config/mn10300/mn10300.c (mn10300_address_cost, mn10300_rtx_costs): Update
* config/ia64/ia64.c (ia64_rtx_costs): Update.
* config/m68k/m68k.c (m68k_rtx_costs): Update.
* config/rs6000/rs6000.c (rs6000_rtx_costs): Update.
* config/arc/arc.c (arc_rtx_costs, arc_address_cost): Update.
* config/mcore/mcore.c (TARGET_ADDRESS_COST): Update.
(mcore_rtx_costs): update.
* config/score/score3.c (score3_rtx_costs): Update.
* config/score/score7.c (score7_rtx_costs): Update.
* config/score/score3.h (score3_rtx_costs):Update.
* config/score/score7.h (score7_rtx_costs): Update.
* config/score/score.c (score_rtx_costs): Update.
* config/arm/arm.c (arm_address_cost): Update.
(arm_rtx_costs_1): Update.
(arm_rtx_costs_1): Update.
(arm_size_rtx_costs): Update.
(arm_size_rtx_costs): Update.
(arm_size_rtx_costs): Update.
(arm_xscale_rtx_costs): Update.
(arm_thumb_address_cost): Update.
* config/pa/pa.c (hppa_address_cost): Update.
* config/mips/mips.c (mips_rtx_costs): Update.
* config/vax/vax.c (vax_address_cost): Update.
* config/h8300/h8300.c (h8300_shift_costs): Update.
(h8300_rtx_costs): Update.
* config/v850/v850.c (TARGET_ADDRESS_COST): Update.
(v850_rtx_costs): Update.
* config/mmix/mmix.c (mmix_rtx_costs, mmix_rtx_costs): Update.
* config/bfin/bfin.c
(bfin_address_cost): Update.
(bfin_rtx_costs): Update.
* stmt.c (lshift_cheap_p): Update.
From-SVN: r139821
2008-08-31 11:44:25 +02:00
|
|
|
|
return rtx_cost (tem, SET, speed) <= rtx_cost (orig, SET, speed)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
? tem : 0;
|
|
|
|
|
}
|
2005-01-03 20:41:06 +01:00
|
|
|
|
}
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* (a - (-b)) -> (a + b). True even for IEEE. */
|
|
|
|
|
if (GET_CODE (op1) == NEG)
|
|
|
|
|
return simplify_gen_binary (PLUS, mode, op0, XEXP (op1, 0));
|
2005-01-03 20:41:06 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* (-x - c) may be simplified as (-c - x). */
|
|
|
|
|
if (GET_CODE (op0) == NEG
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& (CONST_INT_P (op1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|| GET_CODE (op1) == CONST_DOUBLE))
|
simplify-rtx.c (simplify_unary_operation): Deal with logicals on floats.
* simplify-rtx.c (simplify_unary_operation): Deal with logicals on
floats.
(simplify_binary_operation): Deal with logicals on floats.
* i386.md (SSE fabs splitters): Emit new patterns.
(SSE cmov splitters): Likewise.
(sse_andv4sf3, sse_nandv4sf3, sse_iorv4sf3, sse_xorv4sf3
(sse_andv2df3, sse_nandv2df3, sse_iorv2df3, sse_xorv2df3): Do not use
subregs.
(sse_andsf3, sse_nandsf3, sse_xorsf3): Kill.
(sse_anddf3, sse_nanddf3, sse_xordf3): Kill.
From-SVN: r78045
2004-02-18 21:55:29 +01:00
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
tem = simplify_unary_operation (NEG, mode, op1, mode);
|
|
|
|
|
if (tem)
|
|
|
|
|
return simplify_gen_binary (MINUS, mode, tem, XEXP (op0, 0));
|
|
|
|
|
}
|
simplify-rtx.c (simplify_unary_operation): Deal with logicals on floats.
* simplify-rtx.c (simplify_unary_operation): Deal with logicals on
floats.
(simplify_binary_operation): Deal with logicals on floats.
* i386.md (SSE fabs splitters): Emit new patterns.
(SSE cmov splitters): Likewise.
(sse_andv4sf3, sse_nandv4sf3, sse_iorv4sf3, sse_xorv4sf3
(sse_andv2df3, sse_nandv2df3, sse_iorv2df3, sse_xorv2df3): Do not use
subregs.
(sse_andsf3, sse_nandsf3, sse_xorsf3): Kill.
(sse_anddf3, sse_nanddf3, sse_xordf3): Kill.
From-SVN: r78045
2004-02-18 21:55:29 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* Don't let a relocatable value get a negative coeff. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op1) && GET_MODE (op0) != VOIDmode)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return simplify_gen_binary (PLUS, mode,
|
|
|
|
|
op0,
|
|
|
|
|
neg_const_int (mode, op1));
|
|
|
|
|
|
|
|
|
|
/* (x - (x & y)) -> (x & ~y) */
|
|
|
|
|
if (GET_CODE (op1) == AND)
|
|
|
|
|
{
|
|
|
|
|
if (rtx_equal_p (op0, XEXP (op1, 0)))
|
simplify-rtx.c (simplify_unary_operation): Deal with logicals on floats.
* simplify-rtx.c (simplify_unary_operation): Deal with logicals on
floats.
(simplify_binary_operation): Deal with logicals on floats.
* i386.md (SSE fabs splitters): Emit new patterns.
(SSE cmov splitters): Likewise.
(sse_andv4sf3, sse_nandv4sf3, sse_iorv4sf3, sse_xorv4sf3
(sse_andv2df3, sse_nandv2df3, sse_iorv2df3, sse_xorv2df3): Do not use
subregs.
(sse_andsf3, sse_nandsf3, sse_xorsf3): Kill.
(sse_anddf3, sse_nanddf3, sse_xordf3): Kill.
From-SVN: r78045
2004-02-18 21:55:29 +01:00
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
tem = simplify_gen_unary (NOT, mode, XEXP (op1, 1),
|
|
|
|
|
GET_MODE (XEXP (op1, 1)));
|
|
|
|
|
return simplify_gen_binary (AND, mode, op0, tem);
|
|
|
|
|
}
|
|
|
|
|
if (rtx_equal_p (op0, XEXP (op1, 1)))
|
|
|
|
|
{
|
|
|
|
|
tem = simplify_gen_unary (NOT, mode, XEXP (op1, 0),
|
|
|
|
|
GET_MODE (XEXP (op1, 0)));
|
|
|
|
|
return simplify_gen_binary (AND, mode, op0, tem);
|
simplify-rtx.c (simplify_unary_operation): Deal with logicals on floats.
* simplify-rtx.c (simplify_unary_operation): Deal with logicals on
floats.
(simplify_binary_operation): Deal with logicals on floats.
* i386.md (SSE fabs splitters): Emit new patterns.
(SSE cmov splitters): Likewise.
(sse_andv4sf3, sse_nandv4sf3, sse_iorv4sf3, sse_xorv4sf3
(sse_andv2df3, sse_nandv2df3, sse_iorv2df3, sse_xorv2df3): Do not use
subregs.
(sse_andsf3, sse_nandsf3, sse_xorsf3): Kill.
(sse_anddf3, sse_nanddf3, sse_xordf3): Kill.
From-SVN: r78045
2004-02-18 21:55:29 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2005-11-30 09:20:23 +01:00
|
|
|
|
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
/* If STORE_FLAG_VALUE is 1, (minus 1 (comparison foo bar)) can be done
|
|
|
|
|
by reversing the comparison code if valid. */
|
|
|
|
|
if (STORE_FLAG_VALUE == 1
|
|
|
|
|
&& trueop0 == const1_rtx
|
|
|
|
|
&& COMPARISON_P (op1)
|
|
|
|
|
&& (reversed = reversed_comparison (op1, mode)))
|
|
|
|
|
return reversed;
|
|
|
|
|
|
|
|
|
|
/* Canonicalize (minus A (mult (neg B) C)) to (plus (mult B C) A). */
|
2007-04-11 13:13:54 +02:00
|
|
|
|
if (!HONOR_SIGN_DEPENDENT_ROUNDING (mode)
|
|
|
|
|
&& GET_CODE (op1) == MULT
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& GET_CODE (XEXP (op1, 0)) == NEG)
|
|
|
|
|
{
|
|
|
|
|
rtx in1, in2;
|
|
|
|
|
|
|
|
|
|
in1 = XEXP (XEXP (op1, 0), 0);
|
|
|
|
|
in2 = XEXP (op1, 1);
|
|
|
|
|
return simplify_gen_binary (PLUS, mode,
|
|
|
|
|
simplify_gen_binary (MULT, mode,
|
|
|
|
|
in1, in2),
|
|
|
|
|
op0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Canonicalize (minus (neg A) (mult B C)) to
|
|
|
|
|
(minus (mult (neg B) C) A). */
|
2007-04-11 13:13:54 +02:00
|
|
|
|
if (!HONOR_SIGN_DEPENDENT_ROUNDING (mode)
|
|
|
|
|
&& GET_CODE (op1) == MULT
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& GET_CODE (op0) == NEG)
|
|
|
|
|
{
|
|
|
|
|
rtx in1, in2;
|
|
|
|
|
|
|
|
|
|
in1 = simplify_gen_unary (NEG, mode, XEXP (op1, 0), mode);
|
|
|
|
|
in2 = XEXP (op1, 1);
|
|
|
|
|
return simplify_gen_binary (MINUS, mode,
|
|
|
|
|
simplify_gen_binary (MULT, mode,
|
|
|
|
|
in1, in2),
|
|
|
|
|
XEXP (op0, 0));
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-30 09:20:23 +01:00
|
|
|
|
/* If one of the operands is a PLUS or a MINUS, see if we can
|
|
|
|
|
simplify this by the associative law. This will, for example,
|
|
|
|
|
canonicalize (minus A (plus B C)) to (minus (minus A B) C).
|
|
|
|
|
Don't use the associative law for floating point.
|
|
|
|
|
The inaccuracy makes it nonassociative,
|
|
|
|
|
and subtle programs can break if operations are associated. */
|
|
|
|
|
|
|
|
|
|
if (INTEGRAL_MODE_P (mode)
|
|
|
|
|
&& (plus_minus_operand_p (op0)
|
|
|
|
|
|| plus_minus_operand_p (op1))
|
|
|
|
|
&& (tem = simplify_plus_minus (code, mode, op0, op1)) != 0)
|
|
|
|
|
return tem;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
break;
|
2002-03-25 21:52:28 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case MULT:
|
|
|
|
|
if (trueop1 == constm1_rtx)
|
|
|
|
|
return simplify_gen_unary (NEG, mode, op0, mode);
|
|
|
|
|
|
|
|
|
|
/* Maybe simplify x * 0 to 0. The reduction is not valid if
|
|
|
|
|
x is NaN, since x * 0 is then also NaN. Nor is it valid
|
|
|
|
|
when the mode has signed zeros, since multiplying a negative
|
|
|
|
|
number by 0 will give -0, not 0. */
|
|
|
|
|
if (!HONOR_NANS (mode)
|
|
|
|
|
&& !HONOR_SIGNED_ZEROS (mode)
|
|
|
|
|
&& trueop1 == CONST0_RTX (mode)
|
|
|
|
|
&& ! side_effects_p (op0))
|
|
|
|
|
return op1;
|
|
|
|
|
|
|
|
|
|
/* In IEEE floating point, x*1 is not equivalent to x for
|
|
|
|
|
signalling NaNs. */
|
|
|
|
|
if (!HONOR_SNANS (mode)
|
|
|
|
|
&& trueop1 == CONST1_RTX (mode))
|
|
|
|
|
return op0;
|
|
|
|
|
|
|
|
|
|
/* Convert multiply by constant power of two into shift unless
|
|
|
|
|
we are still generating RTL. This test is a kludge. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (trueop1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& (val = exact_log2 (INTVAL (trueop1))) >= 0
|
|
|
|
|
/* If the mode is larger than the host word size, and the
|
|
|
|
|
uppermost bit is set, then this isn't a power of two due
|
|
|
|
|
to implicit sign extension. */
|
|
|
|
|
&& (width <= HOST_BITS_PER_WIDE_INT
|
|
|
|
|
|| val != HOST_BITS_PER_WIDE_INT - 1))
|
|
|
|
|
return simplify_gen_binary (ASHIFT, mode, op0, GEN_INT (val));
|
|
|
|
|
|
2005-03-24 06:57:52 +01:00
|
|
|
|
/* Likewise for multipliers wider than a word. */
|
2006-05-29 18:22:05 +02:00
|
|
|
|
if (GET_CODE (trueop1) == CONST_DOUBLE
|
|
|
|
|
&& (GET_MODE (trueop1) == VOIDmode
|
|
|
|
|
|| GET_MODE_CLASS (GET_MODE (trueop1)) == MODE_INT)
|
|
|
|
|
&& GET_MODE (op0) == mode
|
|
|
|
|
&& CONST_DOUBLE_LOW (trueop1) == 0
|
|
|
|
|
&& (val = exact_log2 (CONST_DOUBLE_HIGH (trueop1))) >= 0)
|
2005-03-24 06:57:52 +01:00
|
|
|
|
return simplify_gen_binary (ASHIFT, mode, op0,
|
|
|
|
|
GEN_INT (val + HOST_BITS_PER_WIDE_INT));
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* x*2 is x+x and x*(-1) is -x */
|
|
|
|
|
if (GET_CODE (trueop1) == CONST_DOUBLE
|
2005-11-21 21:53:27 +01:00
|
|
|
|
&& SCALAR_FLOAT_MODE_P (GET_MODE (trueop1))
|
2009-08-03 23:38:53 +02:00
|
|
|
|
&& !DECIMAL_FLOAT_MODE_P (GET_MODE (trueop1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& GET_MODE (op0) == mode)
|
|
|
|
|
{
|
|
|
|
|
REAL_VALUE_TYPE d;
|
|
|
|
|
REAL_VALUE_FROM_CONST_DOUBLE (d, trueop1);
|
2002-03-25 21:52:28 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (REAL_VALUES_EQUAL (d, dconst2))
|
|
|
|
|
return simplify_gen_binary (PLUS, mode, op0, copy_rtx (op0));
|
2003-07-18 02:26:51 +02:00
|
|
|
|
|
2006-05-29 18:22:05 +02:00
|
|
|
|
if (!HONOR_SNANS (mode)
|
|
|
|
|
&& REAL_VALUES_EQUAL (d, dconstm1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return simplify_gen_unary (NEG, mode, op0, mode);
|
|
|
|
|
}
|
2002-03-25 21:52:28 +01:00
|
|
|
|
|
2006-05-29 18:22:05 +02:00
|
|
|
|
/* Optimize -x * -x as x * x. */
|
|
|
|
|
if (FLOAT_MODE_P (mode)
|
|
|
|
|
&& GET_CODE (op0) == NEG
|
|
|
|
|
&& GET_CODE (op1) == NEG
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 0), XEXP (op1, 0))
|
|
|
|
|
&& !side_effects_p (XEXP (op0, 0)))
|
|
|
|
|
return simplify_gen_binary (MULT, mode, XEXP (op0, 0), XEXP (op1, 0));
|
|
|
|
|
|
|
|
|
|
/* Likewise, optimize abs(x) * abs(x) as x * x. */
|
|
|
|
|
if (SCALAR_FLOAT_MODE_P (mode)
|
|
|
|
|
&& GET_CODE (op0) == ABS
|
|
|
|
|
&& GET_CODE (op1) == ABS
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 0), XEXP (op1, 0))
|
|
|
|
|
&& !side_effects_p (XEXP (op0, 0)))
|
|
|
|
|
return simplify_gen_binary (MULT, mode, XEXP (op0, 0), XEXP (op1, 0));
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* Reassociate multiplication, but for floating point MULTs
|
|
|
|
|
only when the user specifies unsafe math optimizations. */
|
|
|
|
|
if (! FLOAT_MODE_P (mode)
|
|
|
|
|
|| flag_unsafe_math_optimizations)
|
|
|
|
|
{
|
|
|
|
|
tem = simplify_associative_operation (code, mode, op0, op1);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2004-06-14 19:45:08 +02:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case IOR:
|
|
|
|
|
if (trueop1 == const0_rtx)
|
|
|
|
|
return op0;
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (trueop1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& ((INTVAL (trueop1) & GET_MODE_MASK (mode))
|
|
|
|
|
== GET_MODE_MASK (mode)))
|
|
|
|
|
return op1;
|
|
|
|
|
if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0))
|
|
|
|
|
return op0;
|
|
|
|
|
/* A | (~A) -> -1 */
|
|
|
|
|
if (((GET_CODE (op0) == NOT && rtx_equal_p (XEXP (op0, 0), op1))
|
|
|
|
|
|| (GET_CODE (op1) == NOT && rtx_equal_p (XEXP (op1, 0), op0)))
|
|
|
|
|
&& ! side_effects_p (op0)
|
2005-04-25 00:16:48 +02:00
|
|
|
|
&& SCALAR_INT_MODE_P (mode))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return constm1_rtx;
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
|
|
|
|
|
/* (ior A C) is C if all bits of A that might be nonzero are on in C. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op1)
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
|
|
|
|
|
&& (nonzero_bits (op0, mode) & ~INTVAL (op1)) == 0)
|
|
|
|
|
return op1;
|
|
|
|
|
|
2007-02-19 01:54:29 +01:00
|
|
|
|
/* Canonicalize (X & C1) | C2. */
|
|
|
|
|
if (GET_CODE (op0) == AND
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (trueop1)
|
|
|
|
|
&& CONST_INT_P (XEXP (op0, 1)))
|
2007-02-19 01:54:29 +01:00
|
|
|
|
{
|
|
|
|
|
HOST_WIDE_INT mask = GET_MODE_MASK (mode);
|
|
|
|
|
HOST_WIDE_INT c1 = INTVAL (XEXP (op0, 1));
|
|
|
|
|
HOST_WIDE_INT c2 = INTVAL (trueop1);
|
|
|
|
|
|
|
|
|
|
/* If (C1&C2) == C1, then (X&C1)|C2 becomes X. */
|
|
|
|
|
if ((c1 & c2) == c1
|
|
|
|
|
&& !side_effects_p (XEXP (op0, 0)))
|
|
|
|
|
return trueop1;
|
|
|
|
|
|
|
|
|
|
/* If (C1|C2) == ~0 then (X&C1)|C2 becomes X|C2. */
|
|
|
|
|
if (((c1|c2) & mask) == mask)
|
|
|
|
|
return simplify_gen_binary (IOR, mode, XEXP (op0, 0), op1);
|
|
|
|
|
|
|
|
|
|
/* Minimize the number of bits set in C1, i.e. C1 := C1 & ~C2. */
|
|
|
|
|
if (((c1 & ~c2) & mask) != (c1 & mask))
|
|
|
|
|
{
|
|
|
|
|
tem = simplify_gen_binary (AND, mode, XEXP (op0, 0),
|
|
|
|
|
gen_int_mode (c1 & ~c2, mode));
|
|
|
|
|
return simplify_gen_binary (IOR, mode, tem, op1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
/* Convert (A & B) | A to A. */
|
|
|
|
|
if (GET_CODE (op0) == AND
|
|
|
|
|
&& (rtx_equal_p (XEXP (op0, 0), op1)
|
|
|
|
|
|| rtx_equal_p (XEXP (op0, 1), op1))
|
|
|
|
|
&& ! side_effects_p (XEXP (op0, 0))
|
|
|
|
|
&& ! side_effects_p (XEXP (op0, 1)))
|
|
|
|
|
return op1;
|
|
|
|
|
|
|
|
|
|
/* Convert (ior (ashift A CX) (lshiftrt A CY)) where CX+CY equals the
|
|
|
|
|
mode size to (rotate A CX). */
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (op1) == ASHIFT
|
|
|
|
|
|| GET_CODE (op1) == SUBREG)
|
|
|
|
|
{
|
|
|
|
|
opleft = op1;
|
|
|
|
|
opright = op0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
opright = op1;
|
|
|
|
|
opleft = op0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (opleft) == ASHIFT && GET_CODE (opright) == LSHIFTRT
|
|
|
|
|
&& rtx_equal_p (XEXP (opleft, 0), XEXP (opright, 0))
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (opleft, 1))
|
|
|
|
|
&& CONST_INT_P (XEXP (opright, 1))
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& (INTVAL (XEXP (opleft, 1)) + INTVAL (XEXP (opright, 1))
|
|
|
|
|
== GET_MODE_BITSIZE (mode)))
|
|
|
|
|
return gen_rtx_ROTATE (mode, XEXP (opright, 0), XEXP (opleft, 1));
|
|
|
|
|
|
|
|
|
|
/* Same, but for ashift that has been "simplified" to a wider mode
|
|
|
|
|
by simplify_shift_const. */
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (opleft) == SUBREG
|
|
|
|
|
&& GET_CODE (SUBREG_REG (opleft)) == ASHIFT
|
|
|
|
|
&& GET_CODE (opright) == LSHIFTRT
|
|
|
|
|
&& GET_CODE (XEXP (opright, 0)) == SUBREG
|
|
|
|
|
&& GET_MODE (opleft) == GET_MODE (XEXP (opright, 0))
|
|
|
|
|
&& SUBREG_BYTE (opleft) == SUBREG_BYTE (XEXP (opright, 0))
|
|
|
|
|
&& (GET_MODE_SIZE (GET_MODE (opleft))
|
|
|
|
|
< GET_MODE_SIZE (GET_MODE (SUBREG_REG (opleft))))
|
|
|
|
|
&& rtx_equal_p (XEXP (SUBREG_REG (opleft), 0),
|
|
|
|
|
SUBREG_REG (XEXP (opright, 0)))
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (SUBREG_REG (opleft), 1))
|
|
|
|
|
&& CONST_INT_P (XEXP (opright, 1))
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& (INTVAL (XEXP (SUBREG_REG (opleft), 1)) + INTVAL (XEXP (opright, 1))
|
|
|
|
|
== GET_MODE_BITSIZE (mode)))
|
|
|
|
|
return gen_rtx_ROTATE (mode, XEXP (opright, 0),
|
2005-12-17 00:50:42 +01:00
|
|
|
|
XEXP (SUBREG_REG (opleft), 1));
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
|
|
|
|
|
/* If we have (ior (and (X C1) C2)), simplify this by making
|
|
|
|
|
C1 as small as possible if C1 actually changes. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op1)
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
|
|
|
|
|
|| INTVAL (op1) > 0)
|
|
|
|
|
&& GET_CODE (op0) == AND
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (op0, 1))
|
|
|
|
|
&& CONST_INT_P (op1)
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& (INTVAL (XEXP (op0, 1)) & INTVAL (op1)) != 0)
|
|
|
|
|
return simplify_gen_binary (IOR, mode,
|
|
|
|
|
simplify_gen_binary
|
|
|
|
|
(AND, mode, XEXP (op0, 0),
|
|
|
|
|
GEN_INT (INTVAL (XEXP (op0, 1))
|
|
|
|
|
& ~INTVAL (op1))),
|
|
|
|
|
op1);
|
|
|
|
|
|
|
|
|
|
/* If OP0 is (ashiftrt (plus ...) C), it might actually be
|
|
|
|
|
a (sign_extend (plus ...)). Then check if OP1 is a CONST_INT and
|
|
|
|
|
the PLUS does not affect any of the bits in OP1: then we can do
|
|
|
|
|
the IOR as a PLUS and we can associate. This is valid if OP1
|
|
|
|
|
can be safely shifted left C bits. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (trueop1) && GET_CODE (op0) == ASHIFTRT
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& GET_CODE (XEXP (op0, 0)) == PLUS
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (XEXP (op0, 0), 1))
|
|
|
|
|
&& CONST_INT_P (XEXP (op0, 1))
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& INTVAL (XEXP (op0, 1)) < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
|
|
|
|
int count = INTVAL (XEXP (op0, 1));
|
|
|
|
|
HOST_WIDE_INT mask = INTVAL (trueop1) << count;
|
|
|
|
|
|
|
|
|
|
if (mask >> count == INTVAL (trueop1)
|
|
|
|
|
&& (mask & nonzero_bits (XEXP (op0, 0), mode)) == 0)
|
|
|
|
|
return simplify_gen_binary (ASHIFTRT, mode,
|
|
|
|
|
plus_constant (XEXP (op0, 0), mask),
|
|
|
|
|
XEXP (op0, 1));
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
tem = simplify_associative_operation (code, mode, op0, op1);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XOR:
|
|
|
|
|
if (trueop1 == const0_rtx)
|
|
|
|
|
return op0;
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (trueop1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& ((INTVAL (trueop1) & GET_MODE_MASK (mode))
|
|
|
|
|
== GET_MODE_MASK (mode)))
|
|
|
|
|
return simplify_gen_unary (NOT, mode, op0, mode);
|
2005-09-06 19:51:48 +02:00
|
|
|
|
if (rtx_equal_p (trueop0, trueop1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& ! side_effects_p (op0)
|
|
|
|
|
&& GET_MODE_CLASS (mode) != MODE_CC)
|
2005-04-13 21:47:30 +02:00
|
|
|
|
return CONST0_RTX (mode);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|
|
|
|
|
/* Canonicalize XOR of the most significant bit to PLUS. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if ((CONST_INT_P (op1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|| GET_CODE (op1) == CONST_DOUBLE)
|
|
|
|
|
&& mode_signbit_p (mode, op1))
|
|
|
|
|
return simplify_gen_binary (PLUS, mode, op0, op1);
|
|
|
|
|
/* (xor (plus X C1) C2) is (xor X (C1^C2)) if C1 is signbit. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if ((CONST_INT_P (op1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|| GET_CODE (op1) == CONST_DOUBLE)
|
|
|
|
|
&& GET_CODE (op0) == PLUS
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& (CONST_INT_P (XEXP (op0, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|| GET_CODE (XEXP (op0, 1)) == CONST_DOUBLE)
|
|
|
|
|
&& mode_signbit_p (mode, XEXP (op0, 1)))
|
|
|
|
|
return simplify_gen_binary (XOR, mode, XEXP (op0, 0),
|
|
|
|
|
simplify_gen_binary (XOR, mode, op1,
|
|
|
|
|
XEXP (op0, 1)));
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
|
|
|
|
|
/* If we are XORing two things that have no bits in common,
|
|
|
|
|
convert them into an IOR. This helps to detect rotation encoded
|
|
|
|
|
using those methods and possibly other simplifications. */
|
|
|
|
|
|
|
|
|
|
if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
|
|
|
|
|
&& (nonzero_bits (op0, mode)
|
|
|
|
|
& nonzero_bits (op1, mode)) == 0)
|
|
|
|
|
return (simplify_gen_binary (IOR, mode, op0, op1));
|
|
|
|
|
|
|
|
|
|
/* Convert (XOR (NOT x) (NOT y)) to (XOR x y).
|
|
|
|
|
Also convert (XOR (NOT x) y) to (NOT (XOR x y)), similarly for
|
|
|
|
|
(NOT y). */
|
|
|
|
|
{
|
|
|
|
|
int num_negated = 0;
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (op0) == NOT)
|
|
|
|
|
num_negated++, op0 = XEXP (op0, 0);
|
|
|
|
|
if (GET_CODE (op1) == NOT)
|
|
|
|
|
num_negated++, op1 = XEXP (op1, 0);
|
|
|
|
|
|
|
|
|
|
if (num_negated == 2)
|
|
|
|
|
return simplify_gen_binary (XOR, mode, op0, op1);
|
|
|
|
|
else if (num_negated == 1)
|
|
|
|
|
return simplify_gen_unary (NOT, mode,
|
|
|
|
|
simplify_gen_binary (XOR, mode, op0, op1),
|
|
|
|
|
mode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Convert (xor (and A B) B) to (and (not A) B). The latter may
|
|
|
|
|
correspond to a machine insn or result in further simplifications
|
|
|
|
|
if B is a constant. */
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (op0) == AND
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 1), op1)
|
|
|
|
|
&& ! side_effects_p (op1))
|
|
|
|
|
return simplify_gen_binary (AND, mode,
|
|
|
|
|
simplify_gen_unary (NOT, mode,
|
|
|
|
|
XEXP (op0, 0), mode),
|
|
|
|
|
op1);
|
|
|
|
|
|
|
|
|
|
else if (GET_CODE (op0) == AND
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 0), op1)
|
|
|
|
|
&& ! side_effects_p (op1))
|
|
|
|
|
return simplify_gen_binary (AND, mode,
|
|
|
|
|
simplify_gen_unary (NOT, mode,
|
|
|
|
|
XEXP (op0, 1), mode),
|
|
|
|
|
op1);
|
|
|
|
|
|
|
|
|
|
/* (xor (comparison foo bar) (const_int 1)) can become the reversed
|
|
|
|
|
comparison if STORE_FLAG_VALUE is 1. */
|
|
|
|
|
if (STORE_FLAG_VALUE == 1
|
|
|
|
|
&& trueop1 == const1_rtx
|
|
|
|
|
&& COMPARISON_P (op0)
|
|
|
|
|
&& (reversed = reversed_comparison (op0, mode)))
|
|
|
|
|
return reversed;
|
|
|
|
|
|
|
|
|
|
/* (lshiftrt foo C) where C is the number of bits in FOO minus 1
|
|
|
|
|
is (lt foo (const_int 0)), so we can perform the above
|
|
|
|
|
simplification if STORE_FLAG_VALUE is 1. */
|
|
|
|
|
|
|
|
|
|
if (STORE_FLAG_VALUE == 1
|
|
|
|
|
&& trueop1 == const1_rtx
|
|
|
|
|
&& GET_CODE (op0) == LSHIFTRT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (op0, 1))
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& INTVAL (XEXP (op0, 1)) == GET_MODE_BITSIZE (mode) - 1)
|
|
|
|
|
return gen_rtx_GE (mode, XEXP (op0, 0), const0_rtx);
|
|
|
|
|
|
|
|
|
|
/* (xor (comparison foo bar) (const_int sign-bit))
|
|
|
|
|
when STORE_FLAG_VALUE is the sign bit. */
|
|
|
|
|
if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
|
|
|
|
|
&& ((STORE_FLAG_VALUE & GET_MODE_MASK (mode))
|
|
|
|
|
== (unsigned HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (mode) - 1))
|
|
|
|
|
&& trueop1 == const_true_rtx
|
|
|
|
|
&& COMPARISON_P (op0)
|
|
|
|
|
&& (reversed = reversed_comparison (op0, mode)))
|
|
|
|
|
return reversed;
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
tem = simplify_associative_operation (code, mode, op0, op1);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case AND:
|
2005-04-25 00:16:48 +02:00
|
|
|
|
if (trueop1 == CONST0_RTX (mode) && ! side_effects_p (op0))
|
|
|
|
|
return trueop1;
|
2009-04-24 18:19:36 +02:00
|
|
|
|
if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
|
2008-11-20 09:05:12 +01:00
|
|
|
|
{
|
|
|
|
|
HOST_WIDE_INT nzop0 = nonzero_bits (trueop0, mode);
|
2009-04-24 18:19:36 +02:00
|
|
|
|
HOST_WIDE_INT nzop1;
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (trueop1))
|
2009-04-24 18:19:36 +02:00
|
|
|
|
{
|
|
|
|
|
HOST_WIDE_INT val1 = INTVAL (trueop1);
|
|
|
|
|
/* If we are turning off bits already known off in OP0, we need
|
|
|
|
|
not do an AND. */
|
|
|
|
|
if ((nzop0 & ~val1) == 0)
|
|
|
|
|
return op0;
|
|
|
|
|
}
|
|
|
|
|
nzop1 = nonzero_bits (trueop1, mode);
|
2008-11-20 09:05:12 +01:00
|
|
|
|
/* If we are clearing all the nonzero bits, the result is zero. */
|
2009-04-24 18:19:36 +02:00
|
|
|
|
if ((nzop1 & nzop0) == 0
|
|
|
|
|
&& !side_effects_p (op0) && !side_effects_p (op1))
|
2008-11-20 09:05:12 +01:00
|
|
|
|
return CONST0_RTX (mode);
|
|
|
|
|
}
|
2005-09-06 19:51:48 +02:00
|
|
|
|
if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& GET_MODE_CLASS (mode) != MODE_CC)
|
|
|
|
|
return op0;
|
|
|
|
|
/* A & (~A) -> 0 */
|
|
|
|
|
if (((GET_CODE (op0) == NOT && rtx_equal_p (XEXP (op0, 0), op1))
|
|
|
|
|
|| (GET_CODE (op1) == NOT && rtx_equal_p (XEXP (op1, 0), op0)))
|
|
|
|
|
&& ! side_effects_p (op0)
|
|
|
|
|
&& GET_MODE_CLASS (mode) != MODE_CC)
|
2005-04-25 00:16:48 +02:00
|
|
|
|
return CONST0_RTX (mode);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|
|
|
|
|
/* Transform (and (extend X) C) into (zero_extend (and X C)) if
|
|
|
|
|
there are no nonzero bits of C outside of X's mode. */
|
|
|
|
|
if ((GET_CODE (op0) == SIGN_EXTEND
|
|
|
|
|
|| GET_CODE (op0) == ZERO_EXTEND)
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (trueop1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
|
|
|
|
|
&& (~GET_MODE_MASK (GET_MODE (XEXP (op0, 0)))
|
|
|
|
|
& INTVAL (trueop1)) == 0)
|
|
|
|
|
{
|
|
|
|
|
enum machine_mode imode = GET_MODE (XEXP (op0, 0));
|
|
|
|
|
tem = simplify_gen_binary (AND, imode, XEXP (op0, 0),
|
|
|
|
|
gen_int_mode (INTVAL (trueop1),
|
|
|
|
|
imode));
|
|
|
|
|
return simplify_gen_unary (ZERO_EXTEND, mode, tem, imode);
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-09 07:43:56 +02:00
|
|
|
|
/* Transform (and (truncate X) C) into (truncate (and X C)). This way
|
|
|
|
|
we might be able to further simplify the AND with X and potentially
|
|
|
|
|
remove the truncation altogether. */
|
|
|
|
|
if (GET_CODE (op0) == TRUNCATE && CONST_INT_P (trueop1))
|
|
|
|
|
{
|
|
|
|
|
rtx x = XEXP (op0, 0);
|
|
|
|
|
enum machine_mode xmode = GET_MODE (x);
|
|
|
|
|
tem = simplify_gen_binary (AND, xmode, x,
|
|
|
|
|
gen_int_mode (INTVAL (trueop1), xmode));
|
|
|
|
|
return simplify_gen_unary (TRUNCATE, mode, tem, xmode);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-19 01:54:29 +01:00
|
|
|
|
/* Canonicalize (A | C1) & C2 as (A & C2) | (C1 & C2). */
|
|
|
|
|
if (GET_CODE (op0) == IOR
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (trueop1)
|
|
|
|
|
&& CONST_INT_P (XEXP (op0, 1)))
|
2007-02-19 01:54:29 +01:00
|
|
|
|
{
|
|
|
|
|
HOST_WIDE_INT tmp = INTVAL (trueop1) & INTVAL (XEXP (op0, 1));
|
|
|
|
|
return simplify_gen_binary (IOR, mode,
|
|
|
|
|
simplify_gen_binary (AND, mode,
|
|
|
|
|
XEXP (op0, 0), op1),
|
|
|
|
|
gen_int_mode (tmp, mode));
|
|
|
|
|
}
|
|
|
|
|
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
/* Convert (A ^ B) & A to A & (~B) since the latter is often a single
|
|
|
|
|
insn (and may simplify more). */
|
|
|
|
|
if (GET_CODE (op0) == XOR
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 0), op1)
|
|
|
|
|
&& ! side_effects_p (op1))
|
|
|
|
|
return simplify_gen_binary (AND, mode,
|
|
|
|
|
simplify_gen_unary (NOT, mode,
|
|
|
|
|
XEXP (op0, 1), mode),
|
|
|
|
|
op1);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (op0) == XOR
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 1), op1)
|
|
|
|
|
&& ! side_effects_p (op1))
|
|
|
|
|
return simplify_gen_binary (AND, mode,
|
|
|
|
|
simplify_gen_unary (NOT, mode,
|
|
|
|
|
XEXP (op0, 0), mode),
|
|
|
|
|
op1);
|
|
|
|
|
|
|
|
|
|
/* Similarly for (~(A ^ B)) & A. */
|
|
|
|
|
if (GET_CODE (op0) == NOT
|
|
|
|
|
&& GET_CODE (XEXP (op0, 0)) == XOR
|
|
|
|
|
&& rtx_equal_p (XEXP (XEXP (op0, 0), 0), op1)
|
|
|
|
|
&& ! side_effects_p (op1))
|
|
|
|
|
return simplify_gen_binary (AND, mode, XEXP (XEXP (op0, 0), 1), op1);
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (op0) == NOT
|
|
|
|
|
&& GET_CODE (XEXP (op0, 0)) == XOR
|
|
|
|
|
&& rtx_equal_p (XEXP (XEXP (op0, 0), 1), op1)
|
|
|
|
|
&& ! side_effects_p (op1))
|
|
|
|
|
return simplify_gen_binary (AND, mode, XEXP (XEXP (op0, 0), 0), op1);
|
|
|
|
|
|
|
|
|
|
/* Convert (A | B) & A to A. */
|
|
|
|
|
if (GET_CODE (op0) == IOR
|
|
|
|
|
&& (rtx_equal_p (XEXP (op0, 0), op1)
|
|
|
|
|
|| rtx_equal_p (XEXP (op0, 1), op1))
|
|
|
|
|
&& ! side_effects_p (XEXP (op0, 0))
|
|
|
|
|
&& ! side_effects_p (XEXP (op0, 1)))
|
|
|
|
|
return op1;
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* For constants M and N, if M == (1LL << cst) - 1 && (N & M) == M,
|
|
|
|
|
((A & N) + B) & M -> (A + B) & M
|
|
|
|
|
Similarly if (N & M) == 0,
|
|
|
|
|
((A | N) + B) & M -> (A + B) & M
|
2008-11-20 09:05:12 +01:00
|
|
|
|
and for - instead of + and/or ^ instead of |.
|
|
|
|
|
Also, if (N & M) == 0, then
|
|
|
|
|
(A +- N) & M -> A & M. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (trueop1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
|
|
|
|
|
&& ~INTVAL (trueop1)
|
|
|
|
|
&& (INTVAL (trueop1) & (INTVAL (trueop1) + 1)) == 0
|
|
|
|
|
&& (GET_CODE (op0) == PLUS || GET_CODE (op0) == MINUS))
|
|
|
|
|
{
|
|
|
|
|
rtx pmop[2];
|
|
|
|
|
int which;
|
|
|
|
|
|
|
|
|
|
pmop[0] = XEXP (op0, 0);
|
|
|
|
|
pmop[1] = XEXP (op0, 1);
|
|
|
|
|
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (pmop[1])
|
2008-11-20 09:05:12 +01:00
|
|
|
|
&& (INTVAL (pmop[1]) & INTVAL (trueop1)) == 0)
|
|
|
|
|
return simplify_gen_binary (AND, mode, pmop[0], op1);
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
for (which = 0; which < 2; which++)
|
|
|
|
|
{
|
|
|
|
|
tem = pmop[which];
|
|
|
|
|
switch (GET_CODE (tem))
|
2004-06-14 19:45:08 +02:00
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case AND:
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (XEXP (tem, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& (INTVAL (XEXP (tem, 1)) & INTVAL (trueop1))
|
|
|
|
|
== INTVAL (trueop1))
|
|
|
|
|
pmop[which] = XEXP (tem, 0);
|
2004-06-14 19:45:08 +02:00
|
|
|
|
break;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case IOR:
|
|
|
|
|
case XOR:
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (XEXP (tem, 1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& (INTVAL (XEXP (tem, 1)) & INTVAL (trueop1)) == 0)
|
|
|
|
|
pmop[which] = XEXP (tem, 0);
|
2004-06-14 19:45:08 +02:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (pmop[0] != XEXP (op0, 0) || pmop[1] != XEXP (op0, 1))
|
|
|
|
|
{
|
|
|
|
|
tem = simplify_gen_binary (GET_CODE (op0), mode,
|
|
|
|
|
pmop[0], pmop[1]);
|
|
|
|
|
return simplify_gen_binary (code, mode, tem, op1);
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-02-23 18:58:48 +01:00
|
|
|
|
|
|
|
|
|
/* (and X (ior (not X) Y) -> (and X Y) */
|
|
|
|
|
if (GET_CODE (op1) == IOR
|
|
|
|
|
&& GET_CODE (XEXP (op1, 0)) == NOT
|
|
|
|
|
&& op0 == XEXP (XEXP (op1, 0), 0))
|
|
|
|
|
return simplify_gen_binary (AND, mode, op0, XEXP (op1, 1));
|
|
|
|
|
|
|
|
|
|
/* (and (ior (not X) Y) X) -> (and X Y) */
|
|
|
|
|
if (GET_CODE (op0) == IOR
|
|
|
|
|
&& GET_CODE (XEXP (op0, 0)) == NOT
|
|
|
|
|
&& op1 == XEXP (XEXP (op0, 0), 0))
|
|
|
|
|
return simplify_gen_binary (AND, mode, op1, XEXP (op0, 1));
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
tem = simplify_associative_operation (code, mode, op0, op1);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
|
|
|
|
break;
|
2005-02-03 07:44:35 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case UDIV:
|
|
|
|
|
/* 0/x is 0 (or x&0 if x has side-effects). */
|
2005-04-25 00:16:48 +02:00
|
|
|
|
if (trueop0 == CONST0_RTX (mode))
|
|
|
|
|
{
|
|
|
|
|
if (side_effects_p (op1))
|
|
|
|
|
return simplify_gen_binary (AND, mode, op1, trueop0);
|
|
|
|
|
return trueop0;
|
|
|
|
|
}
|
|
|
|
|
/* x/1 is x. */
|
|
|
|
|
if (trueop1 == CONST1_RTX (mode))
|
|
|
|
|
return rtl_hooks.gen_lowpart_no_emit (mode, op0);
|
|
|
|
|
/* Convert divide by power of two into shift. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (trueop1)
|
2005-04-25 00:16:48 +02:00
|
|
|
|
&& (val = exact_log2 (INTVAL (trueop1))) > 0)
|
|
|
|
|
return simplify_gen_binary (LSHIFTRT, mode, op0, GEN_INT (val));
|
|
|
|
|
break;
|
2005-01-21 18:54:26 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case DIV:
|
|
|
|
|
/* Handle floating point and integers separately. */
|
2005-11-21 21:53:27 +01:00
|
|
|
|
if (SCALAR_FLOAT_MODE_P (mode))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
{
|
|
|
|
|
/* Maybe change 0.0 / x to 0.0. This transformation isn't
|
|
|
|
|
safe for modes with NaNs, since 0.0 / 0.0 will then be
|
|
|
|
|
NaN rather than 0.0. Nor is it safe for modes with signed
|
|
|
|
|
zeros, since dividing 0 by a negative number gives -0.0 */
|
|
|
|
|
if (trueop0 == CONST0_RTX (mode)
|
|
|
|
|
&& !HONOR_NANS (mode)
|
|
|
|
|
&& !HONOR_SIGNED_ZEROS (mode)
|
|
|
|
|
&& ! side_effects_p (op1))
|
|
|
|
|
return op0;
|
|
|
|
|
/* x/1.0 is x. */
|
|
|
|
|
if (trueop1 == CONST1_RTX (mode)
|
|
|
|
|
&& !HONOR_SNANS (mode))
|
|
|
|
|
return op0;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (GET_CODE (trueop1) == CONST_DOUBLE
|
|
|
|
|
&& trueop1 != CONST0_RTX (mode))
|
|
|
|
|
{
|
|
|
|
|
REAL_VALUE_TYPE d;
|
|
|
|
|
REAL_VALUE_FROM_CONST_DOUBLE (d, trueop1);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* x/-1.0 is -x. */
|
|
|
|
|
if (REAL_VALUES_EQUAL (d, dconstm1)
|
|
|
|
|
&& !HONOR_SNANS (mode))
|
|
|
|
|
return simplify_gen_unary (NEG, mode, op0, mode);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* Change FP division by a constant into multiplication.
|
2007-09-04 14:11:11 +02:00
|
|
|
|
Only do this with -freciprocal-math. */
|
|
|
|
|
if (flag_reciprocal_math
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& !REAL_VALUES_EQUAL (d, dconst0))
|
|
|
|
|
{
|
|
|
|
|
REAL_ARITHMETIC (d, RDIV_EXPR, dconst1, d);
|
|
|
|
|
tem = CONST_DOUBLE_FROM_REAL_VALUE (d, mode);
|
|
|
|
|
return simplify_gen_binary (MULT, mode, op0, tem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* 0/x is 0 (or x&0 if x has side-effects). */
|
2005-04-25 00:16:48 +02:00
|
|
|
|
if (trueop0 == CONST0_RTX (mode))
|
|
|
|
|
{
|
|
|
|
|
if (side_effects_p (op1))
|
|
|
|
|
return simplify_gen_binary (AND, mode, op1, trueop0);
|
|
|
|
|
return trueop0;
|
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* x/1 is x. */
|
2005-04-25 00:16:48 +02:00
|
|
|
|
if (trueop1 == CONST1_RTX (mode))
|
2005-03-21 15:30:51 +01:00
|
|
|
|
return rtl_hooks.gen_lowpart_no_emit (mode, op0);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* x/-1 is -x. */
|
|
|
|
|
if (trueop1 == constm1_rtx)
|
|
|
|
|
{
|
2005-03-21 15:30:51 +01:00
|
|
|
|
rtx x = rtl_hooks.gen_lowpart_no_emit (mode, op0);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return simplify_gen_unary (NEG, mode, x, mode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case UMOD:
|
|
|
|
|
/* 0%x is 0 (or x&0 if x has side-effects). */
|
2005-04-25 00:16:48 +02:00
|
|
|
|
if (trueop0 == CONST0_RTX (mode))
|
|
|
|
|
{
|
|
|
|
|
if (side_effects_p (op1))
|
|
|
|
|
return simplify_gen_binary (AND, mode, op1, trueop0);
|
|
|
|
|
return trueop0;
|
|
|
|
|
}
|
|
|
|
|
/* x%1 is 0 (of x&0 if x has side-effects). */
|
|
|
|
|
if (trueop1 == CONST1_RTX (mode))
|
|
|
|
|
{
|
|
|
|
|
if (side_effects_p (op0))
|
|
|
|
|
return simplify_gen_binary (AND, mode, op0, CONST0_RTX (mode));
|
|
|
|
|
return CONST0_RTX (mode);
|
|
|
|
|
}
|
|
|
|
|
/* Implement modulus by power of two as AND. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (trueop1)
|
2005-04-25 00:16:48 +02:00
|
|
|
|
&& exact_log2 (INTVAL (trueop1)) > 0)
|
|
|
|
|
return simplify_gen_binary (AND, mode, op0,
|
|
|
|
|
GEN_INT (INTVAL (op1) - 1));
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case MOD:
|
|
|
|
|
/* 0%x is 0 (or x&0 if x has side-effects). */
|
2005-04-25 00:16:48 +02:00
|
|
|
|
if (trueop0 == CONST0_RTX (mode))
|
|
|
|
|
{
|
|
|
|
|
if (side_effects_p (op1))
|
|
|
|
|
return simplify_gen_binary (AND, mode, op1, trueop0);
|
|
|
|
|
return trueop0;
|
|
|
|
|
}
|
|
|
|
|
/* x%1 and x%-1 is 0 (or x&0 if x has side-effects). */
|
|
|
|
|
if (trueop1 == CONST1_RTX (mode) || trueop1 == constm1_rtx)
|
|
|
|
|
{
|
|
|
|
|
if (side_effects_p (op0))
|
|
|
|
|
return simplify_gen_binary (AND, mode, op0, CONST0_RTX (mode));
|
|
|
|
|
return CONST0_RTX (mode);
|
|
|
|
|
}
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case ROTATERT:
|
|
|
|
|
case ROTATE:
|
|
|
|
|
case ASHIFTRT:
|
2006-05-30 17:32:52 +02:00
|
|
|
|
if (trueop1 == CONST0_RTX (mode))
|
|
|
|
|
return op0;
|
|
|
|
|
if (trueop0 == CONST0_RTX (mode) && ! side_effects_p (op1))
|
|
|
|
|
return op0;
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* Rotating ~0 always results in ~0. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (trueop0) && width <= HOST_BITS_PER_WIDE_INT
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& (unsigned HOST_WIDE_INT) INTVAL (trueop0) == GET_MODE_MASK (mode)
|
|
|
|
|
&& ! side_effects_p (op1))
|
|
|
|
|
return op0;
|
2007-10-07 20:40:02 +02:00
|
|
|
|
canonicalize_shift:
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (SHIFT_COUNT_TRUNCATED && CONST_INT_P (op1))
|
2007-10-07 20:40:02 +02:00
|
|
|
|
{
|
|
|
|
|
val = INTVAL (op1) & (GET_MODE_BITSIZE (mode) - 1);
|
|
|
|
|
if (val != INTVAL (op1))
|
|
|
|
|
return simplify_gen_binary (code, mode, op0, GEN_INT (val));
|
|
|
|
|
}
|
2006-05-30 17:32:52 +02:00
|
|
|
|
break;
|
2004-04-05 05:14:13 +02:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case ASHIFT:
|
2006-04-24 21:35:38 +02:00
|
|
|
|
case SS_ASHIFT:
|
c-lex.c (interpret_fixed): Declare.
* c-lex.c (interpret_fixed): Declare.
(interpret_float): Process _Fract and _Accum.
(interpret_fixed): New function.
* final.c (output_addr_const): Process CONST_FIXED.
* simplify-rtx.c (simplify_const_unary_operation): Handle US_NEG.
(simplify_binary_operation_1): Handle US_ASHIFT, SS_MULT, US_MULT,
SS_DIV, US_DIV.
(simplify_const_binary_operation): Handle SS_MULT, US_MULT, SS_DIV,
US_DIV, US_ASHIFT.
(simplify_immed_subreg): Support CONST_FIXED.
Process MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.
(simplify_subreg): Support CONST_FIXED.
From-SVN: r127941
2007-08-31 01:09:28 +02:00
|
|
|
|
case US_ASHIFT:
|
2006-05-30 17:32:52 +02:00
|
|
|
|
if (trueop1 == CONST0_RTX (mode))
|
|
|
|
|
return op0;
|
|
|
|
|
if (trueop0 == CONST0_RTX (mode) && ! side_effects_p (op1))
|
|
|
|
|
return op0;
|
2007-10-07 20:40:02 +02:00
|
|
|
|
goto canonicalize_shift;
|
2006-05-30 17:32:52 +02:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case LSHIFTRT:
|
2005-04-25 00:16:48 +02:00
|
|
|
|
if (trueop1 == CONST0_RTX (mode))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return op0;
|
2005-04-25 00:16:48 +02:00
|
|
|
|
if (trueop0 == CONST0_RTX (mode) && ! side_effects_p (op1))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return op0;
|
2006-05-30 17:32:52 +02:00
|
|
|
|
/* Optimize (lshiftrt (clz X) C) as (eq X 0). */
|
|
|
|
|
if (GET_CODE (op0) == CLZ
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (trueop1)
|
2006-05-30 17:32:52 +02:00
|
|
|
|
&& STORE_FLAG_VALUE == 1
|
2006-05-30 23:54:17 +02:00
|
|
|
|
&& INTVAL (trueop1) < (HOST_WIDE_INT)width)
|
2006-05-30 17:32:52 +02:00
|
|
|
|
{
|
|
|
|
|
enum machine_mode imode = GET_MODE (XEXP (op0, 0));
|
|
|
|
|
unsigned HOST_WIDE_INT zero_val = 0;
|
|
|
|
|
|
|
|
|
|
if (CLZ_DEFINED_VALUE_AT_ZERO (imode, zero_val)
|
|
|
|
|
&& zero_val == GET_MODE_BITSIZE (imode)
|
|
|
|
|
&& INTVAL (trueop1) == exact_log2 (zero_val))
|
|
|
|
|
return simplify_gen_relational (EQ, mode, imode,
|
|
|
|
|
XEXP (op0, 0), const0_rtx);
|
|
|
|
|
}
|
2007-10-07 20:40:02 +02:00
|
|
|
|
goto canonicalize_shift;
|
2004-04-05 05:14:13 +02:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case SMIN:
|
|
|
|
|
if (width <= HOST_BITS_PER_WIDE_INT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (trueop1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& INTVAL (trueop1) == (HOST_WIDE_INT) 1 << (width -1)
|
|
|
|
|
&& ! side_effects_p (op0))
|
|
|
|
|
return op1;
|
|
|
|
|
if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0))
|
|
|
|
|
return op0;
|
|
|
|
|
tem = simplify_associative_operation (code, mode, op0, op1);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case SMAX:
|
|
|
|
|
if (width <= HOST_BITS_PER_WIDE_INT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (trueop1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& ((unsigned HOST_WIDE_INT) INTVAL (trueop1)
|
|
|
|
|
== (unsigned HOST_WIDE_INT) GET_MODE_MASK (mode) >> 1)
|
|
|
|
|
&& ! side_effects_p (op0))
|
|
|
|
|
return op1;
|
|
|
|
|
if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0))
|
|
|
|
|
return op0;
|
|
|
|
|
tem = simplify_associative_operation (code, mode, op0, op1);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case UMIN:
|
2005-04-25 00:16:48 +02:00
|
|
|
|
if (trueop1 == CONST0_RTX (mode) && ! side_effects_p (op0))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return op1;
|
|
|
|
|
if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0))
|
|
|
|
|
return op0;
|
|
|
|
|
tem = simplify_associative_operation (code, mode, op0, op1);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case UMAX:
|
|
|
|
|
if (trueop1 == constm1_rtx && ! side_effects_p (op0))
|
|
|
|
|
return op1;
|
|
|
|
|
if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0))
|
|
|
|
|
return op0;
|
|
|
|
|
tem = simplify_associative_operation (code, mode, op0, op1);
|
|
|
|
|
if (tem)
|
|
|
|
|
return tem;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case SS_PLUS:
|
|
|
|
|
case US_PLUS:
|
|
|
|
|
case SS_MINUS:
|
|
|
|
|
case US_MINUS:
|
c-lex.c (interpret_fixed): Declare.
* c-lex.c (interpret_fixed): Declare.
(interpret_float): Process _Fract and _Accum.
(interpret_fixed): New function.
* final.c (output_addr_const): Process CONST_FIXED.
* simplify-rtx.c (simplify_const_unary_operation): Handle US_NEG.
(simplify_binary_operation_1): Handle US_ASHIFT, SS_MULT, US_MULT,
SS_DIV, US_DIV.
(simplify_const_binary_operation): Handle SS_MULT, US_MULT, SS_DIV,
US_DIV, US_ASHIFT.
(simplify_immed_subreg): Support CONST_FIXED.
Process MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.
(simplify_subreg): Support CONST_FIXED.
From-SVN: r127941
2007-08-31 01:09:28 +02:00
|
|
|
|
case SS_MULT:
|
|
|
|
|
case US_MULT:
|
|
|
|
|
case SS_DIV:
|
|
|
|
|
case US_DIV:
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* ??? There are simplifications that can be done. */
|
|
|
|
|
return 0;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case VEC_SELECT:
|
|
|
|
|
if (!VECTOR_MODE_P (mode))
|
|
|
|
|
{
|
|
|
|
|
gcc_assert (VECTOR_MODE_P (GET_MODE (trueop0)));
|
|
|
|
|
gcc_assert (mode == GET_MODE_INNER (GET_MODE (trueop0)));
|
|
|
|
|
gcc_assert (GET_CODE (trueop1) == PARALLEL);
|
|
|
|
|
gcc_assert (XVECLEN (trueop1, 0) == 1);
|
2009-06-22 12:29:13 +02:00
|
|
|
|
gcc_assert (CONST_INT_P (XVECEXP (trueop1, 0, 0)));
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|
|
|
|
|
if (GET_CODE (trueop0) == CONST_VECTOR)
|
|
|
|
|
return CONST_VECTOR_ELT (trueop0, INTVAL (XVECEXP
|
|
|
|
|
(trueop1, 0, 0)));
|
2007-08-28 11:52:06 +02:00
|
|
|
|
|
|
|
|
|
/* Extract a scalar element from a nested VEC_SELECT expression
|
|
|
|
|
(with optional nested VEC_CONCAT expression). Some targets
|
|
|
|
|
(i386) extract scalar element from a vector using chain of
|
|
|
|
|
nested VEC_SELECT expressions. When input operand is a memory
|
|
|
|
|
operand, this operation can be simplified to a simple scalar
|
|
|
|
|
load from an offseted memory address. */
|
|
|
|
|
if (GET_CODE (trueop0) == VEC_SELECT)
|
|
|
|
|
{
|
|
|
|
|
rtx op0 = XEXP (trueop0, 0);
|
|
|
|
|
rtx op1 = XEXP (trueop0, 1);
|
|
|
|
|
|
|
|
|
|
enum machine_mode opmode = GET_MODE (op0);
|
|
|
|
|
int elt_size = GET_MODE_SIZE (GET_MODE_INNER (opmode));
|
|
|
|
|
int n_elts = GET_MODE_SIZE (opmode) / elt_size;
|
|
|
|
|
|
|
|
|
|
int i = INTVAL (XVECEXP (trueop1, 0, 0));
|
|
|
|
|
int elem;
|
|
|
|
|
|
|
|
|
|
rtvec vec;
|
|
|
|
|
rtx tmp_op, tmp;
|
|
|
|
|
|
|
|
|
|
gcc_assert (GET_CODE (op1) == PARALLEL);
|
|
|
|
|
gcc_assert (i < n_elts);
|
|
|
|
|
|
|
|
|
|
/* Select element, pointed by nested selector. */
|
2007-08-29 17:00:38 +02:00
|
|
|
|
elem = INTVAL (XVECEXP (op1, 0, i));
|
2007-08-28 11:52:06 +02:00
|
|
|
|
|
|
|
|
|
/* Handle the case when nested VEC_SELECT wraps VEC_CONCAT. */
|
|
|
|
|
if (GET_CODE (op0) == VEC_CONCAT)
|
|
|
|
|
{
|
|
|
|
|
rtx op00 = XEXP (op0, 0);
|
|
|
|
|
rtx op01 = XEXP (op0, 1);
|
|
|
|
|
|
|
|
|
|
enum machine_mode mode00, mode01;
|
|
|
|
|
int n_elts00, n_elts01;
|
|
|
|
|
|
|
|
|
|
mode00 = GET_MODE (op00);
|
|
|
|
|
mode01 = GET_MODE (op01);
|
|
|
|
|
|
|
|
|
|
/* Find out number of elements of each operand. */
|
|
|
|
|
if (VECTOR_MODE_P (mode00))
|
|
|
|
|
{
|
|
|
|
|
elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode00));
|
|
|
|
|
n_elts00 = GET_MODE_SIZE (mode00) / elt_size;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
n_elts00 = 1;
|
|
|
|
|
|
|
|
|
|
if (VECTOR_MODE_P (mode01))
|
|
|
|
|
{
|
|
|
|
|
elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode01));
|
|
|
|
|
n_elts01 = GET_MODE_SIZE (mode01) / elt_size;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
n_elts01 = 1;
|
|
|
|
|
|
|
|
|
|
gcc_assert (n_elts == n_elts00 + n_elts01);
|
|
|
|
|
|
|
|
|
|
/* Select correct operand of VEC_CONCAT
|
|
|
|
|
and adjust selector. */
|
|
|
|
|
if (elem < n_elts01)
|
|
|
|
|
tmp_op = op00;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tmp_op = op01;
|
|
|
|
|
elem -= n_elts00;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
tmp_op = op0;
|
|
|
|
|
|
|
|
|
|
vec = rtvec_alloc (1);
|
|
|
|
|
RTVEC_ELT (vec, 0) = GEN_INT (elem);
|
|
|
|
|
|
|
|
|
|
tmp = gen_rtx_fmt_ee (code, mode,
|
|
|
|
|
tmp_op, gen_rtx_PARALLEL (VOIDmode, vec));
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gcc_assert (VECTOR_MODE_P (GET_MODE (trueop0)));
|
|
|
|
|
gcc_assert (GET_MODE_INNER (mode)
|
|
|
|
|
== GET_MODE_INNER (GET_MODE (trueop0)));
|
|
|
|
|
gcc_assert (GET_CODE (trueop1) == PARALLEL);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (GET_CODE (trueop0) == CONST_VECTOR)
|
|
|
|
|
{
|
|
|
|
|
int elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode));
|
|
|
|
|
unsigned n_elts = (GET_MODE_SIZE (mode) / elt_size);
|
|
|
|
|
rtvec v = rtvec_alloc (n_elts);
|
|
|
|
|
unsigned int i;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
gcc_assert (XVECLEN (trueop1, 0) == (int) n_elts);
|
|
|
|
|
for (i = 0; i < n_elts; i++)
|
|
|
|
|
{
|
|
|
|
|
rtx x = XVECEXP (trueop1, 0, i);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2009-06-22 12:29:13 +02:00
|
|
|
|
gcc_assert (CONST_INT_P (x));
|
2005-02-28 16:29:43 +01:00
|
|
|
|
RTVEC_ELT (v, i) = CONST_VECTOR_ELT (trueop0,
|
|
|
|
|
INTVAL (x));
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return gen_rtx_CONST_VECTOR (mode, v);
|
2003-08-17 21:24:09 +02:00
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
}
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
|
|
|
|
|
if (XVECLEN (trueop1, 0) == 1
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XVECEXP (trueop1, 0, 0))
|
combine.c (combine_simplify_rtx <case NOT, [...]): Move simplifications that do not require additional infrastructure...
2005-12-16 Paolo Bonzini <bonzini@gnu.org>
* combine.c (combine_simplify_rtx <case NOT, NEG, TRUNCATE,
FLOAT_TRUNCATE, FLOAT_EXTEND, PLUS, MINUS, AND, IOR, XOR,
ABS, VEC_SELECT, POPCOUNT, PARITY, FFS, FLOAT>,
simplify_logical): Move simplifications that do not require
additional infrastructure...
* simplify-rtx.c (simplify_unary_operation_1,
simplify_binary_operation_1): ... here.
From-SVN: r108634
2005-12-16 10:24:19 +01:00
|
|
|
|
&& GET_CODE (trueop0) == VEC_CONCAT)
|
|
|
|
|
{
|
|
|
|
|
rtx vec = trueop0;
|
|
|
|
|
int offset = INTVAL (XVECEXP (trueop1, 0, 0)) * GET_MODE_SIZE (mode);
|
|
|
|
|
|
|
|
|
|
/* Try to find the element in the VEC_CONCAT. */
|
|
|
|
|
while (GET_MODE (vec) != mode
|
|
|
|
|
&& GET_CODE (vec) == VEC_CONCAT)
|
|
|
|
|
{
|
|
|
|
|
HOST_WIDE_INT vec_size = GET_MODE_SIZE (GET_MODE (XEXP (vec, 0)));
|
|
|
|
|
if (offset < vec_size)
|
|
|
|
|
vec = XEXP (vec, 0);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
offset -= vec_size;
|
|
|
|
|
vec = XEXP (vec, 1);
|
|
|
|
|
}
|
|
|
|
|
vec = avoid_constant_pool_reference (vec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GET_MODE (vec) == mode)
|
|
|
|
|
return vec;
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return 0;
|
|
|
|
|
case VEC_CONCAT:
|
|
|
|
|
{
|
|
|
|
|
enum machine_mode op0_mode = (GET_MODE (trueop0) != VOIDmode
|
|
|
|
|
? GET_MODE (trueop0)
|
|
|
|
|
: GET_MODE_INNER (mode));
|
|
|
|
|
enum machine_mode op1_mode = (GET_MODE (trueop1) != VOIDmode
|
|
|
|
|
? GET_MODE (trueop1)
|
|
|
|
|
: GET_MODE_INNER (mode));
|
|
|
|
|
|
|
|
|
|
gcc_assert (VECTOR_MODE_P (mode));
|
|
|
|
|
gcc_assert (GET_MODE_SIZE (op0_mode) + GET_MODE_SIZE (op1_mode)
|
|
|
|
|
== GET_MODE_SIZE (mode));
|
|
|
|
|
|
|
|
|
|
if (VECTOR_MODE_P (op0_mode))
|
|
|
|
|
gcc_assert (GET_MODE_INNER (mode)
|
|
|
|
|
== GET_MODE_INNER (op0_mode));
|
|
|
|
|
else
|
|
|
|
|
gcc_assert (GET_MODE_INNER (mode) == op0_mode);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (VECTOR_MODE_P (op1_mode))
|
|
|
|
|
gcc_assert (GET_MODE_INNER (mode)
|
|
|
|
|
== GET_MODE_INNER (op1_mode));
|
|
|
|
|
else
|
|
|
|
|
gcc_assert (GET_MODE_INNER (mode) == op1_mode);
|
|
|
|
|
|
|
|
|
|
if ((GET_CODE (trueop0) == CONST_VECTOR
|
2009-06-22 12:29:13 +02:00
|
|
|
|
|| CONST_INT_P (trueop0)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|| GET_CODE (trueop0) == CONST_DOUBLE)
|
|
|
|
|
&& (GET_CODE (trueop1) == CONST_VECTOR
|
2009-06-22 12:29:13 +02:00
|
|
|
|
|| CONST_INT_P (trueop1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|| GET_CODE (trueop1) == CONST_DOUBLE))
|
|
|
|
|
{
|
|
|
|
|
int elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode));
|
|
|
|
|
unsigned n_elts = (GET_MODE_SIZE (mode) / elt_size);
|
|
|
|
|
rtvec v = rtvec_alloc (n_elts);
|
|
|
|
|
unsigned int i;
|
|
|
|
|
unsigned in_n_elts = 1;
|
2003-10-11 23:06:19 +02:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (VECTOR_MODE_P (op0_mode))
|
|
|
|
|
in_n_elts = (GET_MODE_SIZE (op0_mode) / elt_size);
|
|
|
|
|
for (i = 0; i < n_elts; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i < in_n_elts)
|
|
|
|
|
{
|
|
|
|
|
if (!VECTOR_MODE_P (op0_mode))
|
|
|
|
|
RTVEC_ELT (v, i) = trueop0;
|
|
|
|
|
else
|
|
|
|
|
RTVEC_ELT (v, i) = CONST_VECTOR_ELT (trueop0, i);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!VECTOR_MODE_P (op1_mode))
|
|
|
|
|
RTVEC_ELT (v, i) = trueop1;
|
|
|
|
|
else
|
|
|
|
|
RTVEC_ELT (v, i) = CONST_VECTOR_ELT (trueop1,
|
|
|
|
|
i - in_n_elts);
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return gen_rtx_CONST_VECTOR (mode, v);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
default:
|
|
|
|
|
gcc_unreachable ();
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
rtx
|
|
|
|
|
simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
|
|
|
|
|
rtx op0, rtx op1)
|
|
|
|
|
{
|
|
|
|
|
HOST_WIDE_INT arg0, arg1, arg0s, arg1s;
|
|
|
|
|
HOST_WIDE_INT val;
|
|
|
|
|
unsigned int width = GET_MODE_BITSIZE (mode);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (VECTOR_MODE_P (mode)
|
|
|
|
|
&& code != VEC_CONCAT
|
|
|
|
|
&& GET_CODE (op0) == CONST_VECTOR
|
|
|
|
|
&& GET_CODE (op1) == CONST_VECTOR)
|
|
|
|
|
{
|
|
|
|
|
unsigned n_elts = GET_MODE_NUNITS (mode);
|
|
|
|
|
enum machine_mode op0mode = GET_MODE (op0);
|
|
|
|
|
unsigned op0_n_elts = GET_MODE_NUNITS (op0mode);
|
|
|
|
|
enum machine_mode op1mode = GET_MODE (op1);
|
|
|
|
|
unsigned op1_n_elts = GET_MODE_NUNITS (op1mode);
|
|
|
|
|
rtvec v = rtvec_alloc (n_elts);
|
|
|
|
|
unsigned int i;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
gcc_assert (op0_n_elts == n_elts);
|
|
|
|
|
gcc_assert (op1_n_elts == n_elts);
|
|
|
|
|
for (i = 0; i < n_elts; i++)
|
|
|
|
|
{
|
|
|
|
|
rtx x = simplify_binary_operation (code, GET_MODE_INNER (mode),
|
|
|
|
|
CONST_VECTOR_ELT (op0, i),
|
|
|
|
|
CONST_VECTOR_ELT (op1, i));
|
|
|
|
|
if (!x)
|
|
|
|
|
return 0;
|
|
|
|
|
RTVEC_ELT (v, i) = x;
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return gen_rtx_CONST_VECTOR (mode, v);
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (VECTOR_MODE_P (mode)
|
|
|
|
|
&& code == VEC_CONCAT
|
2008-01-25 11:25:21 +01:00
|
|
|
|
&& (CONST_INT_P (op0)
|
|
|
|
|
|| GET_CODE (op0) == CONST_DOUBLE
|
|
|
|
|
|| GET_CODE (op0) == CONST_FIXED)
|
|
|
|
|
&& (CONST_INT_P (op1)
|
|
|
|
|
|| GET_CODE (op1) == CONST_DOUBLE
|
|
|
|
|
|| GET_CODE (op1) == CONST_FIXED))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
{
|
|
|
|
|
unsigned n_elts = GET_MODE_NUNITS (mode);
|
|
|
|
|
rtvec v = rtvec_alloc (n_elts);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
gcc_assert (n_elts >= 2);
|
|
|
|
|
if (n_elts == 2)
|
|
|
|
|
{
|
|
|
|
|
gcc_assert (GET_CODE (op0) != CONST_VECTOR);
|
|
|
|
|
gcc_assert (GET_CODE (op1) != CONST_VECTOR);
|
2003-08-17 21:24:09 +02:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
RTVEC_ELT (v, 0) = op0;
|
|
|
|
|
RTVEC_ELT (v, 1) = op1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
unsigned op0_n_elts = GET_MODE_NUNITS (GET_MODE (op0));
|
|
|
|
|
unsigned op1_n_elts = GET_MODE_NUNITS (GET_MODE (op1));
|
|
|
|
|
unsigned i;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
gcc_assert (GET_CODE (op0) == CONST_VECTOR);
|
|
|
|
|
gcc_assert (GET_CODE (op1) == CONST_VECTOR);
|
|
|
|
|
gcc_assert (op0_n_elts + op1_n_elts == n_elts);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
for (i = 0; i < op0_n_elts; ++i)
|
|
|
|
|
RTVEC_ELT (v, i) = XVECEXP (op0, 0, i);
|
|
|
|
|
for (i = 0; i < op1_n_elts; ++i)
|
|
|
|
|
RTVEC_ELT (v, op0_n_elts+i) = XVECEXP (op1, 0, i);
|
|
|
|
|
}
|
2004-04-09 23:39:14 +02:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return gen_rtx_CONST_VECTOR (mode, v);
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-11-21 21:53:27 +01:00
|
|
|
|
if (SCALAR_FLOAT_MODE_P (mode)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& GET_CODE (op0) == CONST_DOUBLE
|
|
|
|
|
&& GET_CODE (op1) == CONST_DOUBLE
|
|
|
|
|
&& mode == GET_MODE (op0) && mode == GET_MODE (op1))
|
|
|
|
|
{
|
|
|
|
|
if (code == AND
|
|
|
|
|
|| code == IOR
|
|
|
|
|
|| code == XOR)
|
|
|
|
|
{
|
|
|
|
|
long tmp0[4];
|
|
|
|
|
long tmp1[4];
|
|
|
|
|
REAL_VALUE_TYPE r;
|
|
|
|
|
int i;
|
2005-01-14 05:17:13 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
real_to_target (tmp0, CONST_DOUBLE_REAL_VALUE (op0),
|
|
|
|
|
GET_MODE (op0));
|
|
|
|
|
real_to_target (tmp1, CONST_DOUBLE_REAL_VALUE (op1),
|
|
|
|
|
GET_MODE (op1));
|
|
|
|
|
for (i = 0; i < 4; i++)
|
2005-01-14 05:17:13 +01:00
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case AND:
|
|
|
|
|
tmp0[i] &= tmp1[i];
|
|
|
|
|
break;
|
|
|
|
|
case IOR:
|
|
|
|
|
tmp0[i] |= tmp1[i];
|
|
|
|
|
break;
|
|
|
|
|
case XOR:
|
|
|
|
|
tmp0[i] ^= tmp1[i];
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
gcc_unreachable ();
|
|
|
|
|
}
|
2005-01-14 05:17:13 +01:00
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
real_from_target (&r, tmp0, mode);
|
|
|
|
|
return CONST_DOUBLE_FROM_REAL_VALUE (r, mode);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
REAL_VALUE_TYPE f0, f1, value, result;
|
|
|
|
|
bool inexact;
|
2005-01-14 05:17:13 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
REAL_VALUE_FROM_CONST_DOUBLE (f0, op0);
|
|
|
|
|
REAL_VALUE_FROM_CONST_DOUBLE (f1, op1);
|
|
|
|
|
real_convert (&f0, mode, &f0);
|
|
|
|
|
real_convert (&f1, mode, &f1);
|
2004-06-30 12:09:55 +02:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (HONOR_SNANS (mode)
|
|
|
|
|
&& (REAL_VALUE_ISNAN (f0) || REAL_VALUE_ISNAN (f1)))
|
|
|
|
|
return 0;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (code == DIV
|
|
|
|
|
&& REAL_VALUES_EQUAL (f1, dconst0)
|
|
|
|
|
&& (flag_trapping_math || ! MODE_HAS_INFINITIES (mode)))
|
|
|
|
|
return 0;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (MODE_HAS_INFINITIES (mode) && HONOR_NANS (mode)
|
|
|
|
|
&& flag_trapping_math
|
|
|
|
|
&& REAL_VALUE_ISINF (f0) && REAL_VALUE_ISINF (f1))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
int s0 = REAL_VALUE_NEGATIVE (f0);
|
|
|
|
|
int s1 = REAL_VALUE_NEGATIVE (f1);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
switch (code)
|
2004-04-12 19:28:11 +02:00
|
|
|
|
{
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case PLUS:
|
|
|
|
|
/* Inf + -Inf = NaN plus exception. */
|
|
|
|
|
if (s0 != s1)
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
|
|
|
|
case MINUS:
|
|
|
|
|
/* Inf - Inf = NaN plus exception. */
|
|
|
|
|
if (s0 == s1)
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
|
|
|
|
case DIV:
|
|
|
|
|
/* Inf / Inf = NaN plus exception. */
|
|
|
|
|
return 0;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (code == MULT && MODE_HAS_INFINITIES (mode) && HONOR_NANS (mode)
|
|
|
|
|
&& flag_trapping_math
|
|
|
|
|
&& ((REAL_VALUE_ISINF (f0) && REAL_VALUES_EQUAL (f1, dconst0))
|
|
|
|
|
|| (REAL_VALUE_ISINF (f1)
|
|
|
|
|
&& REAL_VALUES_EQUAL (f0, dconst0))))
|
|
|
|
|
/* Inf * 0 = NaN plus exception. */
|
|
|
|
|
return 0;
|
2003-02-09 23:55:35 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
inexact = real_arithmetic (&value, rtx_to_tree_code (code),
|
|
|
|
|
&f0, &f1);
|
|
|
|
|
real_convert (&result, mode, &value);
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
|
2005-11-16 18:15:23 +01:00
|
|
|
|
/* Don't constant fold this floating point operation if
|
|
|
|
|
the result has overflowed and flag_trapping_math. */
|
|
|
|
|
|
|
|
|
|
if (flag_trapping_math
|
|
|
|
|
&& MODE_HAS_INFINITIES (mode)
|
|
|
|
|
&& REAL_VALUE_ISINF (result)
|
|
|
|
|
&& !REAL_VALUE_ISINF (f0)
|
|
|
|
|
&& !REAL_VALUE_ISINF (f1))
|
|
|
|
|
/* Overflow plus exception. */
|
|
|
|
|
return 0;
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* Don't constant fold this floating point operation if the
|
|
|
|
|
result may dependent upon the run-time rounding mode and
|
|
|
|
|
flag_rounding_math is set, or if GCC's software emulation
|
|
|
|
|
is unable to accurately represent the result. */
|
2003-02-09 23:55:35 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if ((flag_rounding_math
|
real.h (struct real_format): New member has_sign_dependent_rounding.
* real.h (struct real_format): New member has_sign_dependent_rounding.
* real.c (ieee_single_format, mips_single_format, motorola_single_format,
spu_single_format, ieee_double_format, mips_double_format,
motorola_double_format, ieee_extended_motorola_format,
ieee_extended_intel_96_format, ieee_extended_intel_128_format,
ieee_extended_intel_96_round_53_format, ibm_extended_format,
mips_extended_format, ieee_quad_format, mips_quad_format,
vax_f_format, vax_d_format, vax_g_format): Initialize it.
* config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Likewise.
* defaults.h (MODE_HAS_NANS, MODE_HAS_INFINITIES,
MODE_HAS_SIGNED_ZEROS, MODE_HAS_SIGN_DEPENDENT_ROUNDING): Remove.
* config/spu/spu.h (MODE_HAS_NANS, MODE_HAS_INFINITIES,
MODE_HAS_SIGN_DEPENDENT_ROUNDING): Remove.
(ROUND_TOWARDS_ZERO): Likewise.
* real.h (REAL_MODE_FORMAT): Protect MODE against macro expansion.
(FLOAT_MODE_FORMAT): New macro.
(REAL_MODE_FORMAT_COMPOSITE_P): Remove, replace by ...
(MODE_COMPOSITE_P): ... this new macro.
(MODE_HAS_NANS, MODE_HAS_INFINITIES, MODE_HAS_SIGNED_ZEROS,
MODE_HAS_SIGN_DEPENDENT_ROUNDING): New macros.
* machmode.h (GET_MODE_INNER): Cast result to enum machine_mode.
* flags.h: Include "real.h".
* fold-const.c (const_binop): Use MODE_COMPOSITE_P instead of
REAL_MODE_FORMAT_COMPOSITE_P.
* simplify-rtx.c (simplify_const_binary_operation): Likewise.
* doc/tm.texi (Storage Layout): Remove documentation of
MODE_HAS_NANS, MODE_HAS_INFINITIES, MODE_HAS_SIGNED_ZEROS,
MODE_HAS_SIGN_DEPENDENT_ROUNDING. Update documentation of
ROUND_TOWARDS_ZERO and LARGEST_EXPONENT_IS_NORMAL to clarify
they only apply to libgcc2.a.
From-SVN: r139016
2008-08-12 15:25:22 +02:00
|
|
|
|
|| (MODE_COMPOSITE_P (mode) && !flag_unsafe_math_optimizations))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& (inexact || !real_identical (&result, &value)))
|
|
|
|
|
return NULL_RTX;
|
2003-02-09 13:35:28 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return CONST_DOUBLE_FROM_REAL_VALUE (result, mode);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* We can fold some multi-word operations. */
|
|
|
|
|
if (GET_MODE_CLASS (mode) == MODE_INT
|
|
|
|
|
&& width == HOST_BITS_PER_WIDE_INT * 2
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& (GET_CODE (op0) == CONST_DOUBLE || CONST_INT_P (op0))
|
|
|
|
|
&& (GET_CODE (op1) == CONST_DOUBLE || CONST_INT_P (op1)))
|
2005-02-28 16:29:43 +01:00
|
|
|
|
{
|
|
|
|
|
unsigned HOST_WIDE_INT l1, l2, lv, lt;
|
|
|
|
|
HOST_WIDE_INT h1, h2, hv, ht;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (GET_CODE (op0) == CONST_DOUBLE)
|
|
|
|
|
l1 = CONST_DOUBLE_LOW (op0), h1 = CONST_DOUBLE_HIGH (op0);
|
|
|
|
|
else
|
|
|
|
|
l1 = INTVAL (op0), h1 = HWI_SIGN_EXTEND (l1);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (GET_CODE (op1) == CONST_DOUBLE)
|
|
|
|
|
l2 = CONST_DOUBLE_LOW (op1), h2 = CONST_DOUBLE_HIGH (op1);
|
|
|
|
|
else
|
|
|
|
|
l2 = INTVAL (op1), h2 = HWI_SIGN_EXTEND (l2);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case MINUS:
|
|
|
|
|
/* A - B == A + (-B). */
|
|
|
|
|
neg_double (l2, h2, &lv, &hv);
|
|
|
|
|
l2 = lv, h2 = hv;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* Fall through.... */
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case PLUS:
|
|
|
|
|
add_double (l1, h1, l2, h2, &lv, &hv);
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case MULT:
|
|
|
|
|
mul_double (l1, h1, l2, h2, &lv, &hv);
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case DIV:
|
|
|
|
|
if (div_and_round_double (TRUNC_DIV_EXPR, 0, l1, h1, l2, h2,
|
|
|
|
|
&lv, &hv, <, &ht))
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case MOD:
|
|
|
|
|
if (div_and_round_double (TRUNC_DIV_EXPR, 0, l1, h1, l2, h2,
|
|
|
|
|
<, &ht, &lv, &hv))
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case UDIV:
|
|
|
|
|
if (div_and_round_double (TRUNC_DIV_EXPR, 1, l1, h1, l2, h2,
|
|
|
|
|
&lv, &hv, <, &ht))
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case UMOD:
|
|
|
|
|
if (div_and_round_double (TRUNC_DIV_EXPR, 1, l1, h1, l2, h2,
|
|
|
|
|
<, &ht, &lv, &hv))
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case AND:
|
|
|
|
|
lv = l1 & l2, hv = h1 & h2;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case IOR:
|
|
|
|
|
lv = l1 | l2, hv = h1 | h2;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case XOR:
|
|
|
|
|
lv = l1 ^ l2, hv = h1 ^ h2;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case SMIN:
|
|
|
|
|
if (h1 < h2
|
|
|
|
|
|| (h1 == h2
|
|
|
|
|
&& ((unsigned HOST_WIDE_INT) l1
|
|
|
|
|
< (unsigned HOST_WIDE_INT) l2)))
|
|
|
|
|
lv = l1, hv = h1;
|
|
|
|
|
else
|
|
|
|
|
lv = l2, hv = h2;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case SMAX:
|
|
|
|
|
if (h1 > h2
|
|
|
|
|
|| (h1 == h2
|
|
|
|
|
&& ((unsigned HOST_WIDE_INT) l1
|
|
|
|
|
> (unsigned HOST_WIDE_INT) l2)))
|
|
|
|
|
lv = l1, hv = h1;
|
|
|
|
|
else
|
|
|
|
|
lv = l2, hv = h2;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case UMIN:
|
|
|
|
|
if ((unsigned HOST_WIDE_INT) h1 < (unsigned HOST_WIDE_INT) h2
|
|
|
|
|
|| (h1 == h2
|
|
|
|
|
&& ((unsigned HOST_WIDE_INT) l1
|
|
|
|
|
< (unsigned HOST_WIDE_INT) l2)))
|
|
|
|
|
lv = l1, hv = h1;
|
|
|
|
|
else
|
|
|
|
|
lv = l2, hv = h2;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case UMAX:
|
|
|
|
|
if ((unsigned HOST_WIDE_INT) h1 > (unsigned HOST_WIDE_INT) h2
|
|
|
|
|
|| (h1 == h2
|
|
|
|
|
&& ((unsigned HOST_WIDE_INT) l1
|
|
|
|
|
> (unsigned HOST_WIDE_INT) l2)))
|
|
|
|
|
lv = l1, hv = h1;
|
|
|
|
|
else
|
|
|
|
|
lv = l2, hv = h2;
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
case LSHIFTRT: case ASHIFTRT:
|
|
|
|
|
case ASHIFT:
|
|
|
|
|
case ROTATE: case ROTATERT:
|
|
|
|
|
if (SHIFT_COUNT_TRUNCATED)
|
|
|
|
|
l2 &= (GET_MODE_BITSIZE (mode) - 1), h2 = 0;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (h2 != 0 || l2 >= GET_MODE_BITSIZE (mode))
|
|
|
|
|
return 0;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (code == LSHIFTRT || code == ASHIFTRT)
|
|
|
|
|
rshift_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv,
|
|
|
|
|
code == ASHIFTRT);
|
|
|
|
|
else if (code == ASHIFT)
|
|
|
|
|
lshift_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv, 1);
|
|
|
|
|
else if (code == ROTATE)
|
|
|
|
|
lrotate_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv);
|
|
|
|
|
else /* code == ROTATERT */
|
|
|
|
|
rrotate_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv);
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
default:
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return immed_double_const (lv, hv, mode);
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op0) && CONST_INT_P (op1)
|
2005-02-28 16:29:43 +01:00
|
|
|
|
&& width <= HOST_BITS_PER_WIDE_INT && width != 0)
|
|
|
|
|
{
|
|
|
|
|
/* Get the integer argument values in two forms:
|
|
|
|
|
zero-extended in ARG0, ARG1 and sign-extended in ARG0S, ARG1S. */
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
arg0 = INTVAL (op0);
|
|
|
|
|
arg1 = INTVAL (op1);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
if (width < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
|
|
|
|
arg0 &= ((HOST_WIDE_INT) 1 << width) - 1;
|
|
|
|
|
arg1 &= ((HOST_WIDE_INT) 1 << width) - 1;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
arg0s = arg0;
|
|
|
|
|
if (arg0s & ((HOST_WIDE_INT) 1 << (width - 1)))
|
|
|
|
|
arg0s |= ((HOST_WIDE_INT) (-1) << width);
|
2003-03-16 23:55:14 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
arg1s = arg1;
|
|
|
|
|
if (arg1s & ((HOST_WIDE_INT) 1 << (width - 1)))
|
|
|
|
|
arg1s |= ((HOST_WIDE_INT) (-1) << width);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
arg0s = arg0;
|
|
|
|
|
arg1s = arg1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compute the value of the arithmetic. */
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case PLUS:
|
|
|
|
|
val = arg0s + arg1s;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MINUS:
|
|
|
|
|
val = arg0s - arg1s;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MULT:
|
|
|
|
|
val = arg0s * arg1s;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DIV:
|
|
|
|
|
if (arg1s == 0
|
|
|
|
|
|| (arg0s == (HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT - 1)
|
|
|
|
|
&& arg1s == -1))
|
|
|
|
|
return 0;
|
|
|
|
|
val = arg0s / arg1s;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MOD:
|
|
|
|
|
if (arg1s == 0
|
|
|
|
|
|| (arg0s == (HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT - 1)
|
|
|
|
|
&& arg1s == -1))
|
|
|
|
|
return 0;
|
|
|
|
|
val = arg0s % arg1s;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case UDIV:
|
|
|
|
|
if (arg1 == 0
|
|
|
|
|
|| (arg0s == (HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT - 1)
|
|
|
|
|
&& arg1s == -1))
|
|
|
|
|
return 0;
|
|
|
|
|
val = (unsigned HOST_WIDE_INT) arg0 / arg1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case UMOD:
|
|
|
|
|
if (arg1 == 0
|
|
|
|
|
|| (arg0s == (HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT - 1)
|
|
|
|
|
&& arg1s == -1))
|
|
|
|
|
return 0;
|
|
|
|
|
val = (unsigned HOST_WIDE_INT) arg0 % arg1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case AND:
|
|
|
|
|
val = arg0 & arg1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IOR:
|
|
|
|
|
val = arg0 | arg1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XOR:
|
|
|
|
|
val = arg0 ^ arg1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LSHIFTRT:
|
|
|
|
|
case ASHIFT:
|
|
|
|
|
case ASHIFTRT:
|
|
|
|
|
/* Truncate the shift if SHIFT_COUNT_TRUNCATED, otherwise make sure
|
|
|
|
|
the value is in range. We can't return any old value for
|
|
|
|
|
out-of-range arguments because either the middle-end (via
|
|
|
|
|
shift_truncation_mask) or the back-end might be relying on
|
|
|
|
|
target-specific knowledge. Nor can we rely on
|
|
|
|
|
shift_truncation_mask, since the shift might not be part of an
|
|
|
|
|
ashlM3, lshrM3 or ashrM3 instruction. */
|
|
|
|
|
if (SHIFT_COUNT_TRUNCATED)
|
|
|
|
|
arg1 = (unsigned HOST_WIDE_INT) arg1 % width;
|
|
|
|
|
else if (arg1 < 0 || arg1 >= GET_MODE_BITSIZE (mode))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
val = (code == ASHIFT
|
|
|
|
|
? ((unsigned HOST_WIDE_INT) arg0) << arg1
|
|
|
|
|
: ((unsigned HOST_WIDE_INT) arg0) >> arg1);
|
|
|
|
|
|
|
|
|
|
/* Sign-extend the result for arithmetic right shifts. */
|
|
|
|
|
if (code == ASHIFTRT && arg0s < 0 && arg1 > 0)
|
|
|
|
|
val |= ((HOST_WIDE_INT) -1) << (width - arg1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ROTATERT:
|
|
|
|
|
if (arg1 < 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
arg1 %= width;
|
|
|
|
|
val = ((((unsigned HOST_WIDE_INT) arg0) << (width - arg1))
|
|
|
|
|
| (((unsigned HOST_WIDE_INT) arg0) >> arg1));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ROTATE:
|
|
|
|
|
if (arg1 < 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
arg1 %= width;
|
|
|
|
|
val = ((((unsigned HOST_WIDE_INT) arg0) << arg1)
|
|
|
|
|
| (((unsigned HOST_WIDE_INT) arg0) >> (width - arg1)));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case COMPARE:
|
|
|
|
|
/* Do nothing here. */
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case SMIN:
|
|
|
|
|
val = arg0s <= arg1s ? arg0s : arg1s;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case UMIN:
|
|
|
|
|
val = ((unsigned HOST_WIDE_INT) arg0
|
|
|
|
|
<= (unsigned HOST_WIDE_INT) arg1 ? arg0 : arg1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SMAX:
|
|
|
|
|
val = arg0s > arg1s ? arg0s : arg1s;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case UMAX:
|
|
|
|
|
val = ((unsigned HOST_WIDE_INT) arg0
|
|
|
|
|
> (unsigned HOST_WIDE_INT) arg1 ? arg0 : arg1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SS_PLUS:
|
|
|
|
|
case US_PLUS:
|
|
|
|
|
case SS_MINUS:
|
|
|
|
|
case US_MINUS:
|
c-lex.c (interpret_fixed): Declare.
* c-lex.c (interpret_fixed): Declare.
(interpret_float): Process _Fract and _Accum.
(interpret_fixed): New function.
* final.c (output_addr_const): Process CONST_FIXED.
* simplify-rtx.c (simplify_const_unary_operation): Handle US_NEG.
(simplify_binary_operation_1): Handle US_ASHIFT, SS_MULT, US_MULT,
SS_DIV, US_DIV.
(simplify_const_binary_operation): Handle SS_MULT, US_MULT, SS_DIV,
US_DIV, US_ASHIFT.
(simplify_immed_subreg): Support CONST_FIXED.
Process MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.
(simplify_subreg): Support CONST_FIXED.
From-SVN: r127941
2007-08-31 01:09:28 +02:00
|
|
|
|
case SS_MULT:
|
|
|
|
|
case US_MULT:
|
|
|
|
|
case SS_DIV:
|
|
|
|
|
case US_DIV:
|
2006-04-24 21:35:38 +02:00
|
|
|
|
case SS_ASHIFT:
|
c-lex.c (interpret_fixed): Declare.
* c-lex.c (interpret_fixed): Declare.
(interpret_float): Process _Fract and _Accum.
(interpret_fixed): New function.
* final.c (output_addr_const): Process CONST_FIXED.
* simplify-rtx.c (simplify_const_unary_operation): Handle US_NEG.
(simplify_binary_operation_1): Handle US_ASHIFT, SS_MULT, US_MULT,
SS_DIV, US_DIV.
(simplify_const_binary_operation): Handle SS_MULT, US_MULT, SS_DIV,
US_DIV, US_ASHIFT.
(simplify_immed_subreg): Support CONST_FIXED.
Process MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.
(simplify_subreg): Support CONST_FIXED.
From-SVN: r127941
2007-08-31 01:09:28 +02:00
|
|
|
|
case US_ASHIFT:
|
2005-02-28 16:29:43 +01:00
|
|
|
|
/* ??? There are simplifications that can be done. */
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
gcc_unreachable ();
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-03-05 18:25:33 +01:00
|
|
|
|
return gen_int_mode (val, mode);
|
2005-02-28 16:29:43 +01:00
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-02-28 16:29:43 +01:00
|
|
|
|
return NULL_RTX;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
2005-02-28 16:29:43 +01:00
|
|
|
|
|
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
/* Simplify a PLUS or MINUS, at least one of whose operands may be another
|
|
|
|
|
PLUS or MINUS.
|
|
|
|
|
|
|
|
|
|
Rather than test for specific case, we do this by a brute-force method
|
|
|
|
|
and do all possible simplifications until no more changes occur. Then
|
2005-11-30 09:20:23 +01:00
|
|
|
|
we rebuild the operation. */
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2001-09-07 20:14:32 +02:00
|
|
|
|
struct simplify_plus_minus_op_data
|
|
|
|
|
{
|
|
|
|
|
rtx op;
|
2005-09-02 14:04:22 +02:00
|
|
|
|
short neg;
|
2001-09-07 20:14:32 +02:00
|
|
|
|
};
|
|
|
|
|
|
2007-07-23 18:43:24 +02:00
|
|
|
|
static bool
|
|
|
|
|
simplify_plus_minus_op_data_cmp (rtx x, rtx y)
|
2001-09-07 20:14:32 +02:00
|
|
|
|
{
|
2005-09-02 14:04:22 +02:00
|
|
|
|
int result;
|
2001-09-07 20:14:32 +02:00
|
|
|
|
|
2007-07-23 18:43:24 +02:00
|
|
|
|
result = (commutative_operand_precedence (y)
|
|
|
|
|
- commutative_operand_precedence (x));
|
2005-09-02 14:04:22 +02:00
|
|
|
|
if (result)
|
2007-07-23 18:43:24 +02:00
|
|
|
|
return result > 0;
|
2006-09-05 19:41:22 +02:00
|
|
|
|
|
|
|
|
|
/* Group together equal REGs to do more simplification. */
|
2007-07-23 18:43:24 +02:00
|
|
|
|
if (REG_P (x) && REG_P (y))
|
|
|
|
|
return REGNO (x) > REGNO (y);
|
2006-09-05 19:41:22 +02:00
|
|
|
|
else
|
2007-07-23 18:43:24 +02:00
|
|
|
|
return false;
|
2001-09-07 20:14:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
static rtx
|
2003-07-06 14:35:56 +02:00
|
|
|
|
simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
|
2005-11-30 09:20:23 +01:00
|
|
|
|
rtx op1)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2001-09-07 20:14:32 +02:00
|
|
|
|
struct simplify_plus_minus_op_data ops[8];
|
1999-11-01 01:18:23 +01:00
|
|
|
|
rtx result, tem;
|
2005-12-02 00:48:13 +01:00
|
|
|
|
int n_ops = 2, input_ops = 2;
|
2006-09-05 19:41:22 +02:00
|
|
|
|
int changed, n_constants = 0, canonicalized = 0;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
int i, j;
|
|
|
|
|
|
2003-07-19 16:47:15 +02:00
|
|
|
|
memset (ops, 0, sizeof ops);
|
2002-05-09 14:02:29 +02:00
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
/* Set up the two operands and then expand them until nothing has been
|
|
|
|
|
changed. If we run out of room in our array, give up; this should
|
|
|
|
|
almost never happen. */
|
|
|
|
|
|
2001-09-07 20:14:32 +02:00
|
|
|
|
ops[0].op = op0;
|
|
|
|
|
ops[0].neg = 0;
|
|
|
|
|
ops[1].op = op1;
|
|
|
|
|
ops[1].neg = (code == MINUS);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2001-09-07 20:14:32 +02:00
|
|
|
|
do
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
|
|
|
|
changed = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_ops; i++)
|
2001-09-07 20:14:32 +02:00
|
|
|
|
{
|
|
|
|
|
rtx this_op = ops[i].op;
|
|
|
|
|
int this_neg = ops[i].neg;
|
|
|
|
|
enum rtx_code this_code = GET_CODE (this_op);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2001-09-07 20:14:32 +02:00
|
|
|
|
switch (this_code)
|
|
|
|
|
{
|
|
|
|
|
case PLUS:
|
|
|
|
|
case MINUS:
|
|
|
|
|
if (n_ops == 7)
|
2002-03-07 00:07:08 +01:00
|
|
|
|
return NULL_RTX;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2001-09-07 20:14:32 +02:00
|
|
|
|
ops[n_ops].op = XEXP (this_op, 1);
|
|
|
|
|
ops[n_ops].neg = (this_code == MINUS) ^ this_neg;
|
|
|
|
|
n_ops++;
|
|
|
|
|
|
|
|
|
|
ops[i].op = XEXP (this_op, 0);
|
|
|
|
|
input_ops++;
|
|
|
|
|
changed = 1;
|
2005-11-30 09:20:23 +01:00
|
|
|
|
canonicalized |= this_neg;
|
2001-09-07 20:14:32 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NEG:
|
|
|
|
|
ops[i].op = XEXP (this_op, 0);
|
|
|
|
|
ops[i].neg = ! this_neg;
|
|
|
|
|
changed = 1;
|
2005-11-30 09:20:23 +01:00
|
|
|
|
canonicalized = 1;
|
2001-09-07 20:14:32 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CONST:
|
2002-02-22 00:06:16 +01:00
|
|
|
|
if (n_ops < 7
|
|
|
|
|
&& GET_CODE (XEXP (this_op, 0)) == PLUS
|
|
|
|
|
&& CONSTANT_P (XEXP (XEXP (this_op, 0), 0))
|
|
|
|
|
&& CONSTANT_P (XEXP (XEXP (this_op, 0), 1)))
|
|
|
|
|
{
|
|
|
|
|
ops[i].op = XEXP (XEXP (this_op, 0), 0);
|
|
|
|
|
ops[n_ops].op = XEXP (XEXP (this_op, 0), 1);
|
|
|
|
|
ops[n_ops].neg = this_neg;
|
|
|
|
|
n_ops++;
|
|
|
|
|
changed = 1;
|
2005-11-30 09:20:23 +01:00
|
|
|
|
canonicalized = 1;
|
2002-02-22 00:06:16 +01:00
|
|
|
|
}
|
2001-09-07 20:14:32 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NOT:
|
|
|
|
|
/* ~a -> (-a - 1) */
|
|
|
|
|
if (n_ops != 7)
|
|
|
|
|
{
|
|
|
|
|
ops[n_ops].op = constm1_rtx;
|
2002-01-07 22:13:25 +01:00
|
|
|
|
ops[n_ops++].neg = this_neg;
|
2001-09-07 20:14:32 +02:00
|
|
|
|
ops[i].op = XEXP (this_op, 0);
|
|
|
|
|
ops[i].neg = !this_neg;
|
|
|
|
|
changed = 1;
|
2005-11-30 09:20:23 +01:00
|
|
|
|
canonicalized = 1;
|
2001-09-07 20:14:32 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2001-09-07 20:14:32 +02:00
|
|
|
|
case CONST_INT:
|
2006-09-05 19:41:22 +02:00
|
|
|
|
n_constants++;
|
2001-09-07 20:14:32 +02:00
|
|
|
|
if (this_neg)
|
|
|
|
|
{
|
2001-12-13 02:21:52 +01:00
|
|
|
|
ops[i].op = neg_const_int (mode, this_op);
|
2001-09-07 20:14:32 +02:00
|
|
|
|
ops[i].neg = 0;
|
|
|
|
|
changed = 1;
|
2005-11-30 09:20:23 +01:00
|
|
|
|
canonicalized = 1;
|
2001-09-07 20:14:32 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2001-09-07 20:14:32 +02:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
2001-09-07 20:14:32 +02:00
|
|
|
|
while (changed);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2006-09-05 19:41:22 +02:00
|
|
|
|
if (n_constants > 1)
|
|
|
|
|
canonicalized = 1;
|
2005-12-02 00:48:13 +01:00
|
|
|
|
|
2006-09-05 19:41:22 +02:00
|
|
|
|
gcc_assert (n_ops >= 2);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2005-11-30 09:20:23 +01:00
|
|
|
|
/* If we only have two operands, we can avoid the loops. */
|
|
|
|
|
if (n_ops == 2)
|
|
|
|
|
{
|
|
|
|
|
enum rtx_code code = ops[0].neg || ops[1].neg ? MINUS : PLUS;
|
|
|
|
|
rtx lhs, rhs;
|
|
|
|
|
|
|
|
|
|
/* Get the two operands. Be careful with the order, especially for
|
|
|
|
|
the cases where code == MINUS. */
|
|
|
|
|
if (ops[0].neg && ops[1].neg)
|
|
|
|
|
{
|
|
|
|
|
lhs = gen_rtx_NEG (mode, ops[0].op);
|
|
|
|
|
rhs = ops[1].op;
|
|
|
|
|
}
|
|
|
|
|
else if (ops[0].neg)
|
|
|
|
|
{
|
|
|
|
|
lhs = ops[1].op;
|
|
|
|
|
rhs = ops[0].op;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lhs = ops[0].op;
|
|
|
|
|
rhs = ops[1].op;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return simplify_const_binary_operation (code, mode, lhs, rhs);
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-05 19:41:22 +02:00
|
|
|
|
/* Now simplify each pair of operands until nothing changes. */
|
2001-09-07 20:14:32 +02:00
|
|
|
|
do
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2006-09-05 19:41:22 +02:00
|
|
|
|
/* Insertion sort is good enough for an eight-element array. */
|
|
|
|
|
for (i = 1; i < n_ops; i++)
|
|
|
|
|
{
|
|
|
|
|
struct simplify_plus_minus_op_data save;
|
|
|
|
|
j = i - 1;
|
2007-07-23 18:43:24 +02:00
|
|
|
|
if (!simplify_plus_minus_op_data_cmp (ops[j].op, ops[i].op))
|
2006-09-05 19:41:22 +02:00
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
canonicalized = 1;
|
|
|
|
|
save = ops[i];
|
|
|
|
|
do
|
|
|
|
|
ops[j + 1] = ops[j];
|
2007-07-23 18:43:24 +02:00
|
|
|
|
while (j-- && simplify_plus_minus_op_data_cmp (ops[j].op, save.op));
|
2006-09-05 19:41:22 +02:00
|
|
|
|
ops[j + 1] = save;
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2006-09-05 19:41:22 +02:00
|
|
|
|
changed = 0;
|
|
|
|
|
for (i = n_ops - 1; i > 0; i--)
|
|
|
|
|
for (j = i - 1; j >= 0; j--)
|
2001-09-07 20:14:32 +02:00
|
|
|
|
{
|
2006-09-05 19:41:22 +02:00
|
|
|
|
rtx lhs = ops[j].op, rhs = ops[i].op;
|
|
|
|
|
int lneg = ops[j].neg, rneg = ops[i].neg;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2006-09-05 19:41:22 +02:00
|
|
|
|
if (lhs != 0 && rhs != 0)
|
2001-09-07 20:14:32 +02:00
|
|
|
|
{
|
|
|
|
|
enum rtx_code ncode = PLUS;
|
|
|
|
|
|
|
|
|
|
if (lneg != rneg)
|
|
|
|
|
{
|
|
|
|
|
ncode = MINUS;
|
|
|
|
|
if (lneg)
|
|
|
|
|
tem = lhs, lhs = rhs, rhs = tem;
|
|
|
|
|
}
|
|
|
|
|
else if (swap_commutative_operands_p (lhs, rhs))
|
|
|
|
|
tem = lhs, lhs = rhs, rhs = tem;
|
|
|
|
|
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if ((GET_CODE (lhs) == CONST || CONST_INT_P (lhs))
|
|
|
|
|
&& (GET_CODE (rhs) == CONST || CONST_INT_P (rhs)))
|
2006-03-16 09:15:35 +01:00
|
|
|
|
{
|
|
|
|
|
rtx tem_lhs, tem_rhs;
|
|
|
|
|
|
|
|
|
|
tem_lhs = GET_CODE (lhs) == CONST ? XEXP (lhs, 0) : lhs;
|
|
|
|
|
tem_rhs = GET_CODE (rhs) == CONST ? XEXP (rhs, 0) : rhs;
|
|
|
|
|
tem = simplify_binary_operation (ncode, mode, tem_lhs, tem_rhs);
|
2001-09-07 20:14:32 +02:00
|
|
|
|
|
2006-03-16 09:15:35 +01:00
|
|
|
|
if (tem && !CONSTANT_P (tem))
|
|
|
|
|
tem = gen_rtx_CONST (GET_MODE (tem), tem);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
tem = simplify_binary_operation (ncode, mode, lhs, rhs);
|
|
|
|
|
|
2002-05-09 14:02:29 +02:00
|
|
|
|
/* Reject "simplifications" that just wrap the two
|
2001-09-07 20:14:32 +02:00
|
|
|
|
arguments in a CONST. Failure to do so can result
|
|
|
|
|
in infinite recursion with simplify_binary_operation
|
|
|
|
|
when it calls us to simplify CONST operations. */
|
|
|
|
|
if (tem
|
|
|
|
|
&& ! (GET_CODE (tem) == CONST
|
|
|
|
|
&& GET_CODE (XEXP (tem, 0)) == ncode
|
|
|
|
|
&& XEXP (XEXP (tem, 0), 0) == lhs
|
2006-09-05 19:41:22 +02:00
|
|
|
|
&& XEXP (XEXP (tem, 0), 1) == rhs))
|
2001-09-07 20:14:32 +02:00
|
|
|
|
{
|
|
|
|
|
lneg &= rneg;
|
|
|
|
|
if (GET_CODE (tem) == NEG)
|
|
|
|
|
tem = XEXP (tem, 0), lneg = !lneg;
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (tem) && lneg)
|
2001-12-13 02:21:52 +01:00
|
|
|
|
tem = neg_const_int (mode, tem), lneg = 0;
|
2001-09-07 20:14:32 +02:00
|
|
|
|
|
|
|
|
|
ops[i].op = tem;
|
|
|
|
|
ops[i].neg = lneg;
|
|
|
|
|
ops[j].op = NULL_RTX;
|
|
|
|
|
changed = 1;
|
2008-11-20 09:05:12 +01:00
|
|
|
|
canonicalized = 1;
|
2001-09-07 20:14:32 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2008-11-20 09:05:12 +01:00
|
|
|
|
/* If nothing changed, fail. */
|
|
|
|
|
if (!canonicalized)
|
|
|
|
|
return NULL_RTX;
|
|
|
|
|
|
2006-09-05 19:41:22 +02:00
|
|
|
|
/* Pack all the operands to the lower-numbered entries. */
|
|
|
|
|
for (i = 0, j = 0; j < n_ops; j++)
|
|
|
|
|
if (ops[j].op)
|
|
|
|
|
{
|
|
|
|
|
ops[i] = ops[j];
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
n_ops = i;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
2001-09-07 20:14:32 +02:00
|
|
|
|
while (changed);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2003-10-11 23:06:19 +02:00
|
|
|
|
/* Create (minus -C X) instead of (neg (const (plus X C))). */
|
|
|
|
|
if (n_ops == 2
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (ops[1].op)
|
2003-10-11 23:06:19 +02:00
|
|
|
|
&& CONSTANT_P (ops[0].op)
|
|
|
|
|
&& ops[0].neg)
|
|
|
|
|
return gen_rtx_fmt_ee (MINUS, mode, ops[1].op, ops[0].op);
|
|
|
|
|
|
2001-09-07 20:14:32 +02:00
|
|
|
|
/* We suppressed creation of trivial CONST expressions in the
|
|
|
|
|
combination loop to avoid recursion. Create one manually now.
|
|
|
|
|
The combination loop should have ensured that there is exactly
|
|
|
|
|
one CONST_INT, and the sort will have ensured that it is last
|
|
|
|
|
in the array and that any other constant will be next-to-last. */
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2001-09-07 20:14:32 +02:00
|
|
|
|
if (n_ops > 1
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (ops[n_ops - 1].op)
|
2001-09-07 20:14:32 +02:00
|
|
|
|
&& CONSTANT_P (ops[n_ops - 2].op))
|
|
|
|
|
{
|
2001-12-13 02:21:52 +01:00
|
|
|
|
rtx value = ops[n_ops - 1].op;
|
2001-10-19 21:28:03 +02:00
|
|
|
|
if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
|
2001-12-13 02:21:52 +01:00
|
|
|
|
value = neg_const_int (mode, value);
|
|
|
|
|
ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value));
|
2001-09-07 20:14:32 +02:00
|
|
|
|
n_ops--;
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-12 16:33:59 +01:00
|
|
|
|
/* Put a non-negated operand first, if possible. */
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2001-09-07 20:14:32 +02:00
|
|
|
|
for (i = 0; i < n_ops && ops[i].neg; i++)
|
|
|
|
|
continue;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
if (i == n_ops)
|
2004-01-12 16:33:59 +01:00
|
|
|
|
ops[0].op = gen_rtx_NEG (mode, ops[0].op);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
else if (i != 0)
|
|
|
|
|
{
|
2001-09-07 20:14:32 +02:00
|
|
|
|
tem = ops[0].op;
|
|
|
|
|
ops[0] = ops[i];
|
|
|
|
|
ops[i].op = tem;
|
|
|
|
|
ops[i].neg = 1;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now make the result by performing the requested operations. */
|
2001-09-07 20:14:32 +02:00
|
|
|
|
result = ops[0].op;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
for (i = 1; i < n_ops; i++)
|
2001-09-07 20:14:32 +02:00
|
|
|
|
result = gen_rtx_fmt_ee (ops[i].neg ? MINUS : PLUS,
|
|
|
|
|
mode, result, ops[i].op);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2004-01-12 16:33:59 +01:00
|
|
|
|
return result;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
2004-12-14 00:49:28 +01:00
|
|
|
|
/* Check whether an operand is suitable for calling simplify_plus_minus. */
|
|
|
|
|
static bool
|
cfglayout.c (insn_scope, insn_line): Constify.
* cfglayout.c (insn_scope, insn_line): Constify.
* emit-rtl.c (const_int_htab_hash, const_int_htab_eq,
const_double_htab_hash, const_double_htab_eq,
mem_attrs_htab_hash): Likewise.
* loop-iv.c (biv_eq): Likewise.
* print-rtl.c (print_rtx, print_decl_name, print_mem_expr,
print_inline_rtx, debug_rtx, debug_rtx_list, debug_rtx_range,
debug_rtx_find, print_rtl, print_rtl_single, print_simple_rtl):
Likewise.
* rtl-error.c (location_for_asm, diagnostic_for_asm,
error_for_asm, warning_for_asm, _fatal_insn,
_fatal_insn_not_found): Likewise.
* rtl.c (rtx_size, shared_const_p, shallow_copy_rtx_stat,
rtx_equal_p, rtl_check_failed_bounds, rtl_check_failed_type1,
rtl_check_failed_type2, rtl_check_failed_code1,
rtl_check_failed_code2, rtl_check_failed_code_mode,
rtvec_check_failed_bounds, rtl_check_failed_flag): Likewise.
* rtl.h (rtl_check_failed_bounds, rtl_check_failed_type1,
rtl_check_failed_type2, rtl_check_failed_code1,
rtl_check_failed_code2, rtl_check_failed_code_mode,
rtvec_check_failed_bounds, rtl_check_failed_flag, LABEL_KIND,
SET_LABEL_KIND, rhs_regno, subreg_lsb, subreg_regno, subreg_nregs,
shared_const_p, rtx_size, shallow_copy_rtx_stat, rtx_equal_p,
get_pool_mode, insn_line, insn_file, simplify_replace_rtx,
mode_signbit_p, rtx_addr_can_trap_p, nonzero_address_p,
rtx_unstable_p, get_integer_term, get_related_value,
offset_within_block_p, reg_mentioned_p, count_occurrences,
reg_referenced_p, reg_used_between_p, no_labels_between_p,
single_set_2, multiple_sets, set_noop_p, refers_to_regno_p,
reg_overlap_mentioned_p, dead_or_set_p, dead_or_set_regno_p,
find_reg_note, find_regno_note, find_reg_equal_equiv_note,
find_constant_src, find_reg_fusage, find_regno_fusage,
pure_call_p, remove_note, side_effects_p, volatile_refs_p,
volatile_insn_p, may_trap_p, may_trap_after_code_motion_p,
may_trap_or_fault_p, inequality_comparisons_p, tablejump_p,
computed_jump_p, auto_inc_p, in_expr_list_p,
remove_node_from_expr_list, loc_mentioned_in_p,
label_is_jump_target_p, reversed_comparison_code_parts,
debug_rtx, debug_rtx_list, debug_rtx_range, debug_rtx_find,
print_mem_expr, print_rtl, print_simple_rtl, print_rtl_single,
print_inline_rtx): Likewise.
* rtlanal.c (covers_regno_p, covers_regno_no_parallel_p,
computed_jump_p_1, nonzero_bits1, rtx_unstable_p,
rtx_addr_can_trap_p_1, rtx_addr_can_trap_p, nonzero_address_p,
get_integer_term, get_related_value, offset_within_block_p,
count_occurrences, reg_mentioned_p, no_labels_between_p,
reg_used_between_p, reg_referenced_p, single_set_2,
multiple_sets, set_noop_p, refers_to_regno_p,
reg_overlap_mentioned_p, dead_or_set_p,
covers_regno_no_parallel_p, covers_regno_p,
dead_or_set_regno_p, find_reg_note, find_regno_note,
find_reg_equal_equiv_note, find_constant_src, find_reg_fusage,
find_regno_fusage, pure_call_p, remove_note, in_expr_list_p,
remove_node_from_expr_list, volatile_insn_p, volatile_refs_p,
side_effects_p, may_trap_p_1, may_trap_p,
may_trap_after_code_motion_p, may_trap_or_fault_p,
inequality_comparisons_p, tablejump_p, computed_jump_p_1,
computed_jump_p, auto_inc_p, loc_mentioned_in_p, subreg_lsb,
subreg_regno, subreg_nregs, label_is_jump_target_p): Likewise.
* simplify-rtx.c (neg_const_int, plus_minus_operand_p,
mode_signbit_p, simplify_replace_rtx, plus_minus_operand_p):
Likewise.
* toplev.h (_fatal_insn_not_found, _fatal_insn, error_for_asm,
warning_for_asm): Likewise.
* tree.h (print_rtl): Likewise.
* varasm.c (get_pool_mode): Likewise.
From-SVN: r126922
2007-07-25 20:33:26 +02:00
|
|
|
|
plus_minus_operand_p (const_rtx x)
|
2004-12-14 00:49:28 +01:00
|
|
|
|
{
|
|
|
|
|
return GET_CODE (x) == PLUS
|
|
|
|
|
|| GET_CODE (x) == MINUS
|
|
|
|
|
|| (GET_CODE (x) == CONST
|
|
|
|
|
&& GET_CODE (XEXP (x, 0)) == PLUS
|
|
|
|
|
&& CONSTANT_P (XEXP (XEXP (x, 0), 0))
|
|
|
|
|
&& CONSTANT_P (XEXP (XEXP (x, 0), 1)));
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
/* Like simplify_binary_operation except used for relational operators.
|
2004-04-29 09:50:55 +02:00
|
|
|
|
MODE is the mode of the result. If MODE is VOIDmode, both operands must
|
2004-10-09 21:27:55 +02:00
|
|
|
|
not also be VOIDmode.
|
2004-04-29 09:50:55 +02:00
|
|
|
|
|
|
|
|
|
CMP_MODE specifies in which mode the comparison is done in, so it is
|
|
|
|
|
the mode of the operands. If CMP_MODE is VOIDmode, it is taken from
|
|
|
|
|
the operands or, if both are VOIDmode, the operands are compared in
|
|
|
|
|
"infinite precision". */
|
|
|
|
|
rtx
|
|
|
|
|
simplify_relational_operation (enum rtx_code code, enum machine_mode mode,
|
|
|
|
|
enum machine_mode cmp_mode, rtx op0, rtx op1)
|
|
|
|
|
{
|
|
|
|
|
rtx tem, trueop0, trueop1;
|
|
|
|
|
|
|
|
|
|
if (cmp_mode == VOIDmode)
|
|
|
|
|
cmp_mode = GET_MODE (op0);
|
|
|
|
|
if (cmp_mode == VOIDmode)
|
|
|
|
|
cmp_mode = GET_MODE (op1);
|
|
|
|
|
|
|
|
|
|
tem = simplify_const_relational_operation (code, cmp_mode, op0, op1);
|
|
|
|
|
if (tem)
|
|
|
|
|
{
|
2005-11-21 21:53:27 +01:00
|
|
|
|
if (SCALAR_FLOAT_MODE_P (mode))
|
2004-04-29 09:50:55 +02:00
|
|
|
|
{
|
|
|
|
|
if (tem == const0_rtx)
|
|
|
|
|
return CONST0_RTX (mode);
|
2004-10-09 21:27:55 +02:00
|
|
|
|
#ifdef FLOAT_STORE_FLAG_VALUE
|
|
|
|
|
{
|
|
|
|
|
REAL_VALUE_TYPE val;
|
|
|
|
|
val = FLOAT_STORE_FLAG_VALUE (mode);
|
|
|
|
|
return CONST_DOUBLE_FROM_REAL_VALUE (val, mode);
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
return NULL_RTX;
|
|
|
|
|
#endif
|
2004-04-29 09:50:55 +02:00
|
|
|
|
}
|
2004-10-09 21:27:55 +02:00
|
|
|
|
if (VECTOR_MODE_P (mode))
|
|
|
|
|
{
|
|
|
|
|
if (tem == const0_rtx)
|
|
|
|
|
return CONST0_RTX (mode);
|
|
|
|
|
#ifdef VECTOR_STORE_FLAG_VALUE
|
|
|
|
|
{
|
|
|
|
|
int i, units;
|
2005-01-04 16:44:25 +01:00
|
|
|
|
rtvec v;
|
2004-10-09 21:27:55 +02:00
|
|
|
|
|
|
|
|
|
rtx val = VECTOR_STORE_FLAG_VALUE (mode);
|
|
|
|
|
if (val == NULL_RTX)
|
|
|
|
|
return NULL_RTX;
|
|
|
|
|
if (val == const1_rtx)
|
|
|
|
|
return CONST1_RTX (mode);
|
|
|
|
|
|
|
|
|
|
units = GET_MODE_NUNITS (mode);
|
|
|
|
|
v = rtvec_alloc (units);
|
|
|
|
|
for (i = 0; i < units; i++)
|
|
|
|
|
RTVEC_ELT (v, i) = val;
|
|
|
|
|
return gen_rtx_raw_CONST_VECTOR (mode, v);
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
return NULL_RTX;
|
2004-04-29 09:50:55 +02:00
|
|
|
|
#endif
|
2004-10-09 21:27:55 +02:00
|
|
|
|
}
|
2004-04-29 09:50:55 +02:00
|
|
|
|
|
|
|
|
|
return tem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* For the following tests, ensure const0_rtx is op1. */
|
|
|
|
|
if (swap_commutative_operands_p (op0, op1)
|
|
|
|
|
|| (op0 == const0_rtx && op1 != const0_rtx))
|
|
|
|
|
tem = op0, op0 = op1, op1 = tem, code = swap_condition (code);
|
|
|
|
|
|
|
|
|
|
/* If op0 is a compare, extract the comparison arguments from it. */
|
|
|
|
|
if (GET_CODE (op0) == COMPARE && op1 == const0_rtx)
|
2009-05-12 11:43:48 +02:00
|
|
|
|
return simplify_gen_relational (code, mode, VOIDmode,
|
|
|
|
|
XEXP (op0, 0), XEXP (op0, 1));
|
2004-04-29 09:50:55 +02:00
|
|
|
|
|
2006-03-25 22:58:01 +01:00
|
|
|
|
if (GET_MODE_CLASS (cmp_mode) == MODE_CC
|
2004-04-29 09:50:55 +02:00
|
|
|
|
|| CC0_P (op0))
|
|
|
|
|
return NULL_RTX;
|
|
|
|
|
|
|
|
|
|
trueop0 = avoid_constant_pool_reference (op0);
|
|
|
|
|
trueop1 = avoid_constant_pool_reference (op1);
|
|
|
|
|
return simplify_relational_operation_1 (code, mode, cmp_mode,
|
|
|
|
|
trueop0, trueop1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This part of simplify_relational_operation is only used when CMP_MODE
|
|
|
|
|
is not in class MODE_CC (i.e. it is a real comparison).
|
|
|
|
|
|
|
|
|
|
MODE is the mode of the result, while CMP_MODE specifies in which
|
|
|
|
|
mode the comparison is done in, so it is the mode of the operands. */
|
2004-12-20 21:48:53 +01:00
|
|
|
|
|
|
|
|
|
static rtx
|
2004-04-29 09:50:55 +02:00
|
|
|
|
simplify_relational_operation_1 (enum rtx_code code, enum machine_mode mode,
|
|
|
|
|
enum machine_mode cmp_mode, rtx op0, rtx op1)
|
|
|
|
|
{
|
2004-12-20 21:48:53 +01:00
|
|
|
|
enum rtx_code op0code = GET_CODE (op0);
|
|
|
|
|
|
2007-02-03 17:22:09 +01:00
|
|
|
|
if (op1 == const0_rtx && COMPARISON_P (op0))
|
2004-04-29 09:50:55 +02:00
|
|
|
|
{
|
2007-02-03 17:22:09 +01:00
|
|
|
|
/* If op0 is a comparison, extract the comparison arguments
|
|
|
|
|
from it. */
|
|
|
|
|
if (code == NE)
|
2004-04-29 09:50:55 +02:00
|
|
|
|
{
|
2007-02-03 17:22:09 +01:00
|
|
|
|
if (GET_MODE (op0) == mode)
|
|
|
|
|
return simplify_rtx (op0);
|
|
|
|
|
else
|
|
|
|
|
return simplify_gen_relational (GET_CODE (op0), mode, VOIDmode,
|
|
|
|
|
XEXP (op0, 0), XEXP (op0, 1));
|
|
|
|
|
}
|
|
|
|
|
else if (code == EQ)
|
|
|
|
|
{
|
|
|
|
|
enum rtx_code new_code = reversed_comparison_code (op0, NULL_RTX);
|
|
|
|
|
if (new_code != UNKNOWN)
|
|
|
|
|
return simplify_gen_relational (new_code, mode, VOIDmode,
|
|
|
|
|
XEXP (op0, 0), XEXP (op0, 1));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-31 17:19:33 +02:00
|
|
|
|
/* (LTU/GEU (PLUS a C) C), where C is constant, can be simplified to
|
|
|
|
|
(GEU/LTU a -C). Likewise for (LTU/GEU (PLUS a C) a). */
|
|
|
|
|
if ((code == LTU || code == GEU)
|
|
|
|
|
&& GET_CODE (op0) == PLUS
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (op0, 1))
|
2009-03-31 17:19:33 +02:00
|
|
|
|
&& (rtx_equal_p (op1, XEXP (op0, 0))
|
|
|
|
|
|| rtx_equal_p (op1, XEXP (op0, 1))))
|
|
|
|
|
{
|
|
|
|
|
rtx new_cmp
|
|
|
|
|
= simplify_gen_unary (NEG, cmp_mode, XEXP (op0, 1), cmp_mode);
|
|
|
|
|
return simplify_gen_relational ((code == LTU ? GEU : LTU), mode,
|
|
|
|
|
cmp_mode, XEXP (op0, 0), new_cmp);
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-09 21:21:59 +02:00
|
|
|
|
/* Canonicalize (LTU/GEU (PLUS a b) b) as (LTU/GEU (PLUS a b) a). */
|
|
|
|
|
if ((code == LTU || code == GEU)
|
|
|
|
|
&& GET_CODE (op0) == PLUS
|
2007-09-10 09:30:16 +02:00
|
|
|
|
&& rtx_equal_p (op1, XEXP (op0, 1))
|
|
|
|
|
/* Don't recurse "infinitely" for (LTU/GEU (PLUS b b) b). */
|
|
|
|
|
&& !rtx_equal_p (op1, XEXP (op0, 0)))
|
2007-09-09 21:21:59 +02:00
|
|
|
|
return simplify_gen_relational (code, mode, cmp_mode, op0, XEXP (op0, 0));
|
|
|
|
|
|
2007-02-03 17:22:09 +01:00
|
|
|
|
if (op1 == const0_rtx)
|
|
|
|
|
{
|
|
|
|
|
/* Canonicalize (GTU x 0) as (NE x 0). */
|
|
|
|
|
if (code == GTU)
|
|
|
|
|
return simplify_gen_relational (NE, mode, cmp_mode, op0, op1);
|
|
|
|
|
/* Canonicalize (LEU x 0) as (EQ x 0). */
|
|
|
|
|
if (code == LEU)
|
|
|
|
|
return simplify_gen_relational (EQ, mode, cmp_mode, op0, op1);
|
|
|
|
|
}
|
|
|
|
|
else if (op1 == const1_rtx)
|
|
|
|
|
{
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case GE:
|
|
|
|
|
/* Canonicalize (GE x 1) as (GT x 0). */
|
|
|
|
|
return simplify_gen_relational (GT, mode, cmp_mode,
|
|
|
|
|
op0, const0_rtx);
|
|
|
|
|
case GEU:
|
|
|
|
|
/* Canonicalize (GEU x 1) as (NE x 0). */
|
|
|
|
|
return simplify_gen_relational (NE, mode, cmp_mode,
|
|
|
|
|
op0, const0_rtx);
|
|
|
|
|
case LT:
|
|
|
|
|
/* Canonicalize (LT x 1) as (LE x 0). */
|
|
|
|
|
return simplify_gen_relational (LE, mode, cmp_mode,
|
|
|
|
|
op0, const0_rtx);
|
|
|
|
|
case LTU:
|
|
|
|
|
/* Canonicalize (LTU x 1) as (EQ x 0). */
|
|
|
|
|
return simplify_gen_relational (EQ, mode, cmp_mode,
|
|
|
|
|
op0, const0_rtx);
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2004-04-29 09:50:55 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-02-03 17:22:09 +01:00
|
|
|
|
else if (op1 == constm1_rtx)
|
|
|
|
|
{
|
|
|
|
|
/* Canonicalize (LE x -1) as (LT x 0). */
|
|
|
|
|
if (code == LE)
|
|
|
|
|
return simplify_gen_relational (LT, mode, cmp_mode, op0, const0_rtx);
|
|
|
|
|
/* Canonicalize (GT x -1) as (GE x 0). */
|
|
|
|
|
if (code == GT)
|
|
|
|
|
return simplify_gen_relational (GE, mode, cmp_mode, op0, const0_rtx);
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2004-12-20 21:48:53 +01:00
|
|
|
|
/* (eq/ne (plus x cst1) cst2) simplifies to (eq/ne x (cst2 - cst1)) */
|
|
|
|
|
if ((code == EQ || code == NE)
|
|
|
|
|
&& (op0code == PLUS || op0code == MINUS)
|
|
|
|
|
&& CONSTANT_P (op1)
|
2004-12-27 04:31:49 +01:00
|
|
|
|
&& CONSTANT_P (XEXP (op0, 1))
|
|
|
|
|
&& (INTEGRAL_MODE_P (cmp_mode) || flag_unsafe_math_optimizations))
|
2004-12-20 21:48:53 +01:00
|
|
|
|
{
|
|
|
|
|
rtx x = XEXP (op0, 0);
|
|
|
|
|
rtx c = XEXP (op0, 1);
|
|
|
|
|
|
|
|
|
|
c = simplify_gen_binary (op0code == PLUS ? MINUS : PLUS,
|
|
|
|
|
cmp_mode, op1, c);
|
|
|
|
|
return simplify_gen_relational (code, mode, cmp_mode, x, c);
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-07 00:33:25 +01:00
|
|
|
|
/* (ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0))) is
|
|
|
|
|
the same as (zero_extract:SI FOO (const_int 1) BAR). */
|
|
|
|
|
if (code == NE
|
|
|
|
|
&& op1 == const0_rtx
|
|
|
|
|
&& GET_MODE_CLASS (mode) == MODE_INT
|
|
|
|
|
&& cmp_mode != VOIDmode
|
2005-02-23 19:20:52 +01:00
|
|
|
|
/* ??? Work-around BImode bugs in the ia64 backend. */
|
|
|
|
|
&& mode != BImode
|
2005-02-08 04:38:26 +01:00
|
|
|
|
&& cmp_mode != BImode
|
2005-02-07 00:33:25 +01:00
|
|
|
|
&& nonzero_bits (op0, cmp_mode) == 1
|
|
|
|
|
&& STORE_FLAG_VALUE == 1)
|
2005-02-08 04:38:26 +01:00
|
|
|
|
return GET_MODE_SIZE (mode) > GET_MODE_SIZE (cmp_mode)
|
|
|
|
|
? simplify_gen_unary (ZERO_EXTEND, mode, op0, cmp_mode)
|
|
|
|
|
: lowpart_subreg (mode, op0, cmp_mode);
|
2005-02-07 00:33:25 +01:00
|
|
|
|
|
2006-02-25 23:29:48 +01:00
|
|
|
|
/* (eq/ne (xor x y) 0) simplifies to (eq/ne x y). */
|
|
|
|
|
if ((code == EQ || code == NE)
|
|
|
|
|
&& op1 == const0_rtx
|
|
|
|
|
&& op0code == XOR)
|
|
|
|
|
return simplify_gen_relational (code, mode, cmp_mode,
|
|
|
|
|
XEXP (op0, 0), XEXP (op0, 1));
|
|
|
|
|
|
2006-05-21 17:13:36 +02:00
|
|
|
|
/* (eq/ne (xor x y) x) simplifies to (eq/ne y 0). */
|
2006-02-25 23:29:48 +01:00
|
|
|
|
if ((code == EQ || code == NE)
|
|
|
|
|
&& op0code == XOR
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 0), op1)
|
2006-05-21 17:13:36 +02:00
|
|
|
|
&& !side_effects_p (XEXP (op0, 0)))
|
|
|
|
|
return simplify_gen_relational (code, mode, cmp_mode,
|
|
|
|
|
XEXP (op0, 1), const0_rtx);
|
|
|
|
|
|
|
|
|
|
/* Likewise (eq/ne (xor x y) y) simplifies to (eq/ne x 0). */
|
2006-02-25 23:29:48 +01:00
|
|
|
|
if ((code == EQ || code == NE)
|
|
|
|
|
&& op0code == XOR
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 1), op1)
|
2006-05-21 17:13:36 +02:00
|
|
|
|
&& !side_effects_p (XEXP (op0, 1)))
|
|
|
|
|
return simplify_gen_relational (code, mode, cmp_mode,
|
|
|
|
|
XEXP (op0, 0), const0_rtx);
|
2006-02-25 23:29:48 +01:00
|
|
|
|
|
|
|
|
|
/* (eq/ne (xor x C1) C2) simplifies to (eq/ne x (C1^C2)). */
|
|
|
|
|
if ((code == EQ || code == NE)
|
|
|
|
|
&& op0code == XOR
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& (CONST_INT_P (op1)
|
2006-02-25 23:29:48 +01:00
|
|
|
|
|| GET_CODE (op1) == CONST_DOUBLE)
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& (CONST_INT_P (XEXP (op0, 1))
|
2006-02-25 23:29:48 +01:00
|
|
|
|
|| GET_CODE (XEXP (op0, 1)) == CONST_DOUBLE))
|
|
|
|
|
return simplify_gen_relational (code, mode, cmp_mode, XEXP (op0, 0),
|
|
|
|
|
simplify_gen_binary (XOR, cmp_mode,
|
|
|
|
|
XEXP (op0, 1), op1));
|
|
|
|
|
|
2007-02-12 02:43:50 +01:00
|
|
|
|
if (op0code == POPCOUNT && op1 == const0_rtx)
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case EQ:
|
|
|
|
|
case LE:
|
|
|
|
|
case LEU:
|
|
|
|
|
/* (eq (popcount x) (const_int 0)) -> (eq x (const_int 0)). */
|
|
|
|
|
return simplify_gen_relational (EQ, mode, GET_MODE (XEXP (op0, 0)),
|
|
|
|
|
XEXP (op0, 0), const0_rtx);
|
|
|
|
|
|
|
|
|
|
case NE:
|
|
|
|
|
case GT:
|
|
|
|
|
case GTU:
|
|
|
|
|
/* (ne (popcount x) (const_int 0)) -> (ne x (const_int 0)). */
|
2007-02-12 05:19:42 +01:00
|
|
|
|
return simplify_gen_relational (NE, mode, GET_MODE (XEXP (op0, 0)),
|
2007-02-12 02:43:50 +01:00
|
|
|
|
XEXP (op0, 0), const0_rtx);
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2004-04-29 09:50:55 +02:00
|
|
|
|
return NULL_RTX;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-27 13:29:10 +02:00
|
|
|
|
enum
|
|
|
|
|
{
|
2007-10-01 17:14:29 +02:00
|
|
|
|
CMP_EQ = 1,
|
|
|
|
|
CMP_LT = 2,
|
|
|
|
|
CMP_GT = 4,
|
|
|
|
|
CMP_LTU = 8,
|
|
|
|
|
CMP_GTU = 16
|
2007-09-27 13:29:10 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Convert the known results for EQ, LT, GT, LTU, GTU contained in
|
|
|
|
|
KNOWN_RESULT to a CONST_INT, based on the requested comparison CODE
|
2007-10-01 17:14:29 +02:00
|
|
|
|
For KNOWN_RESULT to make sense it should be either CMP_EQ, or the
|
|
|
|
|
logical OR of one of (CMP_LT, CMP_GT) and one of (CMP_LTU, CMP_GTU).
|
2007-09-27 13:29:10 +02:00
|
|
|
|
For floating-point comparisons, assume that the operands were ordered. */
|
|
|
|
|
|
|
|
|
|
static rtx
|
|
|
|
|
comparison_result (enum rtx_code code, int known_results)
|
|
|
|
|
{
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case EQ:
|
|
|
|
|
case UNEQ:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return (known_results & CMP_EQ) ? const_true_rtx : const0_rtx;
|
2007-09-27 13:29:10 +02:00
|
|
|
|
case NE:
|
|
|
|
|
case LTGT:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return (known_results & CMP_EQ) ? const0_rtx : const_true_rtx;
|
2007-09-27 13:29:10 +02:00
|
|
|
|
|
|
|
|
|
case LT:
|
|
|
|
|
case UNLT:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return (known_results & CMP_LT) ? const_true_rtx : const0_rtx;
|
2007-09-27 13:29:10 +02:00
|
|
|
|
case GE:
|
|
|
|
|
case UNGE:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return (known_results & CMP_LT) ? const0_rtx : const_true_rtx;
|
2007-09-27 13:29:10 +02:00
|
|
|
|
|
|
|
|
|
case GT:
|
|
|
|
|
case UNGT:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return (known_results & CMP_GT) ? const_true_rtx : const0_rtx;
|
2007-09-27 13:29:10 +02:00
|
|
|
|
case LE:
|
|
|
|
|
case UNLE:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return (known_results & CMP_GT) ? const0_rtx : const_true_rtx;
|
2007-09-27 13:29:10 +02:00
|
|
|
|
|
|
|
|
|
case LTU:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return (known_results & CMP_LTU) ? const_true_rtx : const0_rtx;
|
2007-09-27 13:29:10 +02:00
|
|
|
|
case GEU:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return (known_results & CMP_LTU) ? const0_rtx : const_true_rtx;
|
2007-09-27 13:29:10 +02:00
|
|
|
|
|
|
|
|
|
case GTU:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return (known_results & CMP_GTU) ? const_true_rtx : const0_rtx;
|
2007-09-27 13:29:10 +02:00
|
|
|
|
case LEU:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return (known_results & CMP_GTU) ? const0_rtx : const_true_rtx;
|
2007-09-27 13:29:10 +02:00
|
|
|
|
|
|
|
|
|
case ORDERED:
|
|
|
|
|
return const_true_rtx;
|
|
|
|
|
case UNORDERED:
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
default:
|
|
|
|
|
gcc_unreachable ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-04-29 09:50:55 +02:00
|
|
|
|
/* Check if the given comparison (done in the given MODE) is actually a
|
|
|
|
|
tautology or a contradiction.
|
2004-03-09 18:06:25 +01:00
|
|
|
|
If no simplification is possible, this function returns zero.
|
|
|
|
|
Otherwise, it returns either const_true_rtx or const0_rtx. */
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
rtx
|
2004-03-09 18:06:25 +01:00
|
|
|
|
simplify_const_relational_operation (enum rtx_code code,
|
|
|
|
|
enum machine_mode mode,
|
|
|
|
|
rtx op0, rtx op1)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
|
|
|
|
rtx tem;
|
2001-07-17 17:11:56 +02:00
|
|
|
|
rtx trueop0;
|
|
|
|
|
rtx trueop1;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (mode != VOIDmode
|
|
|
|
|
|| (GET_MODE (op0) == VOIDmode
|
|
|
|
|
&& GET_MODE (op1) == VOIDmode));
|
2000-07-30 20:13:10 +02:00
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
/* If op0 is a compare, extract the comparison arguments from it. */
|
|
|
|
|
if (GET_CODE (op0) == COMPARE && op1 == const0_rtx)
|
2005-08-16 04:01:27 +02:00
|
|
|
|
{
|
|
|
|
|
op1 = XEXP (op0, 1);
|
|
|
|
|
op0 = XEXP (op0, 0);
|
|
|
|
|
|
|
|
|
|
if (GET_MODE (op0) != VOIDmode)
|
|
|
|
|
mode = GET_MODE (op0);
|
|
|
|
|
else if (GET_MODE (op1) != VOIDmode)
|
|
|
|
|
mode = GET_MODE (op1);
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
/* We can't simplify MODE_CC values since we don't know what the
|
|
|
|
|
actual comparison is. */
|
2003-02-26 04:05:40 +01:00
|
|
|
|
if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC || CC0_P (op0))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
return 0;
|
|
|
|
|
|
2000-02-06 11:56:56 +01:00
|
|
|
|
/* Make sure the constant is second. */
|
2004-01-19 22:51:06 +01:00
|
|
|
|
if (swap_commutative_operands_p (op0, op1))
|
2000-02-06 11:56:56 +01:00
|
|
|
|
{
|
|
|
|
|
tem = op0, op0 = op1, op1 = tem;
|
|
|
|
|
code = swap_condition (code);
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-19 22:51:06 +01:00
|
|
|
|
trueop0 = avoid_constant_pool_reference (op0);
|
|
|
|
|
trueop1 = avoid_constant_pool_reference (op1);
|
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
/* For integer comparisons of A and B maybe we can simplify A - B and can
|
|
|
|
|
then simplify a comparison of that with zero. If A and B are both either
|
|
|
|
|
a register or a CONST_INT, this can't help; testing for these cases will
|
|
|
|
|
prevent infinite recursion here and speed things up.
|
|
|
|
|
|
2006-08-11 09:44:45 +02:00
|
|
|
|
We can only do this for EQ and NE comparisons as otherwise we may
|
|
|
|
|
lose or introduce overflow which we cannot disregard as undefined as
|
|
|
|
|
we do not know the signedness of the operation on either the left or
|
|
|
|
|
the right hand side of the comparison. */
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2006-08-11 09:44:45 +02:00
|
|
|
|
if (INTEGRAL_MODE_P (mode) && trueop1 != const0_rtx
|
|
|
|
|
&& (code == EQ || code == NE)
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& ! ((REG_P (op0) || CONST_INT_P (trueop0))
|
|
|
|
|
&& (REG_P (op1) || CONST_INT_P (trueop1)))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
&& 0 != (tem = simplify_binary_operation (MINUS, mode, op0, op1))
|
2006-08-11 09:44:45 +02:00
|
|
|
|
/* We cannot do this if tem is a nonzero address. */
|
|
|
|
|
&& ! nonzero_address_p (tem))
|
2004-03-09 18:06:25 +01:00
|
|
|
|
return simplify_const_relational_operation (signed_condition (code),
|
|
|
|
|
mode, tem, const0_rtx);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2006-10-21 12:13:13 +02:00
|
|
|
|
if (! HONOR_NANS (mode) && code == ORDERED)
|
2001-01-07 14:40:09 +01:00
|
|
|
|
return const_true_rtx;
|
|
|
|
|
|
2006-10-21 12:13:13 +02:00
|
|
|
|
if (! HONOR_NANS (mode) && code == UNORDERED)
|
2001-01-07 14:40:09 +01:00
|
|
|
|
return const0_rtx;
|
|
|
|
|
|
defaults.h (MODE_HAS_NANS, [...]): New.
* defaults.h (MODE_HAS_NANS, MODE_HAS_INFINITIES): New.
(MODE_HAS_SIGNED_ZEROS, MODE_HAS_SIGN_DEPENDENT_ROUNDING): New.
* flags.h (HONOR_NANS, HONOR_INFINITIES, HONOR_SIGNED_ZEROS): New.
(HONOR_SIGN_DEPENDENT_ROUNDING): New.
* builtins.c (expand_builtin_mathfn): Use HONOR_NANS.
* c-common.c (truthvalue_conversion): Reduce x - y != 0 to x != y
unless x and y could be infinite.
(expand_unordered_cmp): New, mostly split from expand_tree_builtin.
Check that the common type of both arguments is a real, even for
targets without unordered comparisons. Allow an integer argument
to be compared against a real.
(expand_tree_builtin): Use expand_unordered_cmp.
* combine.c (combine_simplify_rtx): Use the new HONOR_... macros.
* cse.c (fold_rtx): Likewise. Fix indentation.
* fold-const.c (fold_real_zero_addition_p): New.
(fold): Use it, and the new HONOR_... macros.
* ifcvt.c (noce_try_minmax): Use the new HONOR_... macros.
* jump.c (reversed_comparison_code_parts): After searching for
the true comparison mode, use HONOR_NANS to decide whether it
can be safely reversed.
(reverse_condition_maybe_unordered): Remove IEEE check.
* simplify-rtx.c (simplify_binary_operation): Use the new macros
to decide which simplifications are valid. Allow the following
simplifications for IEEE: (-a + b) to (b - a), (a + -b) to (a - b),
and (a - -b) to (a + b).
(simplify_relational_operation): Use HONOR_NANS.
* doc/tm.texi: Document the MODE_HAS_... macros.
From-SVN: r50401
2002-03-07 12:37:16 +01:00
|
|
|
|
/* For modes without NaNs, if the two operands are equal, we know the
|
2007-09-27 13:29:10 +02:00
|
|
|
|
result except if they have side-effects. Even with NaNs we know
|
|
|
|
|
the result of unordered comparisons and, if signaling NaNs are
|
|
|
|
|
irrelevant, also the result of LT/GT/LTGT. */
|
|
|
|
|
if ((! HONOR_NANS (GET_MODE (trueop0))
|
|
|
|
|
|| code == UNEQ || code == UNLE || code == UNGE
|
|
|
|
|
|| ((code == LT || code == GT || code == LTGT)
|
|
|
|
|
&& ! HONOR_SNANS (GET_MODE (trueop0))))
|
2003-07-03 09:30:03 +02:00
|
|
|
|
&& rtx_equal_p (trueop0, trueop1)
|
|
|
|
|
&& ! side_effects_p (trueop0))
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return comparison_result (code, CMP_EQ);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
/* If the operands are floating-point constants, see if we can fold
|
|
|
|
|
the result. */
|
2007-09-27 13:29:10 +02:00
|
|
|
|
if (GET_CODE (trueop0) == CONST_DOUBLE
|
|
|
|
|
&& GET_CODE (trueop1) == CONST_DOUBLE
|
|
|
|
|
&& SCALAR_FLOAT_MODE_P (GET_MODE (trueop0)))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2002-03-25 21:52:28 +01:00
|
|
|
|
REAL_VALUE_TYPE d0, d1;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2002-03-25 21:52:28 +01:00
|
|
|
|
REAL_VALUE_FROM_CONST_DOUBLE (d0, trueop0);
|
|
|
|
|
REAL_VALUE_FROM_CONST_DOUBLE (d1, trueop1);
|
2001-01-05 16:34:39 +01:00
|
|
|
|
|
2002-04-30 22:48:55 +02:00
|
|
|
|
/* Comparisons are unordered iff at least one of the values is NaN. */
|
2002-03-25 21:52:28 +01:00
|
|
|
|
if (REAL_VALUE_ISNAN (d0) || REAL_VALUE_ISNAN (d1))
|
2001-01-05 16:34:39 +01:00
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case UNEQ:
|
|
|
|
|
case UNLT:
|
|
|
|
|
case UNGT:
|
|
|
|
|
case UNLE:
|
|
|
|
|
case UNGE:
|
|
|
|
|
case NE:
|
|
|
|
|
case UNORDERED:
|
|
|
|
|
return const_true_rtx;
|
|
|
|
|
case EQ:
|
|
|
|
|
case LT:
|
|
|
|
|
case GT:
|
|
|
|
|
case LE:
|
|
|
|
|
case GE:
|
|
|
|
|
case LTGT:
|
|
|
|
|
case ORDERED:
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
default:
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2007-09-27 13:29:10 +02:00
|
|
|
|
return comparison_result (code,
|
2007-10-01 17:14:29 +02:00
|
|
|
|
(REAL_VALUES_EQUAL (d0, d1) ? CMP_EQ :
|
|
|
|
|
REAL_VALUES_LESS (d0, d1) ? CMP_LT : CMP_GT));
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Otherwise, see if the operands are both integers. */
|
2007-09-27 13:29:10 +02:00
|
|
|
|
if ((GET_MODE_CLASS (mode) == MODE_INT || mode == VOIDmode)
|
|
|
|
|
&& (GET_CODE (trueop0) == CONST_DOUBLE
|
2009-06-22 12:29:13 +02:00
|
|
|
|
|| CONST_INT_P (trueop0))
|
2007-09-27 13:29:10 +02:00
|
|
|
|
&& (GET_CODE (trueop1) == CONST_DOUBLE
|
2009-06-22 12:29:13 +02:00
|
|
|
|
|| CONST_INT_P (trueop1)))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
|
|
|
|
int width = GET_MODE_BITSIZE (mode);
|
|
|
|
|
HOST_WIDE_INT l0s, h0s, l1s, h1s;
|
|
|
|
|
unsigned HOST_WIDE_INT l0u, h0u, l1u, h1u;
|
|
|
|
|
|
|
|
|
|
/* Get the two words comprising each integer constant. */
|
2001-07-17 17:11:56 +02:00
|
|
|
|
if (GET_CODE (trueop0) == CONST_DOUBLE)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2001-07-17 17:11:56 +02:00
|
|
|
|
l0u = l0s = CONST_DOUBLE_LOW (trueop0);
|
|
|
|
|
h0u = h0s = CONST_DOUBLE_HIGH (trueop0);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2001-07-17 17:11:56 +02:00
|
|
|
|
l0u = l0s = INTVAL (trueop0);
|
2000-05-24 22:26:54 +02:00
|
|
|
|
h0u = h0s = HWI_SIGN_EXTEND (l0s);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
2002-05-09 14:02:29 +02:00
|
|
|
|
|
2001-07-17 17:11:56 +02:00
|
|
|
|
if (GET_CODE (trueop1) == CONST_DOUBLE)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2001-07-17 17:11:56 +02:00
|
|
|
|
l1u = l1s = CONST_DOUBLE_LOW (trueop1);
|
|
|
|
|
h1u = h1s = CONST_DOUBLE_HIGH (trueop1);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2001-07-17 17:11:56 +02:00
|
|
|
|
l1u = l1s = INTVAL (trueop1);
|
2000-05-24 22:26:54 +02:00
|
|
|
|
h1u = h1s = HWI_SIGN_EXTEND (l1s);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If WIDTH is nonzero and smaller than HOST_BITS_PER_WIDE_INT,
|
|
|
|
|
we have to sign or zero-extend the values. */
|
|
|
|
|
if (width != 0 && width < HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
|
|
|
|
l0u &= ((HOST_WIDE_INT) 1 << width) - 1;
|
|
|
|
|
l1u &= ((HOST_WIDE_INT) 1 << width) - 1;
|
|
|
|
|
|
|
|
|
|
if (l0s & ((HOST_WIDE_INT) 1 << (width - 1)))
|
|
|
|
|
l0s |= ((HOST_WIDE_INT) (-1) << width);
|
|
|
|
|
|
|
|
|
|
if (l1s & ((HOST_WIDE_INT) 1 << (width - 1)))
|
|
|
|
|
l1s |= ((HOST_WIDE_INT) (-1) << width);
|
|
|
|
|
}
|
2000-10-26 01:02:14 +02:00
|
|
|
|
if (width != 0 && width <= HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
h0u = h1u = 0, h0s = HWI_SIGN_EXTEND (l0s), h1s = HWI_SIGN_EXTEND (l1s);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
2007-09-27 13:29:10 +02:00
|
|
|
|
if (h0u == h1u && l0u == l1u)
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return comparison_result (code, CMP_EQ);
|
2007-09-27 13:29:10 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int cr;
|
2007-10-01 17:14:29 +02:00
|
|
|
|
cr = (h0s < h1s || (h0s == h1s && l0u < l1u)) ? CMP_LT : CMP_GT;
|
|
|
|
|
cr |= (h0u < h1u || (h0u == h1u && l0u < l1u)) ? CMP_LTU : CMP_GTU;
|
|
|
|
|
return comparison_result (code, cr);
|
2007-09-27 13:29:10 +02:00
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-09-27 13:29:10 +02:00
|
|
|
|
/* Optimize comparisons with upper and lower bounds. */
|
|
|
|
|
if (SCALAR_INT_MODE_P (mode)
|
|
|
|
|
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (trueop1))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2007-09-27 13:29:10 +02:00
|
|
|
|
int sign;
|
|
|
|
|
unsigned HOST_WIDE_INT nonzero = nonzero_bits (trueop0, mode);
|
|
|
|
|
HOST_WIDE_INT val = INTVAL (trueop1);
|
|
|
|
|
HOST_WIDE_INT mmin, mmax;
|
|
|
|
|
|
|
|
|
|
if (code == GEU
|
|
|
|
|
|| code == LEU
|
|
|
|
|
|| code == GTU
|
|
|
|
|
|| code == LTU)
|
|
|
|
|
sign = 0;
|
|
|
|
|
else
|
|
|
|
|
sign = 1;
|
Multiple fixes: PRs 14692, 15274 and 15463
PR c++/15463
* loop-iv.c (iv_number_of_iterations): Use trunc_int_for_mode on
result of inverse.
PR rtl-optimization/15274
* loop-iv.c (determine_max_iter, shorten_into_mode,
iv_number_of_iterations): Handle constants correctly.
* rtl.h (get_mode_bounds): Declaration changed.
* stor-layout.c (get_mode_bounds): Return a constant suitable for
the target mode.
PR rtl-optimization/14692
* loop-unswitch.c (may_unswitch_on): Try folding the result.
(unswitch_single_loop): Work correctly when may_unswitch_on
returns a folded constant.
* loop-iv.c (implies_p): Handle A < B ==> A + 1 <= B.
* simplify-rtx.c (simplify_const_relational_operation): Optimize
comparisons with mode bounds.
* function.c (struct temp_slot): Add new field prev.
(free_after_compilation, init_temp_slots): Free new fields.
(cut_slot_from_list, insert_slot_to_list,
temp_slots_at_level, max_slot_level, move_slot_to_level,
make_slot_available): New functions.
(assign_stack_temp_for_type, combine_temp_slots,
find_temp_slot_from_address, preserve_temp_slots,
preserve_rtl_expr_result, free_temp_slots,
free_temps_for_rtl_expr, pop_temp_slots): Work with
the new structure of lists.
(mark_all_temps_used): Removed.
* function.h (struct function): Field x_temp_slots
replaced by x_used_temp_slots and x_avail_temp_slots.
(temp_slots): Replaced by ...
(used_temp_slots, avail_temp_slots): New.
* tree.h (mark_all_temps_used): Declaration removed.
* loop-iv.c (mark_single_set, get_biv_step_1, iv_analyze,
simplify_using_assignment): Take the expression out of
the expr_list wrapper.
* loop-iv.c (iv_number_of_iterations): Improve clasification of
infinite loops.
From-SVN: r82028
2004-05-19 19:53:45 +02:00
|
|
|
|
|
2007-09-27 13:29:10 +02:00
|
|
|
|
/* Get a reduced range if the sign bit is zero. */
|
|
|
|
|
if (nonzero <= (GET_MODE_MASK (mode) >> 1))
|
|
|
|
|
{
|
|
|
|
|
mmin = 0;
|
|
|
|
|
mmax = nonzero;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rtx mmin_rtx, mmax_rtx;
|
2007-10-01 17:14:29 +02:00
|
|
|
|
get_mode_bounds (mode, sign, mode, &mmin_rtx, &mmax_rtx);
|
2007-09-27 13:29:10 +02:00
|
|
|
|
|
2007-12-18 01:13:29 +01:00
|
|
|
|
mmin = INTVAL (mmin_rtx);
|
|
|
|
|
mmax = INTVAL (mmax_rtx);
|
|
|
|
|
if (sign)
|
|
|
|
|
{
|
|
|
|
|
unsigned int sign_copies = num_sign_bit_copies (trueop0, mode);
|
|
|
|
|
|
|
|
|
|
mmin >>= (sign_copies - 1);
|
|
|
|
|
mmax >>= (sign_copies - 1);
|
|
|
|
|
}
|
Multiple fixes: PRs 14692, 15274 and 15463
PR c++/15463
* loop-iv.c (iv_number_of_iterations): Use trunc_int_for_mode on
result of inverse.
PR rtl-optimization/15274
* loop-iv.c (determine_max_iter, shorten_into_mode,
iv_number_of_iterations): Handle constants correctly.
* rtl.h (get_mode_bounds): Declaration changed.
* stor-layout.c (get_mode_bounds): Return a constant suitable for
the target mode.
PR rtl-optimization/14692
* loop-unswitch.c (may_unswitch_on): Try folding the result.
(unswitch_single_loop): Work correctly when may_unswitch_on
returns a folded constant.
* loop-iv.c (implies_p): Handle A < B ==> A + 1 <= B.
* simplify-rtx.c (simplify_const_relational_operation): Optimize
comparisons with mode bounds.
* function.c (struct temp_slot): Add new field prev.
(free_after_compilation, init_temp_slots): Free new fields.
(cut_slot_from_list, insert_slot_to_list,
temp_slots_at_level, max_slot_level, move_slot_to_level,
make_slot_available): New functions.
(assign_stack_temp_for_type, combine_temp_slots,
find_temp_slot_from_address, preserve_temp_slots,
preserve_rtl_expr_result, free_temp_slots,
free_temps_for_rtl_expr, pop_temp_slots): Work with
the new structure of lists.
(mark_all_temps_used): Removed.
* function.h (struct function): Field x_temp_slots
replaced by x_used_temp_slots and x_avail_temp_slots.
(temp_slots): Replaced by ...
(used_temp_slots, avail_temp_slots): New.
* tree.h (mark_all_temps_used): Declaration removed.
* loop-iv.c (mark_single_set, get_biv_step_1, iv_analyze,
simplify_using_assignment): Take the expression out of
the expr_list wrapper.
* loop-iv.c (iv_number_of_iterations): Improve clasification of
infinite loops.
From-SVN: r82028
2004-05-19 19:53:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
switch (code)
|
|
|
|
|
{
|
2007-09-27 13:29:10 +02:00
|
|
|
|
/* x >= y is always true for y <= mmin, always false for y > mmax. */
|
|
|
|
|
case GEU:
|
|
|
|
|
if ((unsigned HOST_WIDE_INT) val <= (unsigned HOST_WIDE_INT) mmin)
|
|
|
|
|
return const_true_rtx;
|
|
|
|
|
if ((unsigned HOST_WIDE_INT) val > (unsigned HOST_WIDE_INT) mmax)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
break;
|
|
|
|
|
case GE:
|
|
|
|
|
if (val <= mmin)
|
|
|
|
|
return const_true_rtx;
|
|
|
|
|
if (val > mmax)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* x <= y is always true for y >= mmax, always false for y < mmin. */
|
|
|
|
|
case LEU:
|
|
|
|
|
if ((unsigned HOST_WIDE_INT) val >= (unsigned HOST_WIDE_INT) mmax)
|
|
|
|
|
return const_true_rtx;
|
|
|
|
|
if ((unsigned HOST_WIDE_INT) val < (unsigned HOST_WIDE_INT) mmin)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
break;
|
|
|
|
|
case LE:
|
|
|
|
|
if (val >= mmax)
|
|
|
|
|
return const_true_rtx;
|
|
|
|
|
if (val < mmin)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
break;
|
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
case EQ:
|
2007-09-27 13:29:10 +02:00
|
|
|
|
/* x == y is always false for y out of range. */
|
|
|
|
|
if (val < mmin || val > mmax)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* x > y is always false for y >= mmax, always true for y < mmin. */
|
|
|
|
|
case GTU:
|
|
|
|
|
if ((unsigned HOST_WIDE_INT) val >= (unsigned HOST_WIDE_INT) mmax)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
if ((unsigned HOST_WIDE_INT) val < (unsigned HOST_WIDE_INT) mmin)
|
|
|
|
|
return const_true_rtx;
|
|
|
|
|
break;
|
|
|
|
|
case GT:
|
|
|
|
|
if (val >= mmax)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
if (val < mmin)
|
|
|
|
|
return const_true_rtx;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* x < y is always false for y <= mmin, always true for y > mmax. */
|
|
|
|
|
case LTU:
|
|
|
|
|
if ((unsigned HOST_WIDE_INT) val <= (unsigned HOST_WIDE_INT) mmin)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
if ((unsigned HOST_WIDE_INT) val > (unsigned HOST_WIDE_INT) mmax)
|
|
|
|
|
return const_true_rtx;
|
|
|
|
|
break;
|
|
|
|
|
case LT:
|
|
|
|
|
if (val <= mmin)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
return const0_rtx;
|
2007-09-27 13:29:10 +02:00
|
|
|
|
if (val > mmax)
|
|
|
|
|
return const_true_rtx;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NE:
|
2007-09-27 13:29:10 +02:00
|
|
|
|
/* x != y is always true for y out of range. */
|
|
|
|
|
if (val < mmin || val > mmax)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
return const_true_rtx;
|
|
|
|
|
break;
|
|
|
|
|
|
2007-09-27 13:29:10 +02:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Optimize integer comparisons with zero. */
|
|
|
|
|
if (trueop1 == const0_rtx)
|
|
|
|
|
{
|
|
|
|
|
/* Some addresses are known to be nonzero. We don't know
|
2007-10-01 17:14:29 +02:00
|
|
|
|
their sign, but equality comparisons are known. */
|
2007-09-27 13:29:10 +02:00
|
|
|
|
if (nonzero_address_p (trueop0))
|
2007-10-01 17:14:29 +02:00
|
|
|
|
{
|
2007-09-27 13:29:10 +02:00
|
|
|
|
if (code == EQ || code == LEU)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
if (code == NE || code == GTU)
|
|
|
|
|
return const_true_rtx;
|
2007-10-01 17:14:29 +02:00
|
|
|
|
}
|
2007-09-27 13:29:10 +02:00
|
|
|
|
|
|
|
|
|
/* See if the first operand is an IOR with a constant. If so, we
|
|
|
|
|
may be able to determine the result of this comparison. */
|
|
|
|
|
if (GET_CODE (op0) == IOR)
|
2007-10-01 17:14:29 +02:00
|
|
|
|
{
|
2007-09-27 13:29:10 +02:00
|
|
|
|
rtx inner_const = avoid_constant_pool_reference (XEXP (op0, 1));
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (inner_const) && inner_const != const0_rtx)
|
2007-09-27 13:29:10 +02:00
|
|
|
|
{
|
2007-10-01 17:14:29 +02:00
|
|
|
|
int sign_bitnum = GET_MODE_BITSIZE (mode) - 1;
|
|
|
|
|
int has_sign = (HOST_BITS_PER_WIDE_INT >= sign_bitnum
|
|
|
|
|
&& (INTVAL (inner_const)
|
|
|
|
|
& ((HOST_WIDE_INT) 1 << sign_bitnum)));
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case EQ:
|
2007-09-27 13:29:10 +02:00
|
|
|
|
case LEU:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return const0_rtx;
|
|
|
|
|
case NE:
|
2007-09-27 13:29:10 +02:00
|
|
|
|
case GTU:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
return const_true_rtx;
|
|
|
|
|
case LT:
|
|
|
|
|
case LE:
|
|
|
|
|
if (has_sign)
|
|
|
|
|
return const_true_rtx;
|
|
|
|
|
break;
|
|
|
|
|
case GT:
|
2007-09-27 13:29:10 +02:00
|
|
|
|
case GE:
|
2007-10-01 17:14:29 +02:00
|
|
|
|
if (has_sign)
|
|
|
|
|
return const0_rtx;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-27 13:29:10 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Optimize comparison of ABS with zero. */
|
|
|
|
|
if (trueop1 == CONST0_RTX (mode)
|
|
|
|
|
&& (GET_CODE (trueop0) == ABS
|
|
|
|
|
|| (GET_CODE (trueop0) == FLOAT_EXTEND
|
|
|
|
|
&& GET_CODE (XEXP (trueop0, 0)) == ABS)))
|
|
|
|
|
{
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
2002-07-21 00:24:58 +02:00
|
|
|
|
case LT:
|
|
|
|
|
/* Optimize abs(x) < 0.0. */
|
2007-09-27 13:29:10 +02:00
|
|
|
|
if (!HONOR_SNANS (mode)
|
2007-01-28 06:15:06 +01:00
|
|
|
|
&& (!INTEGRAL_MODE_P (mode)
|
|
|
|
|
|| (!flag_wrapv && !flag_trapv && flag_strict_overflow)))
|
2002-07-21 00:24:58 +02:00
|
|
|
|
{
|
2007-09-27 13:29:10 +02:00
|
|
|
|
if (INTEGRAL_MODE_P (mode)
|
|
|
|
|
&& (issue_strict_overflow_warning
|
|
|
|
|
(WARN_STRICT_OVERFLOW_CONDITIONAL)))
|
|
|
|
|
warning (OPT_Wstrict_overflow,
|
|
|
|
|
("assuming signed overflow does not occur when "
|
|
|
|
|
"assuming abs (x) < 0 is false"));
|
|
|
|
|
return const0_rtx;
|
2002-07-21 00:24:58 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GE:
|
|
|
|
|
/* Optimize abs(x) >= 0.0. */
|
2007-09-27 13:29:10 +02:00
|
|
|
|
if (!HONOR_NANS (mode)
|
2007-01-28 06:15:06 +01:00
|
|
|
|
&& (!INTEGRAL_MODE_P (mode)
|
|
|
|
|
|| (!flag_wrapv && !flag_trapv && flag_strict_overflow)))
|
2002-07-21 00:24:58 +02:00
|
|
|
|
{
|
2007-09-27 13:29:10 +02:00
|
|
|
|
if (INTEGRAL_MODE_P (mode)
|
|
|
|
|
&& (issue_strict_overflow_warning
|
|
|
|
|
(WARN_STRICT_OVERFLOW_CONDITIONAL)))
|
|
|
|
|
warning (OPT_Wstrict_overflow,
|
|
|
|
|
("assuming signed overflow does not occur when "
|
|
|
|
|
"assuming abs (x) >= 0 is true"));
|
|
|
|
|
return const_true_rtx;
|
2002-07-21 00:24:58 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2003-05-04 01:12:41 +02:00
|
|
|
|
case UNGE:
|
|
|
|
|
/* Optimize ! (abs(x) < 0.0). */
|
2007-09-27 13:29:10 +02:00
|
|
|
|
return const_true_rtx;
|
2003-07-06 14:35:56 +02:00
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-27 13:29:10 +02:00
|
|
|
|
return 0;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Simplify CODE, an operation with result mode MODE and three operands,
|
|
|
|
|
OP0, OP1, and OP2. OP0_MODE was the mode of OP0 before it became
|
|
|
|
|
a constant. Return 0 if no simplifications is possible. */
|
|
|
|
|
|
|
|
|
|
rtx
|
2003-07-06 14:35:56 +02:00
|
|
|
|
simplify_ternary_operation (enum rtx_code code, enum machine_mode mode,
|
|
|
|
|
enum machine_mode op0_mode, rtx op0, rtx op1,
|
|
|
|
|
rtx op2)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2000-04-18 20:14:10 +02:00
|
|
|
|
unsigned int width = GET_MODE_BITSIZE (mode);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
/* VOIDmode means "infinite" precision. */
|
|
|
|
|
if (width == 0)
|
|
|
|
|
width = HOST_BITS_PER_WIDE_INT;
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case SIGN_EXTRACT:
|
|
|
|
|
case ZERO_EXTRACT:
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op0)
|
|
|
|
|
&& CONST_INT_P (op1)
|
|
|
|
|
&& CONST_INT_P (op2)
|
2000-07-17 20:31:50 +02:00
|
|
|
|
&& ((unsigned) INTVAL (op1) + (unsigned) INTVAL (op2) <= width)
|
2000-05-04 23:15:05 +02:00
|
|
|
|
&& width <= (unsigned) HOST_BITS_PER_WIDE_INT)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
|
|
|
|
/* Extracting a bit-field from a constant */
|
|
|
|
|
HOST_WIDE_INT val = INTVAL (op0);
|
|
|
|
|
|
|
|
|
|
if (BITS_BIG_ENDIAN)
|
|
|
|
|
val >>= (GET_MODE_BITSIZE (op0_mode)
|
|
|
|
|
- INTVAL (op2) - INTVAL (op1));
|
|
|
|
|
else
|
|
|
|
|
val >>= INTVAL (op2);
|
|
|
|
|
|
|
|
|
|
if (HOST_BITS_PER_WIDE_INT != INTVAL (op1))
|
|
|
|
|
{
|
|
|
|
|
/* First zero-extend. */
|
|
|
|
|
val &= ((HOST_WIDE_INT) 1 << INTVAL (op1)) - 1;
|
|
|
|
|
/* If desired, propagate sign bit. */
|
|
|
|
|
if (code == SIGN_EXTRACT
|
|
|
|
|
&& (val & ((HOST_WIDE_INT) 1 << (INTVAL (op1) - 1))))
|
|
|
|
|
val |= ~ (((HOST_WIDE_INT) 1 << INTVAL (op1)) - 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Clear the bits that don't belong in our mode,
|
|
|
|
|
unless they and our sign bit are all one.
|
|
|
|
|
So we get either a reasonable negative value or a reasonable
|
|
|
|
|
unsigned value for this mode. */
|
|
|
|
|
if (width < HOST_BITS_PER_WIDE_INT
|
|
|
|
|
&& ((val & ((HOST_WIDE_INT) (-1) << (width - 1)))
|
|
|
|
|
!= ((HOST_WIDE_INT) (-1) << (width - 1))))
|
|
|
|
|
val &= ((HOST_WIDE_INT) 1 << width) - 1;
|
|
|
|
|
|
2004-11-20 02:44:25 +01:00
|
|
|
|
return gen_int_mode (val, mode);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IF_THEN_ELSE:
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op0))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
return op0 != const0_rtx ? op1 : op2;
|
|
|
|
|
|
2003-11-02 14:56:42 +01:00
|
|
|
|
/* Convert c ? a : a into "a". */
|
|
|
|
|
if (rtx_equal_p (op1, op2) && ! side_effects_p (op0))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
return op1;
|
2003-11-02 14:56:42 +01:00
|
|
|
|
|
|
|
|
|
/* Convert a != b ? a : b into "a". */
|
|
|
|
|
if (GET_CODE (op0) == NE
|
|
|
|
|
&& ! side_effects_p (op0)
|
|
|
|
|
&& ! HONOR_NANS (mode)
|
|
|
|
|
&& ! HONOR_SIGNED_ZEROS (mode)
|
|
|
|
|
&& ((rtx_equal_p (XEXP (op0, 0), op1)
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 1), op2))
|
|
|
|
|
|| (rtx_equal_p (XEXP (op0, 0), op2)
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 1), op1))))
|
|
|
|
|
return op1;
|
|
|
|
|
|
|
|
|
|
/* Convert a == b ? a : b into "b". */
|
|
|
|
|
if (GET_CODE (op0) == EQ
|
|
|
|
|
&& ! side_effects_p (op0)
|
|
|
|
|
&& ! HONOR_NANS (mode)
|
|
|
|
|
&& ! HONOR_SIGNED_ZEROS (mode)
|
|
|
|
|
&& ((rtx_equal_p (XEXP (op0, 0), op1)
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 1), op2))
|
|
|
|
|
|| (rtx_equal_p (XEXP (op0, 0), op2)
|
|
|
|
|
&& rtx_equal_p (XEXP (op0, 1), op1))))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
return op2;
|
2003-11-02 14:56:42 +01:00
|
|
|
|
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
if (COMPARISON_P (op0) && ! side_effects_p (op0))
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
2000-07-30 20:13:10 +02:00
|
|
|
|
enum machine_mode cmp_mode = (GET_MODE (XEXP (op0, 0)) == VOIDmode
|
|
|
|
|
? GET_MODE (XEXP (op0, 1))
|
|
|
|
|
: GET_MODE (XEXP (op0, 0)));
|
2001-01-24 22:43:11 +01:00
|
|
|
|
rtx temp;
|
2000-05-22 10:20:47 +02:00
|
|
|
|
|
|
|
|
|
/* Look for happy constants in op1 and op2. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op1) && CONST_INT_P (op2))
|
2000-05-22 10:20:47 +02:00
|
|
|
|
{
|
|
|
|
|
HOST_WIDE_INT t = INTVAL (op1);
|
|
|
|
|
HOST_WIDE_INT f = INTVAL (op2);
|
2002-05-09 14:02:29 +02:00
|
|
|
|
|
2000-05-22 10:20:47 +02:00
|
|
|
|
if (t == STORE_FLAG_VALUE && f == 0)
|
|
|
|
|
code = GET_CODE (op0);
|
2001-01-08 16:16:40 +01:00
|
|
|
|
else if (t == 0 && f == STORE_FLAG_VALUE)
|
|
|
|
|
{
|
|
|
|
|
enum rtx_code tmp;
|
|
|
|
|
tmp = reversed_comparison_code (op0, NULL_RTX);
|
|
|
|
|
if (tmp == UNKNOWN)
|
|
|
|
|
break;
|
|
|
|
|
code = tmp;
|
|
|
|
|
}
|
2000-05-22 10:20:47 +02:00
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
|
2004-05-01 11:36:55 +02:00
|
|
|
|
return simplify_gen_relational (code, mode, cmp_mode,
|
2004-04-29 09:50:55 +02:00
|
|
|
|
XEXP (op0, 0), XEXP (op0, 1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cmp_mode == VOIDmode)
|
|
|
|
|
cmp_mode = op0_mode;
|
|
|
|
|
temp = simplify_relational_operation (GET_CODE (op0), op0_mode,
|
|
|
|
|
cmp_mode, XEXP (op0, 0),
|
|
|
|
|
XEXP (op0, 1));
|
|
|
|
|
|
|
|
|
|
/* See if any simplifications were possible. */
|
|
|
|
|
if (temp)
|
|
|
|
|
{
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (temp))
|
2004-04-29 09:50:55 +02:00
|
|
|
|
return temp == const0_rtx ? op2 : op1;
|
|
|
|
|
else if (temp)
|
|
|
|
|
return gen_rtx_IF_THEN_ELSE (mode, temp, op1, op2);
|
2000-05-22 10:20:47 +02:00
|
|
|
|
}
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
2003-11-02 14:56:42 +01:00
|
|
|
|
|
2003-02-09 13:35:28 +01:00
|
|
|
|
case VEC_MERGE:
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (GET_MODE (op0) == mode);
|
|
|
|
|
gcc_assert (GET_MODE (op1) == mode);
|
|
|
|
|
gcc_assert (VECTOR_MODE_P (mode));
|
2003-02-09 13:35:28 +01:00
|
|
|
|
op2 = avoid_constant_pool_reference (op2);
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op2))
|
2003-02-09 13:35:28 +01:00
|
|
|
|
{
|
|
|
|
|
int elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode));
|
|
|
|
|
unsigned n_elts = (GET_MODE_SIZE (mode) / elt_size);
|
2003-04-05 22:06:37 +02:00
|
|
|
|
int mask = (1 << n_elts) - 1;
|
2003-02-09 13:35:28 +01:00
|
|
|
|
|
2003-02-09 23:55:35 +01:00
|
|
|
|
if (!(INTVAL (op2) & mask))
|
|
|
|
|
return op1;
|
|
|
|
|
if ((INTVAL (op2) & mask) == mask)
|
|
|
|
|
return op0;
|
|
|
|
|
|
|
|
|
|
op0 = avoid_constant_pool_reference (op0);
|
|
|
|
|
op1 = avoid_constant_pool_reference (op1);
|
|
|
|
|
if (GET_CODE (op0) == CONST_VECTOR
|
|
|
|
|
&& GET_CODE (op1) == CONST_VECTOR)
|
|
|
|
|
{
|
|
|
|
|
rtvec v = rtvec_alloc (n_elts);
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_elts; i++)
|
|
|
|
|
RTVEC_ELT (v, i) = (INTVAL (op2) & (1 << i)
|
|
|
|
|
? CONST_VECTOR_ELT (op0, i)
|
|
|
|
|
: CONST_VECTOR_ELT (op1, i));
|
|
|
|
|
return gen_rtx_CONST_VECTOR (mode, v);
|
|
|
|
|
}
|
2003-02-09 13:35:28 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
default:
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_unreachable ();
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
c-lex.c (interpret_fixed): Declare.
* c-lex.c (interpret_fixed): Declare.
(interpret_float): Process _Fract and _Accum.
(interpret_fixed): New function.
* final.c (output_addr_const): Process CONST_FIXED.
* simplify-rtx.c (simplify_const_unary_operation): Handle US_NEG.
(simplify_binary_operation_1): Handle US_ASHIFT, SS_MULT, US_MULT,
SS_DIV, US_DIV.
(simplify_const_binary_operation): Handle SS_MULT, US_MULT, SS_DIV,
US_DIV, US_ASHIFT.
(simplify_immed_subreg): Support CONST_FIXED.
Process MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.
(simplify_subreg): Support CONST_FIXED.
From-SVN: r127941
2007-08-31 01:09:28 +02:00
|
|
|
|
/* Evaluate a SUBREG of a CONST_INT or CONST_DOUBLE or CONST_FIXED
|
|
|
|
|
or CONST_VECTOR,
|
|
|
|
|
returning another CONST_INT or CONST_DOUBLE or CONST_FIXED or CONST_VECTOR.
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
Works by unpacking OP into a collection of 8-bit values
|
|
|
|
|
represented as a little-endian array of 'unsigned char', selecting by BYTE,
|
|
|
|
|
and then repacking them again for OUTERMODE. */
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
static rtx
|
|
|
|
|
simplify_immed_subreg (enum machine_mode outermode, rtx op,
|
|
|
|
|
enum machine_mode innermode, unsigned int byte)
|
|
|
|
|
{
|
|
|
|
|
/* We support up to 512-bit values (for V8DFmode). */
|
|
|
|
|
enum {
|
|
|
|
|
max_bitsize = 512,
|
|
|
|
|
value_bit = 8,
|
|
|
|
|
value_mask = (1 << value_bit) - 1
|
|
|
|
|
};
|
|
|
|
|
unsigned char value[max_bitsize / value_bit];
|
|
|
|
|
int value_start;
|
|
|
|
|
int i;
|
|
|
|
|
int elem;
|
|
|
|
|
|
|
|
|
|
int num_elem;
|
|
|
|
|
rtx * elems;
|
|
|
|
|
int elem_bitsize;
|
|
|
|
|
rtx result_s;
|
|
|
|
|
rtvec result_v = NULL;
|
|
|
|
|
enum mode_class outer_class;
|
|
|
|
|
enum machine_mode outer_submode;
|
|
|
|
|
|
|
|
|
|
/* Some ports misuse CCmode. */
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (GET_MODE_CLASS (outermode) == MODE_CC && CONST_INT_P (op))
|
2001-05-17 23:21:21 +02:00
|
|
|
|
return op;
|
|
|
|
|
|
2004-12-03 04:27:34 +01:00
|
|
|
|
/* We have no way to represent a complex constant at the rtl level. */
|
|
|
|
|
if (COMPLEX_MODE_P (outermode))
|
|
|
|
|
return NULL_RTX;
|
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
/* Unpack the value. */
|
|
|
|
|
|
2002-06-18 03:35:47 +02:00
|
|
|
|
if (GET_CODE (op) == CONST_VECTOR)
|
|
|
|
|
{
|
2004-01-06 23:51:00 +01:00
|
|
|
|
num_elem = CONST_VECTOR_NUNITS (op);
|
|
|
|
|
elems = &CONST_VECTOR_ELT (op, 0);
|
|
|
|
|
elem_bitsize = GET_MODE_BITSIZE (GET_MODE_INNER (innermode));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
num_elem = 1;
|
|
|
|
|
elems = &op;
|
|
|
|
|
elem_bitsize = max_bitsize;
|
|
|
|
|
}
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
/* If this asserts, it is too complicated; reducing value_bit may help. */
|
|
|
|
|
gcc_assert (BITS_PER_UNIT % value_bit == 0);
|
|
|
|
|
/* I don't know how to handle endianness of sub-units. */
|
|
|
|
|
gcc_assert (elem_bitsize % BITS_PER_UNIT == 0);
|
2004-01-06 23:51:00 +01:00
|
|
|
|
|
|
|
|
|
for (elem = 0; elem < num_elem; elem++)
|
|
|
|
|
{
|
|
|
|
|
unsigned char * vp;
|
|
|
|
|
rtx el = elems[elem];
|
|
|
|
|
|
|
|
|
|
/* Vectors are kept in target memory order. (This is probably
|
|
|
|
|
a mistake.) */
|
|
|
|
|
{
|
|
|
|
|
unsigned byte = (elem * elem_bitsize) / BITS_PER_UNIT;
|
|
|
|
|
unsigned ibyte = (((num_elem - 1 - elem) * elem_bitsize)
|
|
|
|
|
/ BITS_PER_UNIT);
|
|
|
|
|
unsigned word_byte = WORDS_BIG_ENDIAN ? ibyte : byte;
|
|
|
|
|
unsigned subword_byte = BYTES_BIG_ENDIAN ? ibyte : byte;
|
|
|
|
|
unsigned bytele = (subword_byte % UNITS_PER_WORD
|
|
|
|
|
+ (word_byte / UNITS_PER_WORD) * UNITS_PER_WORD);
|
|
|
|
|
vp = value + (bytele * BITS_PER_UNIT) / value_bit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (GET_CODE (el))
|
2002-07-03 11:49:46 +02:00
|
|
|
|
{
|
2004-01-06 23:51:00 +01:00
|
|
|
|
case CONST_INT:
|
|
|
|
|
for (i = 0;
|
|
|
|
|
i < HOST_BITS_PER_WIDE_INT && i < elem_bitsize;
|
|
|
|
|
i += value_bit)
|
|
|
|
|
*vp++ = INTVAL (el) >> i;
|
|
|
|
|
/* CONST_INTs are always logically sign-extended. */
|
|
|
|
|
for (; i < elem_bitsize; i += value_bit)
|
|
|
|
|
*vp++ = INTVAL (el) < 0 ? -1 : 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CONST_DOUBLE:
|
|
|
|
|
if (GET_MODE (el) == VOIDmode)
|
|
|
|
|
{
|
|
|
|
|
/* If this triggers, someone should have generated a
|
|
|
|
|
CONST_INT instead. */
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (elem_bitsize > HOST_BITS_PER_WIDE_INT);
|
2002-06-18 03:35:47 +02:00
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
for (i = 0; i < HOST_BITS_PER_WIDE_INT; i += value_bit)
|
|
|
|
|
*vp++ = CONST_DOUBLE_LOW (el) >> i;
|
|
|
|
|
while (i < HOST_BITS_PER_WIDE_INT * 2 && i < elem_bitsize)
|
|
|
|
|
{
|
2004-01-12 17:01:18 +01:00
|
|
|
|
*vp++
|
|
|
|
|
= CONST_DOUBLE_HIGH (el) >> (i - HOST_BITS_PER_WIDE_INT);
|
2004-01-06 23:51:00 +01:00
|
|
|
|
i += value_bit;
|
|
|
|
|
}
|
|
|
|
|
/* It shouldn't matter what's done here, so fill it with
|
|
|
|
|
zero. */
|
2005-08-21 15:27:56 +02:00
|
|
|
|
for (; i < elem_bitsize; i += value_bit)
|
2004-01-06 23:51:00 +01:00
|
|
|
|
*vp++ = 0;
|
|
|
|
|
}
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
else
|
2002-07-03 11:49:46 +02:00
|
|
|
|
{
|
2004-01-06 23:51:00 +01:00
|
|
|
|
long tmp[max_bitsize / 32];
|
|
|
|
|
int bitsize = GET_MODE_BITSIZE (GET_MODE (el));
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
|
2005-11-21 21:53:27 +01:00
|
|
|
|
gcc_assert (SCALAR_FLOAT_MODE_P (GET_MODE (el)));
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (bitsize <= elem_bitsize);
|
|
|
|
|
gcc_assert (bitsize % value_bit == 0);
|
2004-01-06 23:51:00 +01:00
|
|
|
|
|
|
|
|
|
real_to_target (tmp, CONST_DOUBLE_REAL_VALUE (el),
|
|
|
|
|
GET_MODE (el));
|
|
|
|
|
|
|
|
|
|
/* real_to_target produces its result in words affected by
|
|
|
|
|
FLOAT_WORDS_BIG_ENDIAN. However, we ignore this,
|
|
|
|
|
and use WORDS_BIG_ENDIAN instead; see the documentation
|
|
|
|
|
of SUBREG in rtl.texi. */
|
|
|
|
|
for (i = 0; i < bitsize; i += value_bit)
|
2002-07-12 01:53:01 +02:00
|
|
|
|
{
|
2004-01-06 23:51:00 +01:00
|
|
|
|
int ibase;
|
|
|
|
|
if (WORDS_BIG_ENDIAN)
|
|
|
|
|
ibase = bitsize - 1 - i;
|
|
|
|
|
else
|
|
|
|
|
ibase = i;
|
|
|
|
|
*vp++ = tmp[ibase / 32] >> i % 32;
|
2002-07-12 01:53:01 +02:00
|
|
|
|
}
|
2004-01-06 23:51:00 +01:00
|
|
|
|
|
|
|
|
|
/* It shouldn't matter what's done here, so fill it with
|
|
|
|
|
zero. */
|
|
|
|
|
for (; i < elem_bitsize; i += value_bit)
|
|
|
|
|
*vp++ = 0;
|
2002-07-03 11:49:46 +02:00
|
|
|
|
}
|
2004-01-06 23:51:00 +01:00
|
|
|
|
break;
|
c-lex.c (interpret_fixed): Declare.
* c-lex.c (interpret_fixed): Declare.
(interpret_float): Process _Fract and _Accum.
(interpret_fixed): New function.
* final.c (output_addr_const): Process CONST_FIXED.
* simplify-rtx.c (simplify_const_unary_operation): Handle US_NEG.
(simplify_binary_operation_1): Handle US_ASHIFT, SS_MULT, US_MULT,
SS_DIV, US_DIV.
(simplify_const_binary_operation): Handle SS_MULT, US_MULT, SS_DIV,
US_DIV, US_ASHIFT.
(simplify_immed_subreg): Support CONST_FIXED.
Process MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.
(simplify_subreg): Support CONST_FIXED.
From-SVN: r127941
2007-08-31 01:09:28 +02:00
|
|
|
|
|
|
|
|
|
case CONST_FIXED:
|
|
|
|
|
if (elem_bitsize <= HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
{
|
|
|
|
|
for (i = 0; i < elem_bitsize; i += value_bit)
|
|
|
|
|
*vp++ = CONST_FIXED_VALUE_LOW (el) >> i;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (i = 0; i < HOST_BITS_PER_WIDE_INT; i += value_bit)
|
|
|
|
|
*vp++ = CONST_FIXED_VALUE_LOW (el) >> i;
|
|
|
|
|
for (; i < 2 * HOST_BITS_PER_WIDE_INT && i < elem_bitsize;
|
|
|
|
|
i += value_bit)
|
|
|
|
|
*vp++ = CONST_FIXED_VALUE_HIGH (el)
|
|
|
|
|
>> (i - HOST_BITS_PER_WIDE_INT);
|
|
|
|
|
for (; i < elem_bitsize; i += value_bit)
|
|
|
|
|
*vp++ = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2004-01-06 23:51:00 +01:00
|
|
|
|
|
|
|
|
|
default:
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_unreachable ();
|
2002-07-12 01:53:01 +02:00
|
|
|
|
}
|
2002-06-18 03:35:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
/* Now, pick the right byte to start with. */
|
|
|
|
|
/* Renumber BYTE so that the least-significant byte is byte 0. A special
|
|
|
|
|
case is paradoxical SUBREGs, which shouldn't be adjusted since they
|
|
|
|
|
will already have offset 0. */
|
|
|
|
|
if (GET_MODE_SIZE (innermode) >= GET_MODE_SIZE (outermode))
|
2001-05-17 17:00:35 +02:00
|
|
|
|
{
|
2004-01-06 23:51:00 +01:00
|
|
|
|
unsigned ibyte = (GET_MODE_SIZE (innermode) - GET_MODE_SIZE (outermode)
|
|
|
|
|
- byte);
|
|
|
|
|
unsigned word_byte = WORDS_BIG_ENDIAN ? ibyte : byte;
|
|
|
|
|
unsigned subword_byte = BYTES_BIG_ENDIAN ? ibyte : byte;
|
|
|
|
|
byte = (subword_byte % UNITS_PER_WORD
|
|
|
|
|
+ (word_byte / UNITS_PER_WORD) * UNITS_PER_WORD);
|
|
|
|
|
}
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
/* BYTE should still be inside OP. (Note that BYTE is unsigned,
|
|
|
|
|
so if it's become negative it will instead be very large.) */
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (byte < GET_MODE_SIZE (innermode));
|
2002-07-04 08:38:56 +02:00
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
/* Convert from bytes to chunks of size value_bit. */
|
|
|
|
|
value_start = byte * (BITS_PER_UNIT / value_bit);
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
/* Re-pack the value. */
|
|
|
|
|
|
|
|
|
|
if (VECTOR_MODE_P (outermode))
|
|
|
|
|
{
|
|
|
|
|
num_elem = GET_MODE_NUNITS (outermode);
|
|
|
|
|
result_v = rtvec_alloc (num_elem);
|
|
|
|
|
elems = &RTVEC_ELT (result_v, 0);
|
|
|
|
|
outer_submode = GET_MODE_INNER (outermode);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
num_elem = 1;
|
|
|
|
|
elems = &result_s;
|
|
|
|
|
outer_submode = outermode;
|
|
|
|
|
}
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
outer_class = GET_MODE_CLASS (outer_submode);
|
|
|
|
|
elem_bitsize = GET_MODE_BITSIZE (outer_submode);
|
2002-07-23 22:06:46 +02:00
|
|
|
|
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (elem_bitsize % value_bit == 0);
|
|
|
|
|
gcc_assert (elem_bitsize + value_start * value_bit <= max_bitsize);
|
2002-07-23 22:06:46 +02:00
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
for (elem = 0; elem < num_elem; elem++)
|
|
|
|
|
{
|
|
|
|
|
unsigned char *vp;
|
|
|
|
|
|
|
|
|
|
/* Vectors are stored in target memory order. (This is probably
|
|
|
|
|
a mistake.) */
|
|
|
|
|
{
|
|
|
|
|
unsigned byte = (elem * elem_bitsize) / BITS_PER_UNIT;
|
|
|
|
|
unsigned ibyte = (((num_elem - 1 - elem) * elem_bitsize)
|
|
|
|
|
/ BITS_PER_UNIT);
|
|
|
|
|
unsigned word_byte = WORDS_BIG_ENDIAN ? ibyte : byte;
|
|
|
|
|
unsigned subword_byte = BYTES_BIG_ENDIAN ? ibyte : byte;
|
|
|
|
|
unsigned bytele = (subword_byte % UNITS_PER_WORD
|
|
|
|
|
+ (word_byte / UNITS_PER_WORD) * UNITS_PER_WORD);
|
|
|
|
|
vp = value + value_start + (bytele * BITS_PER_UNIT) / value_bit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (outer_class)
|
2001-05-17 17:00:35 +02:00
|
|
|
|
{
|
2004-01-06 23:51:00 +01:00
|
|
|
|
case MODE_INT:
|
|
|
|
|
case MODE_PARTIAL_INT:
|
|
|
|
|
{
|
|
|
|
|
unsigned HOST_WIDE_INT hi = 0, lo = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0;
|
|
|
|
|
i < HOST_BITS_PER_WIDE_INT && i < elem_bitsize;
|
|
|
|
|
i += value_bit)
|
|
|
|
|
lo |= (HOST_WIDE_INT)(*vp++ & value_mask) << i;
|
|
|
|
|
for (; i < elem_bitsize; i += value_bit)
|
|
|
|
|
hi |= ((HOST_WIDE_INT)(*vp++ & value_mask)
|
|
|
|
|
<< (i - HOST_BITS_PER_WIDE_INT));
|
|
|
|
|
|
|
|
|
|
/* immed_double_const doesn't call trunc_int_for_mode. I don't
|
|
|
|
|
know why. */
|
|
|
|
|
if (elem_bitsize <= HOST_BITS_PER_WIDE_INT)
|
|
|
|
|
elems[elem] = gen_int_mode (lo, outer_submode);
|
2005-09-26 20:16:07 +02:00
|
|
|
|
else if (elem_bitsize <= 2 * HOST_BITS_PER_WIDE_INT)
|
2004-01-06 23:51:00 +01:00
|
|
|
|
elems[elem] = immed_double_const (lo, hi, outer_submode);
|
2005-09-26 20:16:07 +02:00
|
|
|
|
else
|
|
|
|
|
return NULL_RTX;
|
2004-01-06 23:51:00 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MODE_FLOAT:
|
2005-12-18 22:40:47 +01:00
|
|
|
|
case MODE_DECIMAL_FLOAT:
|
2004-01-06 23:51:00 +01:00
|
|
|
|
{
|
|
|
|
|
REAL_VALUE_TYPE r;
|
|
|
|
|
long tmp[max_bitsize / 32];
|
|
|
|
|
|
|
|
|
|
/* real_from_target wants its input in words affected by
|
|
|
|
|
FLOAT_WORDS_BIG_ENDIAN. However, we ignore this,
|
|
|
|
|
and use WORDS_BIG_ENDIAN instead; see the documentation
|
|
|
|
|
of SUBREG in rtl.texi. */
|
|
|
|
|
for (i = 0; i < max_bitsize / 32; i++)
|
|
|
|
|
tmp[i] = 0;
|
|
|
|
|
for (i = 0; i < elem_bitsize; i += value_bit)
|
|
|
|
|
{
|
|
|
|
|
int ibase;
|
|
|
|
|
if (WORDS_BIG_ENDIAN)
|
|
|
|
|
ibase = elem_bitsize - 1 - i;
|
|
|
|
|
else
|
|
|
|
|
ibase = i;
|
2004-01-08 09:21:15 +01:00
|
|
|
|
tmp[ibase / 32] |= (*vp++ & value_mask) << i % 32;
|
2004-01-06 23:51:00 +01:00
|
|
|
|
}
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
real_from_target (&r, tmp, outer_submode);
|
|
|
|
|
elems[elem] = CONST_DOUBLE_FROM_REAL_VALUE (r, outer_submode);
|
|
|
|
|
}
|
|
|
|
|
break;
|
c-lex.c (interpret_fixed): Declare.
* c-lex.c (interpret_fixed): Declare.
(interpret_float): Process _Fract and _Accum.
(interpret_fixed): New function.
* final.c (output_addr_const): Process CONST_FIXED.
* simplify-rtx.c (simplify_const_unary_operation): Handle US_NEG.
(simplify_binary_operation_1): Handle US_ASHIFT, SS_MULT, US_MULT,
SS_DIV, US_DIV.
(simplify_const_binary_operation): Handle SS_MULT, US_MULT, SS_DIV,
US_DIV, US_ASHIFT.
(simplify_immed_subreg): Support CONST_FIXED.
Process MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.
(simplify_subreg): Support CONST_FIXED.
From-SVN: r127941
2007-08-31 01:09:28 +02:00
|
|
|
|
|
|
|
|
|
case MODE_FRACT:
|
|
|
|
|
case MODE_UFRACT:
|
|
|
|
|
case MODE_ACCUM:
|
|
|
|
|
case MODE_UACCUM:
|
|
|
|
|
{
|
|
|
|
|
FIXED_VALUE_TYPE f;
|
|
|
|
|
f.data.low = 0;
|
|
|
|
|
f.data.high = 0;
|
|
|
|
|
f.mode = outer_submode;
|
|
|
|
|
|
|
|
|
|
for (i = 0;
|
|
|
|
|
i < HOST_BITS_PER_WIDE_INT && i < elem_bitsize;
|
|
|
|
|
i += value_bit)
|
|
|
|
|
f.data.low |= (HOST_WIDE_INT)(*vp++ & value_mask) << i;
|
|
|
|
|
for (; i < elem_bitsize; i += value_bit)
|
|
|
|
|
f.data.high |= ((HOST_WIDE_INT)(*vp++ & value_mask)
|
|
|
|
|
<< (i - HOST_BITS_PER_WIDE_INT));
|
|
|
|
|
|
|
|
|
|
elems[elem] = CONST_FIXED_FROM_FIXED_VALUE (f, outer_submode);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2004-01-06 23:51:00 +01:00
|
|
|
|
|
|
|
|
|
default:
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_unreachable ();
|
2004-01-06 23:51:00 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (VECTOR_MODE_P (outermode))
|
|
|
|
|
return gen_rtx_CONST_VECTOR (outermode, result_v);
|
|
|
|
|
else
|
|
|
|
|
return result_s;
|
|
|
|
|
}
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
/* Simplify SUBREG:OUTERMODE(OP:INNERMODE, BYTE)
|
|
|
|
|
Return 0 if no simplifications are possible. */
|
|
|
|
|
rtx
|
|
|
|
|
simplify_subreg (enum machine_mode outermode, rtx op,
|
|
|
|
|
enum machine_mode innermode, unsigned int byte)
|
|
|
|
|
{
|
|
|
|
|
/* Little bit of sanity checking. */
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (innermode != VOIDmode);
|
|
|
|
|
gcc_assert (outermode != VOIDmode);
|
|
|
|
|
gcc_assert (innermode != BLKmode);
|
|
|
|
|
gcc_assert (outermode != BLKmode);
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert (GET_MODE (op) == innermode
|
|
|
|
|
|| GET_MODE (op) == VOIDmode);
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1,
live_out_1, prune_hardregs_for_mode, init_one_web_common,
reinit_one_web, add_subweb, add_subweb_2, init_web_parts,
record_conflict, compare_and_free_webs, init_webs_defs_uses,
parts_to_webs_1, parts_to_webs, reset_conflicts,
check_conflict_numbers, remember_web_was_spilled, handle_asm_insn,
ra_build_free): Use gcc_assert and gcc_unreachable instead of abort.
* ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end,
put_move, remove_move, combine, select_spill, colorize_one_web,
try_recolor_web, insert_coalesced_conflicts, check_colors,
break_precolored_alias, restore_conflicts_from_coalesce,
sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise.
* ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads,
reloads_to_loads, rewrite_program2, emit_colors): Likewise.
* ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra,
check_df): Likewise.
* real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc,
real_arithmetic, real_compare, real_exponent, real_ldexp,
real_identical, real_to_integer, real_to_integer2, real_to_decimal,
real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo,
real_digit, real_nan, real_maxval, round_for_format, real_convert,
real_to_target, real_from_target, real_hash, encode_ieee_single,
encode_ieee_double, encode_ieee_extended, encode_ieee_quad,
encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single,
encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise.
* recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok,
extract_insn, peep2_next_insn, peep2_reg_dead_p,
peep2_find_free_register, peephole2_optimize, store_data_bypass_p,
if_test_bypass_p): Likewise.
* reg-stack.c (record_label_references, get_asm_operand_n_inputs,
stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn,
emit_swap_insn, swap_to_top, move_for_stack_reg,
subst_stack_regs_pat, subst_asm_stack_regs, change_stack,
compensate_edge, convert_regs_1): Likewise.
* regclass.c (init_reg_sets, init_reg_sets_1,
memory_move_secondary_cost): Likewise.
* regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx):
Likewise.
* reload.c (push_secondary_reload, find_valid_class, push_reload,
operands_match_p, decompose, immune_p, find_reloads,
find_reloads_toplev, find_reloads_address_1, subst_reloads,
copy_replacements, refers_to_regno_for_reload_p,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload,
count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn,
verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use,
reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict,
choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns,
do_output_reload, fixup_abnormal_edges): Likewise.
* reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags,
fill_slots_from_thread, relax_delay_slots): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtl.c (copy_rtx, rtx_equal_p): Likewise.
* rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p,
dead_or_set_p, find_reg_fusage, remove_note, replace_rtx,
subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p,
find_first_parameter_load, can_hoist_insn_p, hoist_update_store,
hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sbitmap.c (sbitmap_difference): Likewise.
* sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2,
sched_analyze, add_forward_dependence): Likewise.
* sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise.
* sched-rgn.c (debug_regions, compute_trg_info, schedule_region,
schedule_insns): Likewise.
* sched-vis.c (print_pattern): Likewise.
* sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise.
* simplify-rtx.c (simplify_unary_operation, simplify_binary_operation,
simplify_const_relational_operation, simplify_ternary_operation,
simplify_immed_subreg, simplify_subreg, simplify_gen_subreg):
Likewise.
* sreal.c (copy, sreal_sub, sreal_div): Likewise.
* stmt.c (force_label_rtx, expand_goto, expand_asm_operands,
resolve_operand_name_1, expand_return, expand_decl,
expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise.
* stor-layout.c (put_pending_size, smallest_mode_for_size,
int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type,
set_sizetype, get_mode_bounds): Likewise.
From-SVN: r87244
2004-09-09 19:19:16 +02:00
|
|
|
|
gcc_assert ((byte % GET_MODE_SIZE (outermode)) == 0);
|
|
|
|
|
gcc_assert (byte < GET_MODE_SIZE (innermode));
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
2004-01-06 23:51:00 +01:00
|
|
|
|
if (outermode == innermode && !byte)
|
|
|
|
|
return op;
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
2009-06-22 12:29:13 +02:00
|
|
|
|
if (CONST_INT_P (op)
|
2004-01-06 23:51:00 +01:00
|
|
|
|
|| GET_CODE (op) == CONST_DOUBLE
|
c-lex.c (interpret_fixed): Declare.
* c-lex.c (interpret_fixed): Declare.
(interpret_float): Process _Fract and _Accum.
(interpret_fixed): New function.
* final.c (output_addr_const): Process CONST_FIXED.
* simplify-rtx.c (simplify_const_unary_operation): Handle US_NEG.
(simplify_binary_operation_1): Handle US_ASHIFT, SS_MULT, US_MULT,
SS_DIV, US_DIV.
(simplify_const_binary_operation): Handle SS_MULT, US_MULT, SS_DIV,
US_DIV, US_ASHIFT.
(simplify_immed_subreg): Support CONST_FIXED.
Process MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.
(simplify_subreg): Support CONST_FIXED.
From-SVN: r127941
2007-08-31 01:09:28 +02:00
|
|
|
|
|| GET_CODE (op) == CONST_FIXED
|
2004-01-06 23:51:00 +01:00
|
|
|
|
|| GET_CODE (op) == CONST_VECTOR)
|
|
|
|
|
return simplify_immed_subreg (outermode, op, innermode, byte);
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
|
|
|
|
/* Changing mode twice with SUBREG => just change it once,
|
|
|
|
|
or not at all if changing back op starting mode. */
|
|
|
|
|
if (GET_CODE (op) == SUBREG)
|
|
|
|
|
{
|
|
|
|
|
enum machine_mode innermostmode = GET_MODE (SUBREG_REG (op));
|
2001-06-04 20:44:57 +02:00
|
|
|
|
int final_offset = byte + SUBREG_BYTE (op);
|
2004-07-25 21:09:36 +02:00
|
|
|
|
rtx newx;
|
2001-05-17 17:00:35 +02:00
|
|
|
|
|
|
|
|
|
if (outermode == innermostmode
|
|
|
|
|
&& byte == 0 && SUBREG_BYTE (op) == 0)
|
|
|
|
|
return SUBREG_REG (op);
|
|
|
|
|
|
2001-06-04 20:44:57 +02:00
|
|
|
|
/* The SUBREG_BYTE represents offset, as if the value were stored
|
|
|
|
|
in memory. Irritating exception is paradoxical subreg, where
|
|
|
|
|
we define SUBREG_BYTE to be 0. On big endian machines, this
|
2001-08-17 23:23:12 +02:00
|
|
|
|
value should be negative. For a moment, undo this exception. */
|
2001-06-04 20:44:57 +02:00
|
|
|
|
if (byte == 0 && GET_MODE_SIZE (innermode) < GET_MODE_SIZE (outermode))
|
2001-05-17 17:00:35 +02:00
|
|
|
|
{
|
2001-06-04 20:44:57 +02:00
|
|
|
|
int difference = (GET_MODE_SIZE (innermode) - GET_MODE_SIZE (outermode));
|
|
|
|
|
if (WORDS_BIG_ENDIAN)
|
|
|
|
|
final_offset += (difference / UNITS_PER_WORD) * UNITS_PER_WORD;
|
|
|
|
|
if (BYTES_BIG_ENDIAN)
|
|
|
|
|
final_offset += difference % UNITS_PER_WORD;
|
|
|
|
|
}
|
|
|
|
|
if (SUBREG_BYTE (op) == 0
|
|
|
|
|
&& GET_MODE_SIZE (innermostmode) < GET_MODE_SIZE (innermode))
|
|
|
|
|
{
|
|
|
|
|
int difference = (GET_MODE_SIZE (innermostmode) - GET_MODE_SIZE (innermode));
|
|
|
|
|
if (WORDS_BIG_ENDIAN)
|
|
|
|
|
final_offset += (difference / UNITS_PER_WORD) * UNITS_PER_WORD;
|
|
|
|
|
if (BYTES_BIG_ENDIAN)
|
|
|
|
|
final_offset += difference % UNITS_PER_WORD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* See whether resulting subreg will be paradoxical. */
|
2001-06-08 14:02:24 +02:00
|
|
|
|
if (GET_MODE_SIZE (innermostmode) > GET_MODE_SIZE (outermode))
|
2001-06-04 20:44:57 +02:00
|
|
|
|
{
|
|
|
|
|
/* In nonparadoxical subregs we can't handle negative offsets. */
|
|
|
|
|
if (final_offset < 0)
|
|
|
|
|
return NULL_RTX;
|
|
|
|
|
/* Bail out in case resulting subreg would be incorrect. */
|
|
|
|
|
if (final_offset % GET_MODE_SIZE (outermode)
|
2001-07-10 12:38:10 +02:00
|
|
|
|
|| (unsigned) final_offset >= GET_MODE_SIZE (innermostmode))
|
|
|
|
|
return NULL_RTX;
|
2001-06-04 20:44:57 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int offset = 0;
|
|
|
|
|
int difference = (GET_MODE_SIZE (innermostmode) - GET_MODE_SIZE (outermode));
|
|
|
|
|
|
|
|
|
|
/* In paradoxical subreg, see if we are still looking on lower part.
|
|
|
|
|
If so, our SUBREG_BYTE will be 0. */
|
|
|
|
|
if (WORDS_BIG_ENDIAN)
|
|
|
|
|
offset += (difference / UNITS_PER_WORD) * UNITS_PER_WORD;
|
|
|
|
|
if (BYTES_BIG_ENDIAN)
|
|
|
|
|
offset += difference % UNITS_PER_WORD;
|
|
|
|
|
if (offset == final_offset)
|
|
|
|
|
final_offset = 0;
|
2001-05-17 17:00:35 +02:00
|
|
|
|
else
|
2001-07-10 12:38:10 +02:00
|
|
|
|
return NULL_RTX;
|
2001-05-17 17:00:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
2003-07-05 17:17:36 +02:00
|
|
|
|
/* Recurse for further possible simplifications. */
|
2004-11-24 01:09:03 +01:00
|
|
|
|
newx = simplify_subreg (outermode, SUBREG_REG (op), innermostmode,
|
|
|
|
|
final_offset);
|
2004-07-25 21:09:36 +02:00
|
|
|
|
if (newx)
|
|
|
|
|
return newx;
|
2004-11-24 01:09:03 +01:00
|
|
|
|
if (validate_subreg (outermode, innermostmode,
|
|
|
|
|
SUBREG_REG (op), final_offset))
|
2008-02-28 21:02:09 +01:00
|
|
|
|
{
|
|
|
|
|
newx = gen_rtx_SUBREG (outermode, SUBREG_REG (op), final_offset);
|
|
|
|
|
if (SUBREG_PROMOTED_VAR_P (op)
|
|
|
|
|
&& SUBREG_PROMOTED_UNSIGNED_P (op) >= 0
|
|
|
|
|
&& GET_MODE_CLASS (outermode) == MODE_INT
|
|
|
|
|
&& IN_RANGE (GET_MODE_SIZE (outermode),
|
|
|
|
|
GET_MODE_SIZE (innermode),
|
|
|
|
|
GET_MODE_SIZE (innermostmode))
|
|
|
|
|
&& subreg_lowpart_p (newx))
|
|
|
|
|
{
|
|
|
|
|
SUBREG_PROMOTED_VAR_P (newx) = 1;
|
|
|
|
|
SUBREG_PROMOTED_UNSIGNED_SET
|
|
|
|
|
(newx, SUBREG_PROMOTED_UNSIGNED_P (op));
|
|
|
|
|
}
|
|
|
|
|
return newx;
|
|
|
|
|
}
|
2004-11-24 01:09:03 +01:00
|
|
|
|
return NULL_RTX;
|
2001-05-17 17:00:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-14 18:45:55 +01:00
|
|
|
|
/* Merge implicit and explicit truncations. */
|
|
|
|
|
|
|
|
|
|
if (GET_CODE (op) == TRUNCATE
|
|
|
|
|
&& GET_MODE_SIZE (outermode) < GET_MODE_SIZE (innermode)
|
|
|
|
|
&& subreg_lowpart_offset (outermode, innermode) == byte)
|
|
|
|
|
return simplify_gen_unary (TRUNCATE, outermode, XEXP (op, 0),
|
|
|
|
|
GET_MODE (XEXP (op, 0)));
|
|
|
|
|
|
2001-05-17 17:00:35 +02:00
|
|
|
|
/* SUBREG of a hard register => just change the register number
|
|
|
|
|
and/or mode. If the hard register is not valid in that mode,
|
|
|
|
|
suppress this simplification. If the hard register is the stack,
|
|
|
|
|
frame, or argument pointer, leave this as a SUBREG. */
|
|
|
|
|
|
2008-08-28 22:02:54 +02:00
|
|
|
|
if (REG_P (op) && HARD_REGISTER_P (op))
|
2001-05-17 17:00:35 +02:00
|
|
|
|
{
|
2008-08-28 22:02:54 +02:00
|
|
|
|
unsigned int regno, final_regno;
|
|
|
|
|
|
|
|
|
|
regno = REGNO (op);
|
|
|
|
|
final_regno = simplify_subreg_regno (regno, innermode, byte, outermode);
|
|
|
|
|
if (HARD_REGISTER_NUM_P (final_regno))
|
2001-11-14 14:51:10 +01:00
|
|
|
|
{
|
2006-05-23 07:35:21 +02:00
|
|
|
|
rtx x;
|
|
|
|
|
int final_offset = byte;
|
|
|
|
|
|
|
|
|
|
/* Adjust offset for paradoxical subregs. */
|
|
|
|
|
if (byte == 0
|
|
|
|
|
&& GET_MODE_SIZE (innermode) < GET_MODE_SIZE (outermode))
|
|
|
|
|
{
|
|
|
|
|
int difference = (GET_MODE_SIZE (innermode)
|
|
|
|
|
- GET_MODE_SIZE (outermode));
|
|
|
|
|
if (WORDS_BIG_ENDIAN)
|
|
|
|
|
final_offset += (difference / UNITS_PER_WORD) * UNITS_PER_WORD;
|
|
|
|
|
if (BYTES_BIG_ENDIAN)
|
|
|
|
|
final_offset += difference % UNITS_PER_WORD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
x = gen_rtx_REG_offset (op, outermode, final_regno, final_offset);
|
2001-11-14 14:51:10 +01:00
|
|
|
|
|
|
|
|
|
/* Propagate original regno. We don't have any way to specify
|
2002-12-24 09:30:34 +01:00
|
|
|
|
the offset inside original regno, so do so only for lowpart.
|
2001-11-14 14:51:10 +01:00
|
|
|
|
The information is used only by alias analysis that can not
|
|
|
|
|
grog partial register anyway. */
|
|
|
|
|
|
|
|
|
|
if (subreg_lowpart_offset (outermode, innermode) == byte)
|
|
|
|
|
ORIGINAL_REGNO (x) = ORIGINAL_REGNO (op);
|
|
|
|
|
return x;
|
|
|
|
|
}
|
2001-05-17 17:00:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we have a SUBREG of a register that we are replacing and we are
|
|
|
|
|
replacing it with a MEM, make a new MEM and try replacing the
|
|
|
|
|
SUBREG with it. Don't do this if the MEM has a mode-dependent address
|
|
|
|
|
or if we would be widening it. */
|
|
|
|
|
|
alias.c (get_alias_set, [...]): Use MEM_P.
2004-07-01 Jerry Quinn <jlquinn@optonline.net>
* alias.c (get_alias_set, canon_rtx, get_addr,
nonoverlapping_memrefs_p, nonlocal_referenced_p_1, memory_modified_1):
Use MEM_P.
* builtins.c (expand_builtin_prefetch, expand_builtin_profile_func,
expand_builtin): Likewise.
* calls.c (expand_call, emit_library_call_value_1, store_one_arg):
Likewise.
* combine.c (can_combine_p, combinable_i3pat, try_combine,
find_split_point, combine_simplify_rtx, simplify_set, make_extraction,
rtx_equal_for_field_assignment_p, gen_lowpart_for_combine,
record_dead_and_set_regs_1, get_last_value_validate,
mark_used_regs_combine, move_deaths, unmentioned_reg_p_1): Likewise.
* cse.c (check_dependence, canon_hash, equiv_constant,
gen_lowpart_if_possible, cse_insn, invalidate_from_clobbers,
cse_around_loop, cse_check_loop_start, cse_set_around_loop,
count_reg_usage): Likewise.
* cselib.c (rtx_equal_for_cselib_p, add_mem_for_addr, cselib_lookup,
cselib_invalidate_mem, cselib_invalidate_rtx, cselib_record_set,
cselib_record_sets): Likewise.
* dbxout.c (PARM_PASSED_IN_MEMORY, dbxout_symbol,
dbxout_symbol_location, dbxout_parms, dbxout_reg_parms): Likewise.
* ddg.c (mark_mem_use, mark_mem_store, rtx_mem_access_p): Likewise.
* df.c (df_uses_record): Likewise.
* dojump (do_jump): Likewise.
* dwarf2out.c (stack_adjust_offset, mem_loc_descriptor,
loc_descriptor_from_tree, rtl_for_decl_location, add_bound_info,
decl_start_label): Likewise.
* emit-rtl.c (gen_complex_constant_part, gen_highpart,
operand_subword, change_address_1, make_safe_from): Likewise.
* explow.c (break_out_memory_refs, copy_all_regs, validize_mem,
stabilize, force_not_mem): Likewise.
* expmed.c (store_bit_field, store_split_bit_field, extract_bit_field,
expand_mult_const, expand_divmod, emit_store_flag): Likewise.
* expr.c (convert_move, convert_modes, emit_block_move,
emit_group_load, emit_group_store, clear_storage, emit_move_insn,
emit_move_insn_1, expand_assignment, store_expr,
store_constructor_field, store_constructor, store_field,
force_operand, safe_from_p, expand_expr_real_1, expand_increment):
Likewise.
* final.c (cleanup_subreg_operands, alter_subreg,
get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
init_propagate_block_info, insn_dead_p, mark_set_1, mark_used_regs):
Likewise.
* function.c (mark_temp_addr_taken, preserve_temp_slots,
preserve_rtl_expr_result, put_var_into_stack, fixup_var_refs_1,
optimize_bit_field, flush_addressof, purge_addressof_1,
instantiate_decl, instantiate_virtual_regs_1, assign_parms,
setjmp_protect, setjmp_protect_args, fix_lexical_addr,
keep_stack_depressed): Likewise.
* ifcvt.c (noce_try_cmove_arith, noce_try_abs, noce_operand_ok,
noce_process_if_block, find_memory): Likewise.
* integrate.c (subst_constants, allocate_initial_values): Likewise.
* local-alloc.c (validate_equiv_mem_from_store, memref_referenced_p,
update_equiv_regs): Likewise.
* loop.c (scan_loop, prescan_loop, note_addr_stored, check_store,
maybe_eliminate_biv_1, find_mem_in_note_1): Likewise.
* optabs.c (expand_abs, emit_unop_insn): Likewise.
* passes.c (rest_of_handle_final): Likewise.
* postreload.c (reload_cse_simplify_set, reload_cse_simplify_operands,
move2add_note_store): Likewise.
* ra-build.c (detect_remat_webs): Likewise.
* ra-debug.c (dump_static_insn_cost): Likewise.
* ra-rewrite.c (slots_overlap_p, insert_stores): Likewise.
* recog.c (validate_change, apply_change_group, cancel_changes,
validate_replace_rtx_1, general_operand, register_operand,
nonmemory_operand, push_operand, pop_operand, memory_operand,
indirect_operand, asm_operand_ok, offsettable_memref_p,
offsettable_nonstrict_memref_p, constrain_operands,
store_data_bypass_p): Likewise.
* reg-stack.c (subst_stack_regs_pat): Likewise.
* regclass.c (record_operand_costs, scan_one_insn, record_reg_classes,
copy_cost, reg_scan_mark_refs): Likewise.
* regmove.c (optimize_reg_copy_3, stack_memref_p,
combine_stack_adjustments_for_block): Likewise.
* regrename.c (copyprop_hardreg_forward_1): Likewise.
* reload.c (can_reload_into, push_reload, decompose, immune_p,
find_reloads, find_reloads_address, find_reloads_address_1,
reg_overlap_mentioned_for_reload_p, refers_to_mem_for_reload_p,
find_equiv_reg): Likewise.
* reload1.c (reload, eliminate_regs, eliminate_regs_in_insn,
reload_as_needed, choose_reload_regs, emit_input_reload_insns,
do_input_reload, emit_reload_insns, gen_reload, delete_output_reload,
delete_address_reloads): Likewise.
* resource.c (mark_referenced_resources): Likewise.
* rtlanal.c (get_jump_table_offset, count_occurrences,
reg_referenced_p, reg_set_p, set_of_1, set_noop_p,
reg_overlap_mentioned_p, note_uses, replace_regs, nonzero_bits1,
num_sign_bit_copies1): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* sched-deps.c (sched_analyze_1, sched_analyze_2): Likewise.
* sdbout.c (PARM_PASSED_IN_MEMORY, sdbout_symbol,
sdbout_toplevel_data, sdbout_parms, sdbout_reg_parms,
sdbout_global_decl): Likewise.
* simplify-rtx.c (simplify_subreg): Likewise.
* stmt.c (expand_asm_operands, expand_expr_stmt_value, expand_decl,
expand_anon_union_decl, expand_end_case_type): Likewise.
* unroll.c (calculate_giv_inc): Likewise.
* var-tracking.c (stack_adjust_offset_pre_post,
bb_stack_adjust_offset, track_expr_p, count_uses, add_uses,
add_stores, compute_bb_dataflow, vt_get_decl_and_offset,
vt_add_function_parameters): Likewise.
* varasm.c (make_var_volatile, notice_global_symbol,
assemble_external, decode_addr_const, mark_weak,
default_encode_section_info): Likewise.
From-SVN: r83980
2004-07-01 14:52:53 +02:00
|
|
|
|
if (MEM_P (op)
|
2001-05-17 17:00:35 +02:00
|
|
|
|
&& ! mode_dependent_address_p (XEXP (op, 0))
|
2001-06-12 17:25:16 +02:00
|
|
|
|
/* Allow splitting of volatile memory references in case we don't
|
|
|
|
|
have instruction to move the whole thing. */
|
|
|
|
|
&& (! MEM_VOLATILE_P (op)
|
optabs.h (OTI_flodiv, [...]): Kill.
* optabs.h (OTI_flodiv, flodiv_optab): Kill.
* genopinit.c: Put floating point divide insns in sdiv_optab.
* expr.c (expand_expr): Use sdiv_optab, not flodiv_optab.
* config/gofast.h, config/c4x/c4x.h,
config/ia64/hpux_longdouble.h, config/mips/mips.h,
config/pa/long_double.h, config/rs6000/sysv4.h,
config/sparc/sparc.h: Put floating point divide libcalls in sdiv_optab.
* optabs.c (init_optab): Break into new_optab, init_optab, init_optabv.
(init_optabs): Use init_optabv for overflow-trapping optabs.
Don't init flodiv_optab. Give mov_optab, movstrict_optab, and
cmp_optab RTX codes so have_insn_for can find them.
* optabs.c (expand_simple_binop, expand_simple_unop,
have_insn_for, gen_sub3_insn): New interfaces.
* expr.h: Prototype new functions.
(enum optab_methods): Move here from optabs.h.
* builtins.c, combine.c, doloop.c, function.c, ifcvt.c,
loop.c, profile.c, simplify-rtx.c, stmt.c, unroll.c:
Use new functions instead of working directly with optabs.
* doloop.c, ifcvt.c, loop.c, profile.c, simplify-rtx.c,
unroll.c: Don't include optabs.h.
* caller-save.c, combine.c, function.c, stmt.c: Just include
insn-codes.h, not optabs.h.
* Makefile.in: Update dependencies.
* combine.c (make_compound_operation, simplify_comparison):
Fix typos testing for this or that instruction.
From-SVN: r45008
2001-08-18 21:59:46 +02:00
|
|
|
|
|| ! have_insn_for (SET, innermode))
|
2001-05-17 17:00:35 +02:00
|
|
|
|
&& GET_MODE_SIZE (outermode) <= GET_MODE_SIZE (GET_MODE (op)))
|
[multiple changes]
Mon Jul 9 06:41:07 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* emit-rtl.c (adjust_address_nv, replace_equiv_address_nv): New fcns.
(operand_subword): Use them.
(change_address_1): Renamed from change_address; new arg VALIDATE.
* expr.h: Reflect above changes; change_address now macro.
* alias.c (canon_rtx): Use replace_equiv_address_nv instead of
making MEM.
* cselib.c (add_mem_for_addr): Likewise.
* expr.c (protect_from_queue, emit_move_insn_1): Likewise.
* regmove.c (try_apply_stack_adjustment): Likewise.
* reload.c (push_reload, make_memloc): Likewise.
* reload1.c (eliminate_regs): Likewise.
* simplify-rtx.c (simplify_replace_rtx): Likewise.
* caller-save.c (setup_save_areas): Use adjust_address_nv instead of
adjust_addess.
* combine.c (make_extraction, simplify_shift_const): Likewise.
(gen_lowpart_for_combine): Likewise.
* cse.c (gen_lowpart_if_possible): Likewise.
* function.c (fixup_var_refs_1, purge_addressof_1): Likewise.
* expr.c (expand_expr, case COMPONENT_REF): Likewise.
* optabs.c (gen_move_insn): Likewise.
* reload1.c (alter_reg): Likewise.
* simplify-rtx.c (simplify_subreg): Likewise.
* stmt.c (expand_anon_union_decl): Likewise.
* recog.c (validate_replace_rtx_1): Likewise.
(expr.h): Include.
* Makefile.in (recog.o): Add $(EXPR_H).
* explow.c (stabilize): Call replace_equiv_address.
* expr.c (move_by_pieces_1, store_by_pieces_2): Likewise.
* final.c (alter_subreg): OFFSET is HOST_WIDE_INT.
2001-07-09 Bo Thorsen <bo@suse.co.uk>
* config/i386/unix.h (ASM_OUTPUT_MI_THUNK): Fix x86-64 vtable support.
2001-07-09 Neil Booth <neil@daikokuya.demon.co.uk>
* final.c (output_addr_const): Use target opening and
closing parentheses.
* target-def.h: Define TARGET_ASM_OPEN_PAREN, TARGET_ASM_CLOSE_PAREN
defaults, add to TARGET_ASM_OUT.
* target.h (struct gcc_target): Add open_paren and close_paren.
* doc/md.texi: Update.
* doc/tm.texi: Document TARGET_ASM_FUNCTION_END_PROLOGUE,
TARGET_ASM_FUNCTION_BEGIN_EPILOGUE, TARGET_ASM_OPEN_PAREN and
TARGET_ASM_CLOSE_PAREN.
* config/i386/i386.c (TARGET_ASM_OPEN_PAREN, TARGET_ASM_CLOSE_PAREN):
Override.
* config/pdp11/pdp11.c (TARGET_ASM_OPEN_PAREN, TARGET_ASM_CLOSE_PAREN):
Override.
* config/1750a/1750a.h (ASM_OPEN_PAREN, ASM_CLOSE_PAREN): Remove.
* config/a29k/a29k.h: Similarly.
* config/alpha/alpha.h: Similarly.
* config/arc/arc.h: Similarly.
* config/arm/aof.h: Similarly.
* config/arm/aout.h: Similarly.
* config/avr/avr.h: Similarly.
* config/c4x/c4x.h: Similarly.
* config/clipper/clipper.h: Similarly.
* config/convex/convex.h: Similarly.
* config/d30v/d30v.h: Similarly.
* config/dsp16xx/dsp16xx.h: Similarly.
* config/elxsi/elxsi.h: Similarly.
* config/fr30/fr30.h: Similarly.
* config/h8300/h8300.h: Similarly.
* config/i370/i370.h: Similarly.
* config/i386/i386.h: Similarly.
* config/i860/i860.h: Similarly.
* config/i960/i960.h: Similarly.
* config/ia64/ia64.h: Similarly.
* config/m32r/m32r.h: Similarly.
* config/m68hc11/m68hc11.h: Similarly.
* config/m68k/m68k.h: Similarly.
* config/m88k/m88k.h: Similarly.
* config/mcore/mcore.h: Similarly.
* config/mips/mips.h: Similarly.
* config/mn10200/mn10200.h: Similarly.
* config/mn10300/mn10300.h: Similarly.
* config/ns32k/ns32k.h: Similarly.
* config/pa/pa.h: Similarly.
* config/pdp11/pdp11.h: Similarly.
* config/pj/pj.h: Similarly.
* config/romp/romp.h: Similarly.
* config/rs6000/rs6000.h: Similarly.
* config/sh/sh.h: Similarly.
* config/sparc/sparc.h: Similarly.
* config/v850/v850.h: Similarly.
* config/vax/vax.h: Similarly.
* config/we32k/we32k.h: Similarly.
2001-07-09 Joseph S. Myers <jsm28@cam.ac.uk>
* doc/c-tree.texi: Document representation of attributes.
2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
* doc/tm.texi: Update some places for the rename of target to
targetm. Fix typo.
2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
* target.h (struct gcc_target): Add insert_attributes.
* target-def.h (TARGET_INSERT_ATTRIBUTES): Define.
(TARGET_INITIALIZER): Update.
* tree.c, tree.h (default_insert_attributes): New function.
Update comments on other default functions to refer to targetm,
not target.
* doc/tm.texi (INSERT_ATTRIBUTES): Update to document
TARGET_INSERT_ATTRIBUTES.
(SET_DEFAULT_DECL_ATTRIBUTES): Remove.
* c-common.c (decl_attributes): Use targetm.insert_attributes.
Don't use PRAGMA_INSERT_ATTRIBUTES.
* Makefile.in (c-common.o): Depend on $(TARGET_H).
* c-decl.c (start_decl, start_function): Don't call
SET_DEFAULT_DECL_ATTRIBUTES.
* config/c4x/c4x.h (SET_DEFAULT_DECL_ATTRIBUTES): Don't define.
* config/c4x/c4x-protos.h (c4x_set_default_attributes): Don't
declare.
* config/c4x/c4x.c (TARGET_INSERT_ATTRIBUTES): Define.
(c4x_check_attribute): Avoid modifying attribute list itself.
(c4x_set_default_attributes): Rename to c4x_insert_attributes.
Make static.
* config/sh/sh.h (PRAGMA_INSERT_ATTRIBUTES): Don't define.
* config/sh/sh-protos.h (sh_pragma_insert_attributes): Don't
declare.
* config/sh/sh.c (TARGET_INSERT_ATTRIBUTES): Define.
(sh_pragma_insert_attributes): Rename to sh_insert_attributes.
Make static.
* config/v850/v850.h (SET_DEFAULT_DECL_ATTRIBUTES): Don't define.
* config/v850/v850-protos.h (v850_set_default_decl_attr): Don't
declare.
* config/v850/v850.c (TARGET_INSERT_ATTRIBUTES): Define.
(v850_set_default_decl_attr): Rename to v850_insert_attributes.
Adjust parameters. Make static.
2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.c (decl_attributes): Only take a single attributes
parameter.
* c-common.h (decl_attributes): Update prototype.
* c-decl.c (start_decl, start_function): Only take a single
attributes parameter. Update calls to decl_attributes.
(finish_struct, finish_enum): Update calls to decl_attributes.
(push_parm_decl): Expect unified list of attributes. Update call
to decl_attributes.
* c-parse.in (fndef, initdcl, notype_initdcl, nested_function,
notype_nested_function, component_declarator,
component_notype_declarator, label): Update calls to
decl_attributes.
(absdcl_maybe_attribute, parm, firstparm, myparm): Unify attribute
lists that are passed to push_parm_decl.
* c-tree.h (start_function, start_decl): Update prototypes.
* config/sh/sh-protos.h, config/sh/sh.c
(sh_pragma_insert_attributes): Only take a single attributes
parameter.
* config/sh/sh.h (PRAGMA_INSERT_ATTRIBUTES): Likewise.
* doc/tm.texi (INSERT_ATTRIBUTES): Update.
* objc/objc-act.c (define_decl, generate_objc_symtab_decl,
build_module_descriptor, generate_static_references,
generate_strings, build_selector_translation_table,
generate_descriptor_table, generate_protocols,
generate_ivars_list, generate_dispatch_table,
generate_protocol_list, generate_category,
generate_shared_structures, really_start_method, add_objc_decls,
generate_classref_translation_entry): Update calls to start_decl
and start_function.
(build_tmp_function_decl, start_method_def): Unify attribute lists
that are passed to push_parm_decl.
2001-07-08 Neil Booth <neil@daikokuya.demon.co.uk>
* final.c (no_asm_to_stream): New.
(final_scan_insn): Use target structures for prologue ends
and epilogue starts.
* output.h (no_asm_to_stream): New.
* target-def.h (TARGET_ASM_FUNCTION_END_PROLOGUE,
TARGET_ASM_FUNCTION_BEGIN_EPILOGUE): New.
(TARGET_ASM_OUT): Update.
* target.h (struct gcc_target): New members function_end_prologue
and function_begin_epilogue.
* config/1750/1750.h (ASM_OUTPUT_FUNNAM): Delete as unused.
* config/alpha/alpha-protos.h (output_end_prologue): Delete.
* config/alpha/alpha.c (output_end_prologue): Rename to
alpha_output_function_end_prologue. Use in target struct
and make static.
* config/alpha/alpha.h (FUNCTION_END_PROLOGUE): Delete.
* config/ia64/ia64-protos.h (ia64_output_end_prologue): Delete.
* config/ia64/ia64.c (ia64_output_end_prologue): Rename to
ia64_output_function_end_prologue. Use in target struct
and make static.
(ia64_function_prologue, ia64_funciton_epilogue): Rename
mistyped prototypes.
* config/ia64/ia64.h (FUNCTION_END_PROLOGUE): Delete.
* config/m88k/m88k-protos.h (m88k_end_prologue, m88k_begin_epilogue):
Delete.
* config/m88k/m88k.c (m88k_end_prologue, m88k_begin_epilogue): Rename
an use in target struct, make static.
* config/ia64/ia64.h (FUNCTION_END_PROLOGUE, FUNCTION_BEGIN_EPILOGUE):
Delete.
2001-07-08 Richard Henderson <rth@redhat.com>
* stmt.c (emit_case_nodes): Convert modes properly in low+high test.
2001-07-08 Richard Henderson <rth@redhat.com>
* config/i386/i386.md: Remove constraints strings from define_split
and define_peephole2 patterns.
(eh_return_si, eh_return_di): Split eh_return_1 for modes.
(eh_return): Use them.
2001-07-08 Richard Henderson <rth@redhat.com>
* doc/tm.texi (Exception Handling): New subnode of Stack and Calling.
Document MD_FALLBACK_FRAME_STATE_FOR.
2001-07-07 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* config/m68hc11/m68hc11.c (m68hc11_initial_elimination_offset):
Take into account m68hc11_sp_correction for FRAME_POINTER_REGNUM
elimination.
* config/m68hc11/m68hc11.h (STARTING_FRAME_OFFSET): Use 0.
2001-07-07 Nick Clifton <nickc@cambridge.redhat.com>
* config/ia64/sysv4.h (ASM_OUTPUT_LABELREF): Append # to end
of the label inside NAME as opposed to just the end of NAME.
2001-07-07 Neil Booth <neil@daikokuya.demon.co.uk>
* config/alpha/alpha-protos.h (vms_valid_decl_attribute_p): Delete.
* config/alpha/alpha.c (alpha_init_machine_status,
alpha_mark_machine_status, alpha_free_machine_status): Delete.
(TARGET_VALID_DECL_ATTRIBUTE): Define for VMS.
(vms_valid_decl_attribute_p): Make static, conditionally compile.
* config/alpha/alpha.h (VALID_MACHINE_DECL_ATTRIBUTE): Delete.
2001-07-06 Stan Shebs <shebs@apple.com>
* target.h (targetm): Rename global from "target", so as not to
conflict with local variables.
* c-decl.c: Ditto.
* c-typeck.c: Ditto.
* final.c: Ditto.
* tree.c: Ditto.
* cp/decl.c: Ditto.
* cp/decl2.c: Ditto.
* cp/typeck.c: Ditto.
* 1750a/1750a.c: Ditto.
* a29k/a29k.c: Ditto.
* arc/arc.c: Ditto.
* arm/arm.c: Ditto.
* avr/avr.c: Ditto.
* clipper/clipper.c: Ditto.
* convex/convex.c: Ditto.
* d30v/d30v.c: Ditto.
* dsp16xx/dsp16xx.c: Ditto.
* elxsi/elxsi.c: Ditto.
* fr30/fr30.c: Ditto.
* h8300/h8300.c: Ditto.
* i370/i370.c: Ditto.
* i386/i386.c: Ditto.
* i860/i860.c: Ditto.
* i960/i960.c: Ditto.
* ia64/ia64.c: Ditto.
* m32r/m32r.c: Ditto.
* m68hc11/m68hc11.c: Ditto.
* m68k/m68k.c: Ditto.
* m88k/m88k.c: Ditto.
* mips/mips.c: Ditto.
* ns32k/ns32k.c: Ditto.
* pa/pa.c: Ditto.
* pdp11/pdp11.c: Ditto.
* romp/romp.c: Ditto.
* rs6000/rs6000.c: Ditto.
* sh/sh.c: Ditto.
* sparc/sparc.c: Ditto.
* vax/vax.c: Ditto.
* we32k/we32k.c: Ditto.
* doc/tm.texi: Update the manual to match.
2001-07-06 Richard Henderson <rth@redhat.com>
* except.h (MUST_USE_SJLJ_EXCEPTIONS): Examine the value of
DWARF2_UNWIND_INFO not just whether it is defined.
2001-07-06 Diego Novillo <dnovillo@redhat.com>
* combine.c (combine_simplify_rtx): Also recompute 'mode' if the
call to simplify_binary_operation returns a new pattern.
2001-07-06 Roman Lechtchinsky <rl@cs.tu-berlin.de>
* glimits.h (__SHRT_MAX__): New.
(SHRT_MIN, USHRT_MAX): Define in terms of SHRT_MAX.
(SHRT_MAX): Define in terms of __SHRT_MAX__.
2001-07-06 Jan van Male <jan.vanmale@fenk.wau.nl>
* alias.c (base_alias_check): Cast GET_MODE_UNIT_SIZE to int to
avoid warnings.
2001-07-06 Richard Henderson <rth@redhat.com>
* bitmap.c (bitmap_release_memory): Move adjacent to the
allocation functions.
(bitmap_first_set_bit, bitmap_last_set_bit): Streamline knowing
the implementation. Binary search for the set bit.
(bitmap_union_of_diff): Allocate the temporary on the stack
instead of using xmalloc.
2001-07-06 Richard Henderson <rth@redhat.com>
* genrecog.c (validate_pattern): Warn for constraints in
define_{expand,split,peephole2}. Remove strict_low_part
before looking up match_dup.
2001-07-06 DJ Delorie <dj@redhat.com>
* doc/gcc.texi (Makefile): Rename to be a more general purpose
chapter about various build hints and history. Add section
talking about the various types of native and cross builds.
2001-07-06 Neil Booth <neil@daikokuya.demon.co.uk>
* Makefile.in (final.o): Depend on target.h.
* final.c: Include target.h.
(default_function_pro_epilogue): New.
(final_start_function): Use target structure for function prologues.
(final_end_function): Use target structure for function epilogues.
* fold-const.c (real_hex_to_f): Constify s and p.
* output.h (default_function_pro_epilogue): New.
* real.h (real_hex_to_f): Update prototype.
* target-def.h (TARGET_ASM_FUNCTION_PROLOGUE,
TARGET_ASM_FUNCTION_EPILOGUE, TARGET_ASM_OUT): New.
(TARGET_INITIALIZER): Update.
* target.h (gcc_target): Add struct asm_out.
* doc/tm.texi: Update.
config:
Update each arch to use TARGET_ASM_FUNCTION_PROLOGUE and
TARGET_ASM_FUNCTION_EPILOGUE. Move macro code to functions
in cpu/cpu.c, or rename old functions consistently. Take
a HOST_WIDE INT not an int as the SIZE parameter. Remove now
redundant macros and prototypes. Make new functions static.
* 1750a/1750a.c: Similarly.
* 1750a/1750a.h: Similarly.
* a29k/a29k-protos.h: Similarly.
* a29k/a29k.c: Similarly.
* a29k/a29k.h: Similarly.
* arc/arc-protos.h: Similarly.
* arc/arc.c: Similarly.
* arc/arc.h: Similarly.
* arm/arm-protos.h: Similarly.
* arm/arm.c: Similarly.
* arm/arm.h: Similarly.
* avr/avr-protos.h: Similarly.
* avr/avr.c: Similarly.
* avr/avr.h: Similarly.
* clipper/clipper-protos.h: Similarly.
* clipper/clipper.c: Similarly.
* clipper/clipper.h: Similarly.
* convex/convex.c: Similarly.
* convex/convex.h: Similarly.
* d30v/d30v-protos.h: Similarly.
* d30v/d30v.c: Similarly.
* d30v/d30v.h: Similarly.
* d30v/d30v.md: Similarly.
* dsp16xx/dsp16xx-protos.h: Similarly.
* dsp16xx/dsp16xx.c: Similarly.
* dsp16xx/dsp16xx.h: Similarly.
* elxsi/elxsi.c: Similarly.
* elxsi/elxsi.h: Similarly.
* fr30/fr30.c: Similarly.
* fr30/fr30.md: Similarly.
* h8300/h8300-protos.h: Similarly.
* h8300/h8300.c: Similarly.
* h8300/h8300.h: Similarly.
* i370/i370-protos.h: Similarly.
* i370/i370.c: Similarly.
* i370/i370.h: Similarly.
* i386/i386.c: Similarly.
* i386/osf1elf.h: Similarly.
* i386/osfrose.h: Similarly.
* i860/i860-protos.h: Similarly.
* i860/i860.c: Similarly.
* i860/i860.h: Similarly.
* i960/i960-protos.h: Similarly.
* i960/i960.c: Similarly.
* i960/i960.h: Similarly.
* ia64/ia64-protos.h: Similarly.
* ia64/ia64.c: Similarly.
* ia64/ia64.h: Similarly.
* m32r/m32r-protos.h: Similarly.
* m32r/m32r.c: Similarly.
* m32r/m32r.h: Similarly.
* m68hc11/m68hc11-protos.h: Similarly.
* m68hc11/m68hc11.c: Similarly.
* m68hc11/m68hc11.h: Similarly.
* m68k/crds.h: Similarly.
* m68k/dpx2.h: Similarly.
* m68k/m68k-protos.h: Similarly.
* m68k/m68k.c: Similarly.
* m68k/m68k.h: Similarly.
* m68k/news.h: Similarly.
* m88k/m88k-protos.h: Similarly.
* m88k/m88k.c: Similarly.
* m88k/m88k.h: Similarly.
* mips/mips-protos.h: Similarly.
* mips/mips.c: Similarly.
* mips/mips.h: Similarly.
* ns32k/merlin.h: Similarly.
* ns32k/ns32k.c: Similarly.
* ns32k/ns32k.h: Similarly.
* ns32k/tek6000.h: Similarly.
* pa/pa-protos.h: Similarly.
* pa/pa.c: Similarly.
* pa/pa.h: Similarly.
* pdp11/2bsd.h: Similarly.
* pdp11/pdp11-protos.h: Similarly.
* pdp11/pdp11.c: Similarly.
* pdp11/pdp11.h: Similarly.
* romp/romp-protos.h: Similarly.
* romp/romp.c: Similarly.
* romp/romp.h: Similarly.
* rs6000/rs6000-protos.h: Similarly.
* rs6000/rs6000.c: Similarly.
* rs6000/rs6000.h: Similarly.
* rs6000/sysv4.h: Similarly.
* sh/sh-protos.h: Similarly.
* sh/sh.c: Similarly.
* sh/sh.h: Similarly.
* sparc/sparc-protos.h: Similarly.
* sparc/sparc.c: Similarly.
* sparc/sparc.h: Similarly.
* vax/vax.c: Similarly.
* vax/vax.h: Similarly.
* vax/vms.h: Similarly.
* we32k/we32k.c: Similarly.
* we32k/we32k.h: Similarly.
Fri Jul 6 11:47:59 2001 Jeffrey A Law (law@cygnus.com)
* basic-block.h (first_insn_after_basic_block_note): Declare.
* flow.c (first_insn_after_basic_block_note): Define. Moved
from...
* ssa.c (first_insn_after_basic_block_note): Remove.
* ssa-dce.c (find_inherently_necessary): Consider BARRIERs
necessary.
(ssa_eliminate_dead_code): Properly update the CFG and PHI
nodes when we find a dead conditional branch. Insert BARRIERs
after any blocks with no successors, but which do not have
any BARRIERs.
2001-07-06 Zack Weinberg <zackw@stanford.edu>
* varray.c (varray_check_failed): Use internal_error.
2001-07-05 Andrew Haley <aph@redhat.com>
* Makefile.in (LIB2_DIVMOD_FUNCS): New.
(LIB2FUNCS): Move divmod functions to LIB2_DIVMOD_FUNCS.
* mklibgcc.in: Compile LIB2_DIVMOD_FUNCS.
2001-07-02 Jason Merrill <jason_merrill@redhat.com>
* dwarf2out.c (mem_loc_descriptor): Only look through a constant pool
reference if the target constant is also a SYMBOL_REF.
2001-07-05 Eric Christopher <echristo@redhat.com>
* config/mips/mips.h (MASK_MIPS3900): Remove.
(MASK_MIPS16,MASK_NO_CHECK_ZERO_DIV,MASK_CHECK_RANGE_DIV,
MASK_UNINIT_CONST_IN_RODATA): Change for 3900 mask removal.
(TARGET_MIPS3900): Change to use mips_arch.
(TARGET_MIPS4000): New.
(TARGET_MIPS4100): New.
(TARGET_MIPS4300): New.
(TARGET_SWITCHES): Change 3900 and 4650 options to NULL.
(SUBTARGET_TARGET_OPTIONS): Add -march. Change help text
for -mipsX.
(GENERATE_BRANCHLIKELY): Move TARGET_MIPS3900.
(ISA_HAS_BRANCHLIKELY): To here.
(CC1_CPU_SPEC): New.
(CC1_SPEC): Use here. Remove 4650 and 3900 options.
(mips_arch_string): Declare.
(mips_arch): Declare.
(TARGET_OPTIONS): Add -march and -mtune.
* config/mips/mips.c (mips_arch_string): New.
(mips_arch): New.
(override_options): Handle -march for codegen and -mtune
for scheduling. Use mips_arch. Move tx39 target default here.
(mips_parse_cpu): Move error message to override_options.
* config/mips/r3900.h (TARGET_DEFAULT): Remove.
* config/mips/mips.md: Use TARGET_MIPS4000 and TARGET_MIPS4300.
* doc/invoke.texi (Option Summary): Add -march and -mtune entries.
(MIPS Options): Ditto. Change mcpu entry to historical text.
2001-07-05 H.J. Lu (hjl@gnu.org)
* config/mips/mips.c (mips_parse_cpu): New function to parse
-march=*/-mcpu=*.
2001-07-05 Jim Wilson <wilson@redhat.com>
* config/ia64/lib1funcs.asm: Revert 2001-07-02 change.
* config/ia64/t-ia64: Likewise.
(LIB1ASMFUNCS): Update comment.
2001-07-05 David Edelsohn <edelsohn@gnu.org>
* doc/install.texi (Install GCC: Binaries): Fix typo.
2001-07-04 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* config/m68hc11/m68hc11.md ("*ashlsi3"): Operand 1 can be a memory
reference using the stack pointer, adjust it since we push Y
temporarily.
("*ashrsi3"): Likewise.
("*lshrsi3"): Likewise.
2001-07-05 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* config/m68hc11/m68hc11.h (RETURN_ADDR_RTX): Fix return address
when -fomit-frame-pointer is used.
2001-07-05 Jeffrey Oldham <oldham@codesourcery.com>
* flow.c: Reverse Jan Hubicka's patch of 02July2001.
(try_redirect_by_replacing_jump): Reverse updating properly the
count and frequency information. Reverse removing cc0 setter.
(forwarder_block_p): Reverse fixing for fallthru blocks.
2001-07-05 DJ Delorie <dj@redhat.com>
* gcc.c (TARGET_OPTION_TRANSLATE_TABLE): New.
(translate_options): If the above is defined, use it to map
given options to new options.
* doc/tm.texi: Document it.
2001-07-05 Brad Lucier <lucier@math.purdue.edu>
Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
* doc/invoke.texi (Optimize Options): Document that -fgcse may
cause programs using computed gotos to run more slowly.
2001-07-05 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* doc/install.texi (Specific): Markup, spelling and typo fixes.
Fixed sorting.
Consistently require binutils 2.11.2, not prereleases.
(Specific, decstation-*): Canonicalize as mips-dec-*.
(Specific, i?86-*-sco3.2v5*): Remove make bootstrap requirement,
always necessary.
(Specific, m68k-altos): Removed reference to README.altos, deleted.
(Specific, mips-*): Reword MIPS C compiler requirements.
(Specific, powerpc*-*-*): New, mention --with-cpu once.
(Specific, sunv5): Removed, obsolete.
2001-07-05 Nathan Sidwell <nathan@codesourcery.com>
* dwarf2out.c (output_loc_list): Use an all ones mask for
.text asm output and don't rely on long long
literals. Reformat some long lines.
2001-07-05 Andreas Jaeger <aj@suse.de>
* doc/gcc.texi (GNU/Linux): Remove accidental re-add of GPL
section.
2001-07-04 Daniel Berlin <dan@cgsoftware.com>
* dwarf2out.c (dwarf2out_define): Update comment.
(dwarf2out_undef): Ditto.
(dwarf2out_start_source_file): Ditto.
(dwarf2out_end_source_file): Ditto.
(dwarf2out_finish): Output DW_MACINFO_end_file for primary file,
since we never call the start/end debug hook for the primary file.
2001-07-04 Kazu Hirata <kazu@hxi.com>
* config/h8300/h8300.c (get_shift_alg): Remove an extra operand
from shll.
2001-07-04 Nathan Sidwell <nathan@codesourcery.com>
* cppinit.c (remove_dup_dirs): Inform if a system include
directory is being reordered.
* doc/invoke.texi (Directory Options): GCC warns if you hide a
system include.
* doc/cpp.texi (Search Paths): Likewise.
* doc/gcc.texi (Interoperation): Remove information about
-I/usr/include.
2001-07-04 Nathan Sidwell <nathan@codesourcery.com>
* varray.h (VARRAY_TOP_GENERIC_PTR): Remove spurious parameter.
(VARRAY_TOP_CHAR_PTR): Likewise.
2001-07-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.c (process_command): Don't assign elements of a const char*.
Wed Jul 4 13:40:02 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* emit-rtl.c (change_address): Don't abort if invalid address while
reload is in progress.
2001-07-04 Daniel Berlin <dan@cgsoftware.com>
* c-lex.c (cb_file_change): Pass line number to
debug_start_source_file.
(cb_undefine): Pass correct line number to debug_undef.
* toplev.c (debug_start_source_file): Add line number to
parameters. Pass it along to dwarf2out_start_source_file.
(decode_g_option): Stop resetting debug level back to normal when
we change debug formats, unless the current level is
none. (Before, -g3 -gdwarf-2 would use debug level 2, rather than
3).
* toplev.h (debug_start_source_file): Add line number to
parameters.
* dwarf2out.h (dwarf2out_start_source_file): Add line number to
parameters.
* dwarf2out.c (dwarf2out_start_source_file): Add line number to
parameters.
Output debug_macinfo data for starting file if requested.
(dwarf2out_end_source_file): Output debug_macinfo data for ending
file if requested.
(dwarf2out_define): Output debug_macinfo data for defining a macro
if requested.
(dwarf2out_undef): Output debug_macinfo data for undefining a
macro if requested.
(DEBUG_MACINFO_SECTION): New. DWARF2 macro info section name.
(DEBUG_MACINFO_SECTION_LABEL): New. DWARF2 macro info section label.
(macinfo_section_label): New. DWARF2 macro info section label.
(dwarf2out_init): If we want macro info, output the start label
for the section.
(dwarf2out_finish): If we want macro info, add a DW_AT_macro_info
attribute to the compilation unit die pointing to the macro info.
2001-07-04 Daniel Berlin <dan@cgsoftware.com>
* dwarf2out.c (new_loc_list): Move to inside #ifdef
DWARF2_DEBUGGING_INFO.
(add_loc_descr_to_loc_list): Ditto.
(output_loc_list): Ditto.
Also, fix thinko in curr not being initialized.
(gen_internal_sym): Ditto.
Wed Jul 4 13:40:02 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* emit-rtl.c (replace_equiv_address): New function.
* expr.h (replace_equiv_address): New declaration.
* explow.c (validize_mem): Call it instead of change_address and
also call if -fforce-addr and address is constant.
* expr.c: Replace more calls to change_address with adjust_address
and/or replace_equiv_address or to validize_mem.
* function.c, regmove.c, config/alpha/alpha.c: Likewise.
* config/arm/arm.md, config/clipper/clipper.md: Likewise.
* config/dsp16xx/dsp16xx.md, config/fr30/fr30.c: Likewise.
* config/i370/i370.md, config/i860/i860.md: Likewise.
* config/i960/i960.md, config/mips/mips.c: Likewise.
* config/mips/mips.md, config/pa/pa.md: Likewise.
* config/pdp11/pdp11.md, config/rs6000/rs6000.c: Likewise.
* config/rs6000/rs6000.md, config/sh/sh.md: Likewise.
2001-07-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* bitmap.c (bitmap_union_of_diff): Don't use BITMAP_ALLOCA.
* bitmap.h (BITMAP_ALLOCA): Don't pass alloca as an argument to a
function.
2001-07-04 Joseph S. Myers <jsm28@cam.ac.uk>
* doc/include: New directory.
* doc/fdl.texi: Move to doc/include/fdl.texi.
* doc/texinfo.tex: Move to doc/include/texinfo.tex.
* doc/include/funding.texi, doc/include/gpl.texi: New files.
* doc/gcc.texi: Use funding.texi and gpl.texi.
* Makefile.in ($(docdir)/cpp.info, $(docdir)/gcc.info,
$(docdir)/cppinternals.info, cpp.dvi. gcc.dvi. cppinternals.dvi):
Update dependencies and use -I $(docdir)/include.
2001-07-04 Anthony Green <green@redhat.com>
* config/v850/t-v850 (v850-c.o): Add missing dependencies.
2001-07-04 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
* doc/install.texi (sparc64-*-*): Remove garbage.
Wed Jul 4 09:07:44 2001 Jan van Male <jan.vanmale@fenk.wau.nl>
* i386.c (ix86_expand_builtin, case IX86_BUILTIN_SETPS):
Fix typo in last change to use adjust_address.
2001-07-04 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
* doc/install.texi (Specific): Update information for *-*-solaris*.
Tue Jul 3 22:33:15 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* explow.c (plus_constant_wide): Reinitialize Y for restart.
2001-07-03 Stan Shebs <shebs@apple.com>
* config/darwin.h (SECTION_FUNCTION): Remove WAS_TEXT argument, remove
case for flag_no_mach_text_sections.
(EXTRA_SECTION_FUNCTIONS): Remove arg from uses of SECTION_FUNCTION.
* config/darwin.c (flag_no_mach_text_sections): Remove.
* config/darwin-protos.h (darwin_init_pragma): Remove decl.
Tue Jul 3 15:35:52 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* explow.c (plus_constant_wide, case PLUS): Call find_constant_term
and avoid checking for constant as first operand.
* recog.c (find_constant_term_loc): No longer static.
(adj_offettable_operand): Delete.
* rtl.h (adj_offsettable_operand): Delete declaration.
(find_constant_term): Add declaration.
* caller-save.c: Replace calls to adj_offsettable_operand with calls
to adjust_address.
* config/arm/arm.c, config/c4x/c4x.c: Likewise.
* config/clipper/clipper.md, config/h8300/h8300.c: Likewise.
* config/i386/i386.c, config/i386/i386.md: Likewise.
* config/i860/i860.c, config/i960/i960.c: Likewise.
* config/i960/i960.md, config/m68hc11/m68hc11.c: Likewise.
* config/m68k/m68k.c, config/m68k/m68k.md: Likewise.
* config/m88k/m88k.md, config/mcore/mcore.c: Likewise.
* config/mips/mips.c, config/mips/mips.md: Likewise.
* config/mn10200/mn10200.c, config/mn10300/mn10300.c: Likewise.
* config/ns32k/ns32k.c, config/ns32k/ns32k.md: Likewise.
* config/pa/pa.c, config/pdp11/pdp11.c: Likewise.
* config/pdp11/pdp11.md, config/sh/sh.c, config/v850/v850.c: Likewise.
* config/vax/vax.md, config/ns32k/ns32k.c: Likewise.
* config/ns32k/ns32k.md: Likewise.
2001-07-03 Zack Weinberg <zackw@stanford.edu>
* rtl.c (copy_rtx): Handle 'T' format letter.
* gensupport.c (collect_insn_data): Likewise.
* print-rtl.c (print_rtx): Print 'T' slots like 's'.
2001-07-03 Nick Clifton <nickc@cambridge.redhat.com>
* doc/invoke.texi (Directory Options): Specifiy range for <N> in
-B option. Use 'dir' not 'foo' as example directory name.
2001-07-03 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* config/i386/sol2.h (ASM_PREFERRED_EH_DATA_FORMAT): Define.
Fixes PRs bootstrap/3067, bootstrap/3249, bootstrap/3275.
2001-07-03 Joseph S. Myers <jsm28@cam.ac.uk>
* doc/cppinternals.texi: Improve formatting and logical markup.
2001-07-03 Andreas Jaeger <aj@suse.de>
* Makefile.in (insn-recog.o): Add dependency on reload.h.
* genrecog.c (write_header): Include reload.h for prototypes in
insn-recog.c.
2001-07-03 Neil Booth <neil@daikokuya.demon.co.uk>
config:
* i386/cygwin.h (VALID_MACHINE_DECL_ATTRIBUTE,
VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* i386/i386-protos.h (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Add.
* i386/i386.c (TARGET_INITIALIZER): Override for cygwin targets.
* i386/winnt.c (i386_valid_decl_attribute_p): Return directly.
Mon Jul 2 21:52:19 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* explow.c (plus_constant_wide, case LO_SUM): New case.
(plus_constant_for_output_wide): Delete.
* rtl.h (plus_constant_for_output): Delete.
* alias.c (canon_rtx, init_alias_analysis): Call plus_constant
instead of plus_constant_for_output.
* recog.c (offsettable_address_p, adj_offsettable_operand): Likewise.
* config/darwin.c, config/arm/arm.c, config/m68k/m68k.c: Likewise.
* config/m88k/m88k.c, config/mips/mips.c, config/pa/pa.c: Likewise.
* config/rs6000/rs6000.c, config/sparc/sparc.c: Likewise.
* config/sparc/sparc.md: Likewise.
Convert some change_address calls to adjust_address.
2001-07-03 Joseph S. Myers <jsm28@cam.ac.uk>
* doc/extend.texi, doc/gcc.texi, doc/invoke.texi, doc/md.texi,
doc/rtl.texi, doc/tm.texi: Improve formatting. Improve
documentation of -std and -Wwrite-strings.
2001-07-02 Geoffrey Keating <geoffk@redhat.com>
* cse.c (canon_hash): Don't register registers in very small
register classes, as extending their lifetime might cause
reload to fail.
Mon Jul 2 23:14:00 CEST 2001 Jan Hubicka <jh@suse.cz>
* flow.c (try_redirect_by_replacing_jump): Remove cc0 setter.
* flow.c (forwarder_block_p): Fix for fallthru blocks.
(try_redirect_by_replacing_jump): Update properly the count
and frequency information.
Mon Jul 2 14:20:13 2001 Jeffrey A Law (law@cygnus.com)
* toplev.c (dump_file_index): Move SSA dumps just after first
jump dump.
(dump_file): Corresponding changes.
(rest_of_compilation): Move SSA path to just after the first
jump pass.
* doc/gcc.texi (Passes): Update due to movement of SSA path.
* doc/invoke.texi: Update dump file #s as they were completely
out of date with reality.
2001-07-02 Geoffrey Keating <geoffk@redhat.com>
* doc/tm.texi (Frame Layout): Document STACK_PUSH_CODE.
* expr.c (emit_move_insn_1): Deal with non-default
STACK_PUSH_CODE.
* expr.c (emit_single_push_insn): Fix warning.
2001-07-02 Toshiyasu Morita <toshiyasu.morita@hsa.hitachi.com>
* expr.c (emit_move_insn_1): Avoid modifying
cfun->expr->x_stack_pointer when PUSH_ROUNDING is defined.
Mon Jul 2 15:33:31 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* emit-rtl.c (adjust_address): New function.
* expr.h (adjust_address): Add declaration.
* builtins.c: Replace some calls to change_address with calls to it
or to validize_mem.
* caller-save.c, dwarf2out.c, except.c, expmed.c, expr.c: Likewise.
* function.c, config/a29k/a29k.md, config/alpha/alpha.c: Likewise.
* config/arm/arm.c, config/convex/convex.c: Likewise.
* config/dsp16xx/dsp16xx.md, config/fr30/fr30.c: Likewise.
* config/i386/i386.c, config/i386/i386.md: Likewise.
* config/ia64/ia64.c, config/ia64/ia64.md: Likewise.
* config/m32r/m32r.c, config/m68k/m68k.md: Likewise.
* config/m88k/m88k.c, config/mips/mips.md: Likewise.
* config/ns32k/ns32k.c, config/rs6000/rs6000.c: Likewise.
* config/sh/sh.c, config/sparc/sparc.md: Likewise.
2001-07-02 Jim Wilson <wilson@redhat.com>
* config/ia64/ia64.h: Delete obsolete lib1funcs.asm comment.
2001-07-02 Steve Ellcey <sje@cup.hp.com>
* config/ia64/t-ia64: Change LIB1ASMFUNCS to use single underscore.
* config/ia64/lib1funcs.asm: Change macro names to match t-ia64.
2001-07-02 Zack Weinberg <zackw@stanford.edu>
* cppinit.c (lang_defaults): New table.
(set_lang): Just read from lang_defaults into the live options
structure.
2001-07-02 Zack Weinberg <zackw@stanford.edu>
* Makefile.in (doc): Depend on $(GENERATED_MANPAGES).
* doc/.cvsignore: Add gcc.1, cpp.1, gcov.1.
* doc/gcc.1, doc/cpp.1, doc/gcov.1: Removed.
2001-07-02 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* doc/install.texi: Various spelling and markup fixes.
(Installing GCC): Component specific installation instructions are
gone.
Fix reference.
Warn about removing old install dir in the presence of shared libs.
(Configuration): Invoke with options target to match configure
--help.
Consistently refer to gas, gld pathnames.
Invert --enable-multilib documentation.
Remove references to old compiler versions.
Mon Jul 2 12:50:51 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* flow.c (try_simplify_condjump): Fix typo in updating fallthru flags.
2001-07-02 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* doc/install.texi (Specific, mips*-sgi-irix4): Split from IRIX 5
section.
(Specific, mips*-sgi-irix5): Note IDO download.
Reworded MIPS C hints.
Use GNU as instead of GAS.
Markup fixes.
Removed SGI Freeware reference, IRIX 6 only.
(Specific, mips*-sgi-irix6): Removed ranlib caveats, obsolete.
Note N64 library requirement/workaround.
Update O32 hints.
Complete list of structure passing bug victims.
2001-07-02 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
* doc/install.texi: Remove CVS Id.
2001-07-02 Andreas Jaeger <aj@suse.de>
* ssa-dce.c (note_inherently_necessary_set): Add unused attribute.
(find_inherently_necessary): Remove unused variable.
2001-07-02 Nathan Sidwell <nathan@codesourcery.com>
* c-common.h (TDI_inlined): New ast dump phase.
(dump_flag_name): New function.
* c-dump.c (dump_files): Add inlined phase.
(dump_flag_name): Define.
* doc/invoke.texi (-fdump-ast-inlined): Document.
Mon Jul 2 06:29:36 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* stor-layout.c (layout_decl): Revert change to handling of alignment
in packed types.
Sun Jul 1 11:53:52 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* c-common.c (decl_attributes, case A_MODE): Don't call layout_decl
for FIELD_DECL.
2001-07-01 Geoffrey Keating <geoffk@redhat.com>
* doc/tm.texi (FUNCTION_ARG): Document that the last call
is special.
2001-07-01 Nathan Sidwell <nathan@codesourcery.com>
* tlink.c (recompile_files): Remove COMPILER_PATH and
LIBRARY_PATH from the environment.
2001-07-01 Zack Weinberg <zackw@stanford.edu>
* c-common.h (enum rid): Add RID_FIRST_AT, RID_LAST_AT,
RID_LAST_PQ. Move RID_FIRST_PQ down with the other FIRST/LAST
enumerators.
(OBJC_IS_AT_KEYWORD, OBJC_IS_PQ_KEYWORD): New macros.
* c-parse.in (OBJC_STRING): Kill.
(objc_string): Decompose to [objc_string] '@' STRING.
(reswords): Take the leading '@' off all the Objective C keywords.
(objc_rid_sans_at): Kill.
(init_reswords): Don't initialize it.
(yylexname): Use OBJC_IS_AT_KEYWORD and OBJC_IS_PQ_KEYWORD.
(_yylex): Kill reconsider label. Look ahead one token after
an '@'; if we get an identifier, check whether it's an
Objective C @-keyword. If so, return the keyword. Otherwise,
put back the token and return the '@' as a terminal.
* cpplib.c (lex_macro_node): Remove unnecessary check for
leading '@' on identifier. Clarify control flow and commentary.
Sun Jul 1 11:53:52 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* cse.c (new_label_ref): Variable deleted.
(insert): Remove set of new_label_ref.
(check_for_label_ref): New function.
(cse_basic_block): Don't check new_label_ref; call check_for_label_ref.
See ChangeLog.5 for earlier changes.
From-SVN: r43861
2001-07-09 13:20:51 +02:00
|
|
|
|
return adjust_address_nv (op, outermode, byte);
|
2001-05-17 23:21:21 +02:00
|
|
|
|
|
|
|
|
|
/* Handle complex values represented as CONCAT
|
|
|
|
|
of real and imaginary part. */
|
|
|
|
|
if (GET_CODE (op) == CONCAT)
|
|
|
|
|
{
|
2006-12-21 05:35:05 +01:00
|
|
|
|
unsigned int part_size, final_offset;
|
2004-12-09 21:28:14 +01:00
|
|
|
|
rtx part, res;
|
|
|
|
|
|
2006-12-21 05:35:05 +01:00
|
|
|
|
part_size = GET_MODE_UNIT_SIZE (GET_MODE (XEXP (op, 0)));
|
|
|
|
|
if (byte < part_size)
|
|
|
|
|
{
|
|
|
|
|
part = XEXP (op, 0);
|
|
|
|
|
final_offset = byte;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
part = XEXP (op, 1);
|
|
|
|
|
final_offset = byte - part_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (final_offset + GET_MODE_SIZE (outermode) > part_size)
|
2004-12-09 21:28:14 +01:00
|
|
|
|
return NULL_RTX;
|
2001-05-17 23:21:21 +02:00
|
|
|
|
|
2001-06-29 23:15:01 +02:00
|
|
|
|
res = simplify_subreg (outermode, part, GET_MODE (part), final_offset);
|
|
|
|
|
if (res)
|
|
|
|
|
return res;
|
2004-11-24 01:09:03 +01:00
|
|
|
|
if (validate_subreg (outermode, GET_MODE (part), part, final_offset))
|
2004-12-09 21:28:14 +01:00
|
|
|
|
return gen_rtx_SUBREG (outermode, part, final_offset);
|
2004-11-24 01:09:03 +01:00
|
|
|
|
return NULL_RTX;
|
2001-05-17 23:21:21 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-01-22 13:44:54 +01:00
|
|
|
|
/* Optimize SUBREG truncations of zero and sign extended values. */
|
|
|
|
|
if ((GET_CODE (op) == ZERO_EXTEND
|
|
|
|
|
|| GET_CODE (op) == SIGN_EXTEND)
|
|
|
|
|
&& GET_MODE_BITSIZE (outermode) < GET_MODE_BITSIZE (innermode))
|
|
|
|
|
{
|
|
|
|
|
unsigned int bitpos = subreg_lsb_1 (outermode, innermode, byte);
|
|
|
|
|
|
|
|
|
|
/* If we're requesting the lowpart of a zero or sign extension,
|
|
|
|
|
there are three possibilities. If the outermode is the same
|
|
|
|
|
as the origmode, we can omit both the extension and the subreg.
|
|
|
|
|
If the outermode is not larger than the origmode, we can apply
|
|
|
|
|
the truncation without the extension. Finally, if the outermode
|
|
|
|
|
is larger than the origmode, but both are integer modes, we
|
|
|
|
|
can just extend to the appropriate mode. */
|
|
|
|
|
if (bitpos == 0)
|
|
|
|
|
{
|
|
|
|
|
enum machine_mode origmode = GET_MODE (XEXP (op, 0));
|
|
|
|
|
if (outermode == origmode)
|
|
|
|
|
return XEXP (op, 0);
|
|
|
|
|
if (GET_MODE_BITSIZE (outermode) <= GET_MODE_BITSIZE (origmode))
|
2004-01-23 02:47:15 +01:00
|
|
|
|
return simplify_gen_subreg (outermode, XEXP (op, 0), origmode,
|
|
|
|
|
subreg_lowpart_offset (outermode,
|
|
|
|
|
origmode));
|
2004-01-22 13:44:54 +01:00
|
|
|
|
if (SCALAR_INT_MODE_P (outermode))
|
|
|
|
|
return simplify_gen_unary (GET_CODE (op), outermode,
|
|
|
|
|
XEXP (op, 0), origmode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* A SUBREG resulting from a zero extension may fold to zero if
|
|
|
|
|
it extracts higher bits that the ZERO_EXTEND's source bits. */
|
|
|
|
|
if (GET_CODE (op) == ZERO_EXTEND
|
|
|
|
|
&& bitpos >= GET_MODE_BITSIZE (GET_MODE (XEXP (op, 0))))
|
|
|
|
|
return CONST0_RTX (outermode);
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-07 01:47:13 +01:00
|
|
|
|
/* Simplify (subreg:QI (lshiftrt:SI (sign_extend:SI (x:QI)) C), 0) into
|
|
|
|
|
to (ashiftrt:QI (x:QI) C), where C is a suitable small constant and
|
|
|
|
|
the outer subreg is effectively a truncation to the original mode. */
|
|
|
|
|
if ((GET_CODE (op) == LSHIFTRT
|
|
|
|
|
|| GET_CODE (op) == ASHIFTRT)
|
|
|
|
|
&& SCALAR_INT_MODE_P (outermode)
|
|
|
|
|
/* Ensure that OUTERMODE is at least twice as wide as the INNERMODE
|
|
|
|
|
to avoid the possibility that an outer LSHIFTRT shifts by more
|
|
|
|
|
than the sign extension's sign_bit_copies and introduces zeros
|
|
|
|
|
into the high bits of the result. */
|
|
|
|
|
&& (2 * GET_MODE_BITSIZE (outermode)) <= GET_MODE_BITSIZE (innermode)
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (op, 1))
|
2005-01-07 01:47:13 +01:00
|
|
|
|
&& GET_CODE (XEXP (op, 0)) == SIGN_EXTEND
|
|
|
|
|
&& GET_MODE (XEXP (XEXP (op, 0), 0)) == outermode
|
|
|
|
|
&& INTVAL (XEXP (op, 1)) < GET_MODE_BITSIZE (outermode)
|
|
|
|
|
&& subreg_lsb_1 (outermode, innermode, byte) == 0)
|
|
|
|
|
return simplify_gen_binary (ASHIFTRT, outermode,
|
|
|
|
|
XEXP (XEXP (op, 0), 0), XEXP (op, 1));
|
|
|
|
|
|
|
|
|
|
/* Likewise (subreg:QI (lshiftrt:SI (zero_extend:SI (x:QI)) C), 0) into
|
|
|
|
|
to (lshiftrt:QI (x:QI) C), where C is a suitable small constant and
|
|
|
|
|
the outer subreg is effectively a truncation to the original mode. */
|
|
|
|
|
if ((GET_CODE (op) == LSHIFTRT
|
|
|
|
|
|| GET_CODE (op) == ASHIFTRT)
|
|
|
|
|
&& SCALAR_INT_MODE_P (outermode)
|
|
|
|
|
&& GET_MODE_BITSIZE (outermode) < GET_MODE_BITSIZE (innermode)
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (op, 1))
|
2005-01-07 01:47:13 +01:00
|
|
|
|
&& GET_CODE (XEXP (op, 0)) == ZERO_EXTEND
|
|
|
|
|
&& GET_MODE (XEXP (XEXP (op, 0), 0)) == outermode
|
|
|
|
|
&& INTVAL (XEXP (op, 1)) < GET_MODE_BITSIZE (outermode)
|
|
|
|
|
&& subreg_lsb_1 (outermode, innermode, byte) == 0)
|
|
|
|
|
return simplify_gen_binary (LSHIFTRT, outermode,
|
|
|
|
|
XEXP (XEXP (op, 0), 0), XEXP (op, 1));
|
|
|
|
|
|
|
|
|
|
/* Likewise (subreg:QI (ashift:SI (zero_extend:SI (x:QI)) C), 0) into
|
|
|
|
|
to (ashift:QI (x:QI) C), where C is a suitable small constant and
|
|
|
|
|
the outer subreg is effectively a truncation to the original mode. */
|
|
|
|
|
if (GET_CODE (op) == ASHIFT
|
|
|
|
|
&& SCALAR_INT_MODE_P (outermode)
|
|
|
|
|
&& GET_MODE_BITSIZE (outermode) < GET_MODE_BITSIZE (innermode)
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (op, 1))
|
2005-01-07 01:47:13 +01:00
|
|
|
|
&& (GET_CODE (XEXP (op, 0)) == ZERO_EXTEND
|
|
|
|
|
|| GET_CODE (XEXP (op, 0)) == SIGN_EXTEND)
|
|
|
|
|
&& GET_MODE (XEXP (XEXP (op, 0), 0)) == outermode
|
|
|
|
|
&& INTVAL (XEXP (op, 1)) < GET_MODE_BITSIZE (outermode)
|
|
|
|
|
&& subreg_lsb_1 (outermode, innermode, byte) == 0)
|
|
|
|
|
return simplify_gen_binary (ASHIFT, outermode,
|
|
|
|
|
XEXP (XEXP (op, 0), 0), XEXP (op, 1));
|
|
|
|
|
|
2008-03-06 14:30:10 +01:00
|
|
|
|
/* Recognize a word extraction from a multi-word subreg. */
|
|
|
|
|
if ((GET_CODE (op) == LSHIFTRT
|
|
|
|
|
|| GET_CODE (op) == ASHIFTRT)
|
|
|
|
|
&& SCALAR_INT_MODE_P (outermode)
|
|
|
|
|
&& GET_MODE_BITSIZE (outermode) >= BITS_PER_WORD
|
|
|
|
|
&& GET_MODE_BITSIZE (innermode) >= (2 * GET_MODE_BITSIZE (outermode))
|
2009-06-22 12:29:13 +02:00
|
|
|
|
&& CONST_INT_P (XEXP (op, 1))
|
2008-03-06 14:30:10 +01:00
|
|
|
|
&& (INTVAL (XEXP (op, 1)) & (GET_MODE_BITSIZE (outermode) - 1)) == 0
|
2009-08-27 22:54:28 +02:00
|
|
|
|
&& INTVAL (XEXP (op, 1)) >= 0
|
2008-06-10 00:38:34 +02:00
|
|
|
|
&& INTVAL (XEXP (op, 1)) < GET_MODE_BITSIZE (innermode)
|
2008-03-06 14:30:10 +01:00
|
|
|
|
&& byte == subreg_lowpart_offset (outermode, innermode))
|
|
|
|
|
{
|
|
|
|
|
int shifted_bytes = INTVAL (XEXP (op, 1)) / BITS_PER_UNIT;
|
|
|
|
|
return simplify_gen_subreg (outermode, XEXP (op, 0), innermode,
|
|
|
|
|
(WORDS_BIG_ENDIAN
|
2009-08-27 22:54:28 +02:00
|
|
|
|
? byte - shifted_bytes
|
|
|
|
|
: byte + shifted_bytes));
|
2008-03-06 14:30:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-05-17 17:00:35 +02:00
|
|
|
|
return NULL_RTX;
|
|
|
|
|
}
|
2004-01-06 23:51:00 +01:00
|
|
|
|
|
2001-05-17 20:46:58 +02:00
|
|
|
|
/* Make a SUBREG operation or equivalent if it folds. */
|
|
|
|
|
|
|
|
|
|
rtx
|
2003-07-06 14:35:56 +02:00
|
|
|
|
simplify_gen_subreg (enum machine_mode outermode, rtx op,
|
|
|
|
|
enum machine_mode innermode, unsigned int byte)
|
2001-05-17 20:46:58 +02:00
|
|
|
|
{
|
2004-07-25 21:09:36 +02:00
|
|
|
|
rtx newx;
|
2001-05-17 20:46:58 +02:00
|
|
|
|
|
2004-07-25 21:09:36 +02:00
|
|
|
|
newx = simplify_subreg (outermode, op, innermode, byte);
|
|
|
|
|
if (newx)
|
|
|
|
|
return newx;
|
2001-05-17 20:46:58 +02:00
|
|
|
|
|
2004-12-09 21:28:14 +01:00
|
|
|
|
if (GET_CODE (op) == SUBREG
|
|
|
|
|
|| GET_CODE (op) == CONCAT
|
|
|
|
|
|| GET_MODE (op) == VOIDmode)
|
2001-05-17 20:46:58 +02:00
|
|
|
|
return NULL_RTX;
|
|
|
|
|
|
2004-11-24 01:09:03 +01:00
|
|
|
|
if (validate_subreg (outermode, innermode, op, byte))
|
|
|
|
|
return gen_rtx_SUBREG (outermode, op, byte);
|
|
|
|
|
|
|
|
|
|
return NULL_RTX;
|
2001-05-17 20:46:58 +02:00
|
|
|
|
}
|
2004-11-24 01:09:03 +01:00
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
/* Simplify X, an rtx expression.
|
|
|
|
|
|
|
|
|
|
Return the simplified expression or NULL if no simplifications
|
|
|
|
|
were possible.
|
|
|
|
|
|
|
|
|
|
This is the preferred entry point into the simplification routines;
|
|
|
|
|
however, we still allow passes to call the more specific routines.
|
|
|
|
|
|
2002-12-24 09:30:34 +01:00
|
|
|
|
Right now GCC has three (yes, three) major bodies of RTL simplification
|
1999-11-01 01:18:23 +01:00
|
|
|
|
code that need to be unified.
|
|
|
|
|
|
|
|
|
|
1. fold_rtx in cse.c. This code uses various CSE specific
|
|
|
|
|
information to aid in RTL simplification.
|
|
|
|
|
|
|
|
|
|
2. simplify_rtx in combine.c. Similar to fold_rtx, except that
|
|
|
|
|
it uses combine specific information to aid in RTL
|
|
|
|
|
simplification.
|
|
|
|
|
|
|
|
|
|
3. The routines in this file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long term we want to only have one body of simplification code; to
|
|
|
|
|
get to that state I recommend the following steps:
|
|
|
|
|
|
|
|
|
|
1. Pour over fold_rtx & simplify_rtx and move any simplifications
|
|
|
|
|
which are not pass dependent state into these routines.
|
|
|
|
|
|
|
|
|
|
2. As code is moved by #1, change fold_rtx & simplify_rtx to
|
|
|
|
|
use this routine whenever possible.
|
|
|
|
|
|
|
|
|
|
3. Allow for pass dependent state to be provided to these
|
|
|
|
|
routines and add simplifications based on the pass dependent
|
|
|
|
|
state. Remove code from cse.c & combine.c that becomes
|
|
|
|
|
redundant/dead.
|
|
|
|
|
|
|
|
|
|
It will take time, but ultimately the compiler will be easier to
|
|
|
|
|
maintain and improve. It's totally silly that when we add a
|
|
|
|
|
simplification that it needs to be added to 4 places (3 for RTL
|
|
|
|
|
simplification and 1 for tree simplification. */
|
2002-05-09 14:02:29 +02:00
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
rtx
|
c-common.c (vector_types_convertible_p, [...]): Constify.
* c-common.c (vector_types_convertible_p,
decl_with_nonnull_addr_p, c_promoting_integer_type_p,
self_promoting_args_p): Constify.
* c-common.h (has_c_linkage, decl_with_nonnull_addr_p,
c_promoting_integer_type_p, self_promoting_args_p,
anon_aggr_type_p, vector_types_convertible_p): Likewise.
* c-decl.c (anon_aggr_type_p): Likewise.
* * c-dump.c (dump_stmt): Likewise.
* c-objc-common.c (has_c_linkage): Likewise.
* c-tree.h (same_translation_unit_p): Likewise.
* c-typeck.c (null_pointer_constant_p,
tagged_types_tu_compatible_p, function_types_compatible_p,
type_lists_compatible_p, lvalue_or_else, lvalue_p,
comptypes_internal, struct tagged_tu_seen_cache,
same_translation_unit_p, alloc_tagged_tu_seen_cache,
c_size_in_bytes): Likewise.
* ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor,
hash_ptr, eq_ptr): Likewise.
* langhooks-def.h (lhd_decl_ok_for_sibcall,
LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise.
* langhooks.c (lhd_decl_ok_for_sibcall): Likewise.
* langhooks.h (ok_for_sibcall, omp_privatize_by_reference):
Likewise.
* optabs.c (optab_for_tree_code): Likewise.
* optabs.h (optab_for_tree_code): Likewise.
* rtl.h (simplify_rtx): Likewise.
* simplify-rtx.c (simplify_rtx): Likewise.
* tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type,
dump_flag, dump_node): Likewise.
* tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index,
queue_and_dump_type, dump_flag): Likewise.
* tree-flow.h (vect_can_force_dr_alignment_p): Likewise.
* tree-pass.h (dump_node): Likewise.
* tree-vectorizer.c (vect_can_force_dr_alignment_p,
supportable_narrowing_operation): Likewise.
* tree-vectorizer.h (vect_can_force_dr_alignment_p,
supportable_narrowing_operation): Likewise.
* tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity,
is_negative_overflow_infinity, is_positive_overflow_infinity,
is_overflow_infinity, vrp_val_is_max, vrp_val_is_min,
nonnull_arg_p, get_value_range, vrp_operand_equal_p,
update_value_range, add_equivalence, ssa_name_nonnegative_p,
ssa_name_nonzero_p, fp_predicate): Likewise.
* tree.c (auto_var_in_fn_p, empty_body_p): Likewise.
* tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p,
ssa_name_nonnegative_p): Likewise.
cp:
* call.c (sufficient_parms_p): Constify.
* class.c (same_signature_p): Likewise.
* cp-gimplify.c (is_invisiref_parm,
cxx_omp_privatize_by_reference): Likewise.
* cp-objcp-common.c (has_c_linkage): Likewise.
* cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK,
sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p,
grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for,
num_artificial_parms_for, comp_template_parms,
template_parameter_pack_p, any_dependent_template_arguments_p,
any_type_dependent_arguments_p, any_value_dependent_elements_p,
repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p,
zero_init_p, member_p, cp_lvalue_kind,
builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p,
varargs_function_p, is_dummy_object, special_function_kind,
string_conv_p, type_unknown_p, comp_except_specs, compparms,
comp_cv_qualification, is_bitfield_expr_with_lowered_type,
unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly,
cp_has_mutable_p, at_least_as_qualified_p,
invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise.
* decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise.
* except.c (nothrow_libfn_p): Likewise.
* method.c (skip_artificial_parms_for, num_artificial_parms_for):
Likewise.
* pt.c (comp_template_parms, template_parameter_pack_p,
any_type_dependent_arguments_p, any_value_dependent_elements_p,
any_dependent_template_arguments_p): Likewise.
* repo.c (repo_export_class_p): Likewise.
* semantics.c (anon_aggr_type_p): Likewise.
* tree.c (lvalue_p_1, real_lvalue_p, lvalue_p,
builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p,
varargs_function_p, member_p, is_dummy_object, pod_type_p,
zero_init_p, special_function_p): Likewise.
* typeck.c (comp_array_types, type_unknown_p, comp_except_specs,
comp_array_types, at_least_as_qualified_p, comp_cv_qualification,
compparms, invalid_nonstatic_memfn_p,
is_bitfield_expr_with_lowered_type, unlowered_expr_type,
string_conv_p, ptr_reasonably_similar, cp_type_readonly,
cp_has_mutable_p, lvalue_or_else): Likewise.
fortran:
* trans-openmp.c (gfc_omp_privatize_by_reference): Constify.
* trans.h (gfc_omp_privatize_by_reference): Likewise.
java:
* lang.c (java_decl_ok_for_sibcall): Likewise.
From-SVN: r127799
2007-08-25 17:10:40 +02:00
|
|
|
|
simplify_rtx (const_rtx x)
|
1999-11-01 01:18:23 +01:00
|
|
|
|
{
|
c-common.c (vector_types_convertible_p, [...]): Constify.
* c-common.c (vector_types_convertible_p,
decl_with_nonnull_addr_p, c_promoting_integer_type_p,
self_promoting_args_p): Constify.
* c-common.h (has_c_linkage, decl_with_nonnull_addr_p,
c_promoting_integer_type_p, self_promoting_args_p,
anon_aggr_type_p, vector_types_convertible_p): Likewise.
* c-decl.c (anon_aggr_type_p): Likewise.
* * c-dump.c (dump_stmt): Likewise.
* c-objc-common.c (has_c_linkage): Likewise.
* c-tree.h (same_translation_unit_p): Likewise.
* c-typeck.c (null_pointer_constant_p,
tagged_types_tu_compatible_p, function_types_compatible_p,
type_lists_compatible_p, lvalue_or_else, lvalue_p,
comptypes_internal, struct tagged_tu_seen_cache,
same_translation_unit_p, alloc_tagged_tu_seen_cache,
c_size_in_bytes): Likewise.
* ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor,
hash_ptr, eq_ptr): Likewise.
* langhooks-def.h (lhd_decl_ok_for_sibcall,
LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise.
* langhooks.c (lhd_decl_ok_for_sibcall): Likewise.
* langhooks.h (ok_for_sibcall, omp_privatize_by_reference):
Likewise.
* optabs.c (optab_for_tree_code): Likewise.
* optabs.h (optab_for_tree_code): Likewise.
* rtl.h (simplify_rtx): Likewise.
* simplify-rtx.c (simplify_rtx): Likewise.
* tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type,
dump_flag, dump_node): Likewise.
* tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index,
queue_and_dump_type, dump_flag): Likewise.
* tree-flow.h (vect_can_force_dr_alignment_p): Likewise.
* tree-pass.h (dump_node): Likewise.
* tree-vectorizer.c (vect_can_force_dr_alignment_p,
supportable_narrowing_operation): Likewise.
* tree-vectorizer.h (vect_can_force_dr_alignment_p,
supportable_narrowing_operation): Likewise.
* tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity,
is_negative_overflow_infinity, is_positive_overflow_infinity,
is_overflow_infinity, vrp_val_is_max, vrp_val_is_min,
nonnull_arg_p, get_value_range, vrp_operand_equal_p,
update_value_range, add_equivalence, ssa_name_nonnegative_p,
ssa_name_nonzero_p, fp_predicate): Likewise.
* tree.c (auto_var_in_fn_p, empty_body_p): Likewise.
* tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p,
ssa_name_nonnegative_p): Likewise.
cp:
* call.c (sufficient_parms_p): Constify.
* class.c (same_signature_p): Likewise.
* cp-gimplify.c (is_invisiref_parm,
cxx_omp_privatize_by_reference): Likewise.
* cp-objcp-common.c (has_c_linkage): Likewise.
* cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK,
sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p,
grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for,
num_artificial_parms_for, comp_template_parms,
template_parameter_pack_p, any_dependent_template_arguments_p,
any_type_dependent_arguments_p, any_value_dependent_elements_p,
repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p,
zero_init_p, member_p, cp_lvalue_kind,
builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p,
varargs_function_p, is_dummy_object, special_function_kind,
string_conv_p, type_unknown_p, comp_except_specs, compparms,
comp_cv_qualification, is_bitfield_expr_with_lowered_type,
unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly,
cp_has_mutable_p, at_least_as_qualified_p,
invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise.
* decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise.
* except.c (nothrow_libfn_p): Likewise.
* method.c (skip_artificial_parms_for, num_artificial_parms_for):
Likewise.
* pt.c (comp_template_parms, template_parameter_pack_p,
any_type_dependent_arguments_p, any_value_dependent_elements_p,
any_dependent_template_arguments_p): Likewise.
* repo.c (repo_export_class_p): Likewise.
* semantics.c (anon_aggr_type_p): Likewise.
* tree.c (lvalue_p_1, real_lvalue_p, lvalue_p,
builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p,
varargs_function_p, member_p, is_dummy_object, pod_type_p,
zero_init_p, special_function_p): Likewise.
* typeck.c (comp_array_types, type_unknown_p, comp_except_specs,
comp_array_types, at_least_as_qualified_p, comp_cv_qualification,
compparms, invalid_nonstatic_memfn_p,
is_bitfield_expr_with_lowered_type, unlowered_expr_type,
string_conv_p, ptr_reasonably_similar, cp_type_readonly,
cp_has_mutable_p, lvalue_or_else): Likewise.
fortran:
* trans-openmp.c (gfc_omp_privatize_by_reference): Constify.
* trans.h (gfc_omp_privatize_by_reference): Likewise.
java:
* lang.c (java_decl_ok_for_sibcall): Likewise.
From-SVN: r127799
2007-08-25 17:10:40 +02:00
|
|
|
|
const enum rtx_code code = GET_CODE (x);
|
|
|
|
|
const enum machine_mode mode = GET_MODE (x);
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
|
|
|
|
switch (GET_RTX_CLASS (code))
|
|
|
|
|
{
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_UNARY:
|
1999-11-01 01:18:23 +01:00
|
|
|
|
return simplify_unary_operation (code, mode,
|
|
|
|
|
XEXP (x, 0), GET_MODE (XEXP (x, 0)));
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_COMM_ARITH:
|
2001-07-02 17:43:38 +02:00
|
|
|
|
if (swap_commutative_operands_p (XEXP (x, 0), XEXP (x, 1)))
|
2003-07-18 05:16:32 +02:00
|
|
|
|
return simplify_gen_binary (code, mode, XEXP (x, 1), XEXP (x, 0));
|
2001-06-28 02:14:23 +02:00
|
|
|
|
|
2003-08-22 08:25:09 +02:00
|
|
|
|
/* Fall through.... */
|
2001-06-28 02:14:23 +02:00
|
|
|
|
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_BIN_ARITH:
|
1999-11-01 01:18:23 +01:00
|
|
|
|
return simplify_binary_operation (code, mode, XEXP (x, 0), XEXP (x, 1));
|
|
|
|
|
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_TERNARY:
|
|
|
|
|
case RTX_BITFIELD_OPS:
|
1999-11-01 01:18:23 +01:00
|
|
|
|
return simplify_ternary_operation (code, mode, GET_MODE (XEXP (x, 0)),
|
2001-02-13 21:43:13 +01:00
|
|
|
|
XEXP (x, 0), XEXP (x, 1),
|
|
|
|
|
XEXP (x, 2));
|
1999-11-01 01:18:23 +01:00
|
|
|
|
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_COMPARE:
|
|
|
|
|
case RTX_COMM_COMPARE:
|
2004-04-29 09:50:55 +02:00
|
|
|
|
return simplify_relational_operation (code, mode,
|
|
|
|
|
((GET_MODE (XEXP (x, 0))
|
|
|
|
|
!= VOIDmode)
|
|
|
|
|
? GET_MODE (XEXP (x, 0))
|
|
|
|
|
: GET_MODE (XEXP (x, 1))),
|
|
|
|
|
XEXP (x, 0),
|
|
|
|
|
XEXP (x, 1));
|
2003-07-16 21:34:50 +02:00
|
|
|
|
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_EXTRA:
|
2001-05-17 20:46:58 +02:00
|
|
|
|
if (code == SUBREG)
|
2006-11-30 22:54:20 +01:00
|
|
|
|
return simplify_subreg (mode, SUBREG_REG (x),
|
|
|
|
|
GET_MODE (SUBREG_REG (x)),
|
|
|
|
|
SUBREG_BYTE (x));
|
2003-07-16 21:34:50 +02:00
|
|
|
|
break;
|
|
|
|
|
|
alias.c (rtx_equal_for_memref_p): Use predicates to test rtx classes and new rtx class codes...
2004-02-07 Paolo Bonzini <bonzini@gnu.org>
* alias.c (rtx_equal_for_memref_p): Use predicates
to test rtx classes and new rtx class codes, possibly
splitting conditionals that tested against '<' and 'o'.
* caller-save.c (save_call_clobbered_regs): Likewise.
* combine.c (contains_muldiv, find_split_point, subst,
combine_simplify_rtx, simplify_if_then_else,
simplify_set, simplify_logical, expand_compound_operation,
make_compound_operation, if_then_else_cond, known_cond,
apply_distributive_law, cached_nonzero_bits,
cached_num_sign_bit_copies, simplify_shift_const,
gen_binary, simplify_comparison, update_table_tick,
record_value_for_reg, get_lsat_value_validate): Likewise.
* cse.c (mention_regs, find_best_addr, find_comparison_args,
fold_rtx, cse_insn, invalidate_memory, cse_basic_block):
Likewise.
* emit-rtl.c (copy_insn_1): Likewise.
* expr.c (force_operand): Likewise.
* final.c (final_scan_insn, get_mem_expr_from_op): Likewise.
* flow.c (notice_stack_pointer_modification_1,
invalidate_mems_from_autoinc, ior_reg_cond, not_reg_cond,
and_reg_cond, elim_reg_cond): Likewise.
* function.c (update_epilogue_consts): Likewise.
* genattrtab.c (attr_rtx_1): Likewise.
* genopinit.c (gen_insn): Likewise.
* integrate.c (subst_constants): Likewise.
* jump.c (reversed_comparison_code_parts,
reversed_comparison_code, delete_related_insns,
rtx_renumbered_equal_p): Likewise.
* local-alloc.c (block_alloc): Likewise.
* loop.c (rtx_equal_for_prefetch_p, maybe_eliminate_biv,
canonicalize_condition): Likewise.
* loop-iv.c (simplify_using_conditions, iv_number_of_iterations):
Likewise.
* optabs.c (add_equal_node, expand_binop): Likewise.
* predict.c (estimate_probability): Likewise.
* ra-debug.c (ra_print_rtx_2op, ra_print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, comparison_operator,
offsettable_address_p, constrain_operands): Likewise.
* reg-stack.c (swap_rtx_condition_1, subst_stack_regs_pat):
Likewise.
* regclass.c (scan_one_insn): Likewise.
* regmove.c (stable_and_no_regs_but_for_p): Likewise.
* regrename.c (kill_autoinc_value): Likewise.
* reload.c (find_reusable_reload, find_reloads,
reg_overlap_mentioned_for_reload_p): Likewise.
* reload1.c (gen_reload, delete_address_reloads_1): Likewise.
* rtl.c (copy_rtx): Likewise.
* rtl.h (CONSTANT_P, INSN_P): Likewise.
* rtlanal.c (commutative_operand_precedence): Likewise.
* sched-deps.c (conditions_mutex_p): Likewise.
* sched-rgn.c (is_cfg_nonregular): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational, simplify_replace_rtx,
simplify_unary_operation, simplify_binary_operation,
simplify_ternary_operation, simplify_rtx): Likewise.
* unroll.c (reg_dead_after_loop): Likewise.
* config/alpha/alpha.c (alpha_swapped_comparison_operator,
print_operand): Likewise.
* config/arc/arc.c (proper_comparison_operator): Likewise.
* config/arm/arm.c (arm_arm_address_cost, arm_select_cc_mode):
Likewise.
* config/avr/avr.c (_reg_unused_after): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests,
frv_ifcvt_modify_insn, frv_pack_insn): Likewise.
* config/i386/i386.c (ix86_comparison_operator,
ix86_carry_flag_operator, fcmov_comparison_operator,
arith_or_logical_operator, print_operand,
ix86_expand_binary_operator, ix86_binary_operator_ok):
Likewise.
* config/i386/i386.md: Likewise.
* config/ia64/ia64.c (not_postinc_memory_operand,
ia64_print_operand, update_set_flags, errata_emit_nops):
Likewise.
* config/ia64/ia64.h (PREFERRED_RELOAD_CLASS,
CONSTRAINT_OK_FOR_S): Likewise.
* config/ip2k/ip2k.c (mdr_resequence_xy_yx,
mdr_try_move_dp_reload, ip2k_check_can_adjust_stack_ref,
ip2k_xexp_not_uses_reg_for_mem, ip2k_xexp_not_uses_reg_p,
ip2k_composite_xexp_not_uses_reg_p, ip2k_unary_operator):
Likewise.
* config/iq2000/iq2000.c (cmp_op, symbolic_expression_p,
eqne_comparison_operator, signed_comparison_operator):
Likewise.
* config/mips/mips.c (cmp_op, symbolic_expression_p):
Likewise.
* config/mmix/mmix (mmix_foldable_comparison_operator,
mmix_comparison_operator): Likewise.
* config/pa/pa.c (hppa_legitimize_address): Likewise.
* config/rs6000/rs6000.c (stmw_operation,
branch_comparison_operator, trap_comparison_operator,
ccr_bit): Likewise.
* config/rs6000/rs6000.h (SELECT_CC_MODE): Likewise.
* config/s390/s390.c (s390_alc_comparison,
s390_slb_comparison):L Likewise.
* config/sh/sh.c (gen_block_redirect, reg_unused_after):
Likewise.
* config/sparc/sparc.c (eq_or_neq, normal_comp_operator,
noov_compare_op, noov_compare64_op, v9_regcmp_op,
emit_hard_tfmode_operation, reg_unused_after)
* doc/md.texi, doc/rtl.texi: Likewise.
* ra-debug.c: Add 2004 to list of copyright years.
* unroll.c: Likewise.
* combine.c (simplify_logical): Remove dummy test,
(apply_distributive_law): Fix typo in comment.
GET_CODE (x) == AND so x is a commutative binary op.
* jump.c (delete_related_insns): simplify loop
condition, move testing of RTX codes inside the loop.
(rtx_renumbered_equal_p): do not use RTX_CODE.
* rtl.c (rtx_class): Declare as enum rtx_class.
* rtl.def (EQ, NE, UNEQ, LTGT, UNORDERED, ORDERED):
Move to RTX_COMM_COMPARE class.
(HIGH, SYMBOL_REF, LABEL_REF, CONST, CONST_INT, CONST_DOUBLE):
Move to RTX_CONST_OBJ class.
* rtl.h (enum rtx_class): New declaration,
(RTX_OBJ_MASK, RTX_OBJ_RESULT, RTX_COMPARE_MASK,
RTX_COMPARE_RESULT, RTX_ARITHMETIC_MASK, RTX_ARITHMETIC_RESULT,
RTX_BINARY_MASK, RTX_BINARY_RESULT, RTX_COMMUTATIVE_MASK,
RTX_COMMUTATIVE_RESULT, RTX_NON_COMMUTATIVE_RESULT,
RTX_EXPR_FIRST, RTX_EXPR_LAST, UNARY_P, BINARY_P,
ARITHMETIC_P, COMMUTATIVE_ARITHMETIC_P, COMPARISON_P,
SWAPPABLE_OPERANDS_P, NON_COMMUTATIVE_P, COMMUTATIVE_P,
OBJECT_P): New macros.
* config/sparc/sparc.c (noov_compare_op): Remove register
from parameter.
From-SVN: r78824
2004-03-03 09:35:33 +01:00
|
|
|
|
case RTX_OBJ:
|
2003-07-16 21:34:50 +02:00
|
|
|
|
if (code == LO_SUM)
|
|
|
|
|
{
|
|
|
|
|
/* Convert (lo_sum (high FOO) FOO) to FOO. */
|
|
|
|
|
if (GET_CODE (XEXP (x, 0)) == HIGH
|
|
|
|
|
&& rtx_equal_p (XEXP (XEXP (x, 0), 0), XEXP (x, 1)))
|
|
|
|
|
return XEXP (x, 1);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
1999-11-01 01:18:23 +01:00
|
|
|
|
default:
|
2003-07-16 21:34:50 +02:00
|
|
|
|
break;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|
2003-07-16 21:34:50 +02:00
|
|
|
|
return NULL;
|
1999-11-01 01:18:23 +01:00
|
|
|
|
}
|