gcc/gcc
Matthew Wahab 4ffc8099a7 [PATCH 7/17][ARM] Add FP16 data movement instructions.
gcc/
2016-09-23  Matthew Wahab  <matthew.wahab@arm.com>
	    Jiong Wang <jiong.wang@arm.com>

	* config/arm/arm.c (coproc_secondary_reload_class): Make HFmode
	available when FP16 instructions are available.
	(output_move_vfp): Add support for 16-bit data moves.
	(arm_validize_comparison): Fix some white-space.  Support HFmode
	by conversion to SFmode.
	* config/arm/arm.md (truncdfhf2): Fix a comment.
	(extendhfdf2): Likewise.
	(cstorehf4): New.
	(movsicc): Fix some white-space.
	(movhfcc): New.
	(movsfcc): Fix some white-space.
	(*cmovhf): New.
	* config/arm/vfp.md (*arm_movhi_vfp): Disable when VFP FP16
	instructions are available.
	(*thumb2_movhi_vfp): Likewise.
	(*arm_movhi_fp16): New.
	(*thumb2_movhi_fp16): New.
	(*movhf_vfp_fp16): New.
	(*movhf_vfp_neon): Disable when VFP FP16 instructions are
	available.
	(*movhf_vfp): Likewise.
	(extendhfsf2): Enable when VFP FP16 instructions are available.
	(truncsfhf2):  Enable when VFP FP16 instructions are available.

testsuite/
2016-09-23  Matthew Wahab  <matthew.wahab@arm.com>

	* gcc.target/arm/armv8_2_fp16-move-1.c: New.
	* gcc.target/arm/fp16-aapcs-1.c: Update expected output.


Co-Authored-By: Jiong Wang <jiong.wang@arm.com>

From-SVN: r240407
2016-09-23 09:35:22 +00:00
..
ada * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) 2016-09-23 09:34:43 +02:00
c * c-typeck.c (lvalue_p): Use true and false instead of 1 and 0. 2016-09-16 10:18:06 +00:00
c-family c-common.c (c_common_truthvalue_conversion): Inhibit Wint-in-bool-context warning with from_macro_definition_at. 2016-09-21 20:14:44 +00:00
common
config [PATCH 7/17][ARM] Add FP16 data movement instructions. 2016-09-23 09:35:22 +00:00
cp * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) 2016-09-23 09:34:43 +02:00
doc [PATCH 3/17][Testsuite] Add ARM support for ARMv8.2-A with FP16 arithmetic instructions. 2016-09-23 09:00:34 +00:00
fortran re PR fortran/48298 ([F03] User-Defined Derived-Type IO (DTIO)) 2016-09-22 11:26:59 +00:00
ginclude Define TS 18661-1 CR_DECIMAL_DIG in <float.h>. 2016-09-19 22:53:30 +01:00
go compiler: compile runtime.getcaller{pc,sp} into builtin functions 2016-09-22 20:32:16 +00:00
java class.c (push_super_field): Set DECL_CONTEXT. 2016-09-22 10:54:41 +00:00
jit
lto Add IPA VRP 2016-09-20 23:29:05 +00:00
objc ChangeLog formatting fixes. 2016-09-05 21:42:42 +02:00
objcp ChangeLog formatting fixes. 2016-09-05 21:42:42 +02:00
po ChangeLog formatting fixes. 2016-09-05 21:42:42 +02:00
testsuite [PATCH 7/17][ARM] Add FP16 data movement instructions. 2016-09-23 09:35:22 +00:00
ABOUT-GCC-NLS
acinclude.m4
aclocal.m4
addresses.h
alias.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
alias.h
alloc-pool.c
alloc-pool.h
asan.c
asan.h
attribs.c
attribs.h
auto-inc-dec.c
auto-profile.c
auto-profile.h
backend.h
BASE-VER
basic-block.h
bb-reorder.c
bb-reorder.h
bitmap.c
bitmap.h
bt-load.c
builtin-attrs.def
builtin-types.def
builtins.c re PR middle-end/77624 (ICE on x86_64-linux-gnu (internal compiler error: in fold_builtin_atomic_always_lock_free, at builtins.c:5583)) 2016-09-20 15:48:40 +02:00
builtins.def
builtins.h
caller-save.c
calls.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
calls.h
ccmp.c
ccmp.h
cfg-flags.def
cfg.c cfg.c (free_original_copy_tables): Replace second assignment of bb_copy = NULL by bb_original = NULL. 2016-09-02 17:00:38 +00:00
cfg.h
cfganal.c
cfganal.h
cfgbuild.c
cfgbuild.h
cfgcleanup.c make next/prev active_insn and active_insn_p take rtx_insn * 2016-09-22 13:16:41 +00:00
cfgcleanup.h
cfgexpand.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
cfgexpand.h
cfghooks.c
cfghooks.h
cfgloop.c
cfgloop.h make next/prev nondebug_insn take rtx_insn * 2016-09-22 13:16:23 +00:00
cfgloopanal.c
cfgloopmanip.c
cfgloopmanip.h
cfgrtl.c
cfgrtl.h
cgraph.c Add IPA VRP 2016-09-20 23:29:05 +00:00
cgraph.h
cgraphbuild.c
cgraphclones.c
cgraphunit.c Add IPA VRP 2016-09-20 23:29:05 +00:00
ChangeLog [PATCH 7/17][ARM] Add FP16 data movement instructions. 2016-09-23 09:35:22 +00:00
ChangeLog-1997
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog.dataflow
ChangeLog.gimple-classes
ChangeLog.graphite
ChangeLog.jit
ChangeLog.lib
ChangeLog.ptr
ChangeLog.tree-ssa
ChangeLog.tuples
chkp-builtins.def
cif-code.def
cilk-builtins.def
cilk-common.c
cilk.h
cilkplus.def
collect2-aix.c
collect2-aix.h
collect2.c
collect2.h
collect-utils.c
collect-utils.h
combine-stack-adj.c
combine.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
common.md
common.opt Add IPA VRP 2016-09-20 23:29:05 +00:00
compare-elim.c
conditions.h
config.build
config.gcc Infer architecture from ABI for mips-mti* and mips-img* triplets. 2016-09-14 19:59:59 +00:00
config.host
config.in re PR target/77267 (MPX does not work in a presence of "-Wl,-as-needed" option (Ubuntu default)) 2016-09-09 14:38:06 -07:00
configure re PR target/77267 (MPX does not work in a presence of "-Wl,-as-needed" option (Ubuntu default)) 2016-09-09 14:38:06 -07:00
configure.ac re PR target/77267 (MPX does not work in a presence of "-Wl,-as-needed" option (Ubuntu default)) 2016-09-09 14:38:06 -07:00
context.c
context.h
convert.c
convert.h
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
coretypes.h
coverage.c
coverage.h
cppbuiltin.c
cppbuiltin.h
cppdefault.c
cppdefault.h
cprop.c
cse.c make next/prev _nonnote_insn take rtx_insn * 2016-09-22 13:16:17 +00:00
cselib.c
cselib.h
cstamp-h.in
data-streamer-in.c
data-streamer-out.c
data-streamer.c
data-streamer.h
DATESTAMP Daily bump. 2016-09-23 00:16:16 +00:00
dbgcnt.c
dbgcnt.def
dbgcnt.h
dbxout.c * dbxout.c (xcoff_debug_hooks): Add filename parameter to early_finish hook. 2016-09-20 12:37:08 -04:00
dbxout.h
dce.c
dce.h
ddg.c
ddg.h
debug.c debug.h (gcc_debug_hooks): Add filename parameter to early_finish hook. 2016-09-20 07:37:53 +00:00
debug.h debug.h (gcc_debug_hooks): Add filename parameter to early_finish hook. 2016-09-20 07:37:53 +00:00
defaults.h
DEV-PHASE
df-core.c
df-problems.c
df-scan.c tm.texi.in (INITIAL_FRAME_POINTER_OFFSET): Remove. 2016-09-09 23:08:54 +00:00
df.h
dfp.c
dfp.h
diagnostic-color.c Introduce class edit_context 2016-09-02 18:00:57 +00:00
diagnostic-color.h
diagnostic-core.h
diagnostic-show-locus.c fix-it hints can't contain newlines 2016-09-15 23:57:01 +00:00
diagnostic.c fix-it hints: insert_before vs insert_after 2016-09-13 16:08:59 +00:00
diagnostic.def
diagnostic.h Add -fdiagnostics-generate-patch 2016-09-02 19:41:17 +00:00
dojump.c
dojump.h
dominance.c
dominance.h
domwalk.c
domwalk.h
double-int.c
double-int.h
dse.c
dumpfile.c
dumpfile.h
dwarf2asm.c dwarf2asm.h (dw2_asm_output_offset): Add overload with extra offset argument. 2016-09-15 10:22:32 +00:00
dwarf2asm.h dwarf2asm.h (dw2_asm_output_offset): Add overload with extra offset argument. 2016-09-15 10:22:32 +00:00
dwarf2cfi.c
dwarf2out.c make prev_real_insn take rtx_insn * 2016-09-22 13:16:30 +00:00
dwarf2out.h
edit-context.c fix-it hints: insert_before vs insert_after 2016-09-13 16:08:59 +00:00
edit-context.h Introduce class edit_context 2016-09-02 18:00:57 +00:00
emit-rtl.c make next_cc0_user take rtx_insn * 2016-09-22 13:17:34 +00:00
emit-rtl.h
errors.c
errors.h
et-forest.c
et-forest.h
except.c
except.h
exec-tool.in
explow.c re PR target/77452 (ICE: in plus_constant, at explow.c:87 with -fno-split-wide-types -mavx512f --param=max-combine-insns=2) 2016-09-05 16:44:19 +02:00
explow.h
expmed.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
expmed.h
expr.c * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) 2016-09-23 09:34:43 +02:00
expr.h
fibonacci_heap.c
fibonacci_heap.h
file-find.c
file-find.h
final.c
fixed-value.c
fixed-value.h
flag-types.h
flags.h
fold-const-call.c
fold-const-call.h
fold-const.c * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) 2016-09-23 09:34:43 +02:00
fold-const.h
fp-test.c
FSFChangeLog
FSFChangeLog.10
FSFChangeLog.11
function-tests.c
function.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
function.h
fwprop.c
gcc-ar.c
gcc-main.c
gcc-plugin.h
gcc-rich-location.c
gcc-rich-location.h
gcc-symtab.h
gcc.c
gcc.h
gcov-counter.def
gcov-dump.c
gcov-io.c
gcov-io.h
gcov-iov.c
gcov-tool.c
gcov.c
gcse-common.c
gcse-common.h
gcse.c
gcse.h
gdbasan.in
gdbhooks.py
gdbinit.in
gen-pass-instances.awk
genattr-common.c
genattr.c
genattrtab.c
genautomata.c
gencfn-macros.c
gencheck.c
genchecksum.c
gencodes.c
genconditions.c
genconfig.c
genconstants.c Introduce class rtx_reader 2016-09-21 20:55:06 +00:00
genemit.c
genenums.c Introduce class rtx_reader 2016-09-21 20:55:06 +00:00
generic-match-head.c
generic-match.h
genextract.c
genflags.c
gengenrtl.c
gengtype-lex.l
gengtype-parse.c
gengtype-state.c
gengtype.c
gengtype.h
genhooks.c
genmatch.c c-ada-spec.c (dump_ada_function_declaration): Increase buffer size to guarantee it fits the output of the formatted function... 2016-09-01 16:47:49 -06:00
genmddeps.c Introduce class rtx_reader 2016-09-21 20:55:06 +00:00
genmddump.c
genmodes.c c-ada-spec.c (dump_ada_function_declaration): Increase buffer size to guarantee it fits the output of the formatted function... 2016-09-01 16:47:49 -06:00
genmultilib
genopinit.c
genoutput.c
genpeep.c
genpreds.c Introduce class rtx_reader 2016-09-21 20:55:06 +00:00
genrecog.c
gensupport.c Introduce class rtx_reader 2016-09-21 20:55:06 +00:00
gensupport.h Introduce class rtx_reader 2016-09-21 20:55:06 +00:00
gentarget-def.c
ggc-common.c
ggc-internal.h
ggc-none.c
ggc-page.c
ggc-tests.c
ggc.h
gimple-builder.c
gimple-builder.h
gimple-expr.c
gimple-expr.h
gimple-fold.c re PR tree-optimization/77697 (suspicious code in tree-ssa-forwprop.c) 2016-09-22 12:16:42 +00:00
gimple-fold.h PR middle-end/49905 - Better sanity checking on sprintf src & dest to 2016-09-20 19:39:27 -06:00
gimple-iterator.c
gimple-iterator.h
gimple-laddress.c
gimple-low.c
gimple-low.h
gimple-match-head.c re PR tree-optimization/77677 (ICE at -O1 and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in set_value_range, at tree-vrp.c:361)) 2016-09-22 12:16:12 +00:00
gimple-match.h
gimple-predict.h
gimple-pretty-print.c
gimple-pretty-print.h
gimple-ssa-backprop.c
gimple-ssa-isolate-paths.c
gimple-ssa-nonnull-compare.c
gimple-ssa-split-paths.c
gimple-ssa-sprintf.c PR target/77676 - powerpc64 and powerpc64le stage2 bootstrap fail 2016-09-22 15:28:07 -06:00
gimple-ssa-strength-reduction.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
gimple-ssa.h
gimple-streamer-in.c
gimple-streamer-out.c
gimple-streamer.h
gimple-walk.c
gimple-walk.h
gimple.c
gimple.def
gimple.h
gimplify-me.c
gimplify-me.h
gimplify.c Make canonical_va_list_type more strict 2016-09-10 14:38:56 +00:00
gimplify.h
glimits.h Define TS 18661-1 type width macros in <limits.h> and <stdint.h>. 2016-09-09 17:59:43 +01:00
godump.c
graph.c
graph.h
graphds.c
graphds.h
graphite-dependences.c
graphite-isl-ast-to-gimple.c
graphite-optimize-isl.c
graphite-poly.c
graphite-scop-detection.c
graphite-sese-to-poly.c
graphite.c
graphite.h
gsstruct.def
gstab.h
gsyms.h
gsyslimits.h
gtm-builtins.def
haifa-sched.c
hard-reg-set.h
hash-map-tests.c
hash-map-traits.h
hash-map.h
hash-set-tests.c
hash-set.h
hash-table.c
hash-table.h
hash-traits.h
highlev-plugin-common.h
hooks.c [ARM] Add support for -mpure-code option 2016-09-22 17:02:47 +00:00
hooks.h hooks.h (hook_uint_uintp_false): Declare. 2016-09-23 07:22:32 +00:00
host-default.c
hosthooks-def.h
hosthooks.h
hsa-brig-format.h
hsa-brig.c * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) 2016-09-23 09:34:43 +02:00
hsa-dump.c
hsa-gen.c * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) 2016-09-23 09:34:43 +02:00
hsa-regalloc.c
hsa.c
hsa.h
hw-doloop.c
hw-doloop.h
hwint.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
hwint.h Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
ifcvt.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
ifcvt.h
inchash.c
inchash.h
incpath.c
incpath.h
init-regs.c
input.c Introduce class edit_context 2016-09-02 18:00:57 +00:00
input.h Add from_macro_definition_at predicate for locations. 2016-09-21 15:59:29 -04:00
insn-addr.h
insn-notes.def
internal-fn.c re PR middle-end/77594 (double computation for __builtin_sub_overflow (0, ...)) 2016-09-16 09:09:27 +02:00
internal-fn.def
internal-fn.h
intl.c
intl.h
ipa-chkp.c
ipa-chkp.h
ipa-comdats.c
ipa-cp.c Add IPA VRP 2016-09-20 23:29:05 +00:00
ipa-devirt.c Add IPA VRP 2016-09-20 23:29:05 +00:00
ipa-hsa.c
ipa-icf-gimple.c * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) 2016-09-23 09:34:43 +02:00
ipa-icf-gimple.h
ipa-icf.c Fix typo in IPA ICF 2016-09-23 08:49:41 +00:00
ipa-icf.h
ipa-inline-analysis.c ipa-inline-analysis.c (param_change_prob): Get to the base object first in all cases. 2016-09-01 15:56:13 +00:00
ipa-inline-transform.c Add IPA VRP 2016-09-20 23:29:05 +00:00
ipa-inline.c Add IPA VRP 2016-09-20 23:29:05 +00:00
ipa-inline.h
ipa-polymorphic-call.c
ipa-profile.c Add IPA VRP 2016-09-20 23:29:05 +00:00
ipa-prop.c Add IPA VRP 2016-09-20 23:29:05 +00:00
ipa-prop.h Add IPA VRP 2016-09-20 23:29:05 +00:00
ipa-pure-const.c re PR sanitizer/77396 (address sanitizer crashes if all static global variables are optimized) 2016-09-02 19:11:42 +02:00
ipa-ref.c
ipa-ref.h
ipa-reference.c
ipa-reference.h
ipa-split.c
ipa-utils.c Add IPA VRP 2016-09-20 23:29:05 +00:00
ipa-utils.h
ipa-visibility.c
ipa.c Add IPA VRP 2016-09-20 23:29:05 +00:00
ira-build.c
ira-color.c
ira-conflicts.c
ira-costs.c
ira-emit.c
ira-int.h
ira-lives.c
ira.c tm.texi.in (INITIAL_FRAME_POINTER_OFFSET): Remove. 2016-09-09 23:08:54 +00:00
ira.h
is-a.h
jump.c make next/prev nonnote_nondebug_insn take rtx_insn * 2016-09-22 13:16:35 +00:00
langhooks-def.h Move class substring_loc from c-family into gcc 2016-09-07 16:56:23 +00:00
langhooks.c Move class substring_loc from c-family into gcc 2016-09-07 16:56:23 +00:00
langhooks.h Move class substring_loc from c-family into gcc 2016-09-07 16:56:23 +00:00
LANGUAGES
lcm.c
lcm.h
libfuncs.h
limitx.h
limity.h
lists.c
lock-and-run.sh
loop-doloop.c make next/prev nondebug_insn take rtx_insn * 2016-09-22 13:16:23 +00:00
loop-init.c
loop-invariant.c
loop-iv.c
loop-unroll.c loop-unroll.c (unroll_loop_runtime_iterations): Set probability of succ edge. 2016-09-14 17:04:18 +00:00
loop-unroll.h
lower-subreg.c
lower-subreg.h
lra-assigns.c
lra-coalesce.c
lra-constraints.c re PR rtl-optimization/77289 (ICE in extract_constrain_insn, at recog.c:2212 on powerpc64) 2016-09-13 21:25:04 +00:00
lra-eliminations.c tm.texi.in (INITIAL_FRAME_POINTER_OFFSET): Remove. 2016-09-09 23:08:54 +00:00
lra-int.h
lra-lives.c
lra-remat.c re PR rtl-optimization/77416 (LRA rematerializing use of CA reg across function call) 2016-09-19 21:38:27 +00:00
lra-spills.c
lra.c
lra.h
lto-cgraph.c
lto-compress.c
lto-compress.h
lto-opts.c
lto-section-in.c
lto-section-names.h
lto-section-out.c
lto-streamer-in.c
lto-streamer-out.c
lto-streamer.c
lto-streamer.h
lto-wrapper.c
machmode.def
machmode.h
main.c
Makefile.in PR middle-end/49905 - Better sanity checking on sprintf src & dest to 2016-09-20 19:39:27 -06:00
match.pd match.pd: Revert a * (1 << b) relaxation. 2016-08-31 18:22:58 +00:00
mcf.c
mem-stats-traits.h
mem-stats.h
memory-block.cc
memory-block.h
mkconfig.sh
mode-classes.def
mode-switching.c
modulo-sched.c
multiple_target.c
omp-builtins.def
omp-low.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
omp-low.h
omp-simd-clone.c Iterator to visit SSA 2016-09-15 02:03:51 +00:00
ONEWS
opt-functions.awk
opt-gather.awk
opt-include.awk
opt-read.awk
optabs-libfuncs.c
optabs-libfuncs.h
optabs-query.c
optabs-query.h
optabs-tree.c
optabs-tree.h
optabs.c * optabs.c (prepare_cmp_insn): Update documentation comment. 2016-09-13 09:47:10 +00:00
optabs.def
optabs.h
optc-gen.awk
optc-save-gen.awk
opth-gen.awk
opts-common.c re PR middle-end/77475 (unnecessary or misleading context in reporting command line problems) 2016-09-13 10:45:36 +02:00
opts-diagnostic.h
opts-global.c
opts.c Add IPA VRP 2016-09-20 23:29:05 +00:00
opts.h re PR middle-end/77475 (unnecessary or misleading context in reporting command line problems) 2016-09-13 10:45:36 +02:00
output.h
params-enum.h
params-list.h
params-options.h
params.c
params.def
params.h
pass_manager.h
passes.c c-ada-spec.c (dump_ada_function_declaration): Increase buffer size to guarantee it fits the output of the formatted function... 2016-09-01 16:47:49 -06:00
passes.def PR middle-end/49905 - Better sanity checking on sprintf src & dest to 2016-09-20 19:39:27 -06:00
plugin.c
plugin.def
plugin.h
postreload-gcse.c
postreload.c
predict.c Add braces to a condition in predict.c (PR middle-end/77574) 2016-09-14 07:18:53 +00:00
predict.def
predict.h
prefix.c
prefix.h
pretty-print.c PR c/77520 - wrong value for extended ASCII characters in -Wformat message 2016-09-09 17:12:10 -06:00
pretty-print.h
print-rtl.c
print-rtl.h
print-tree.c * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) 2016-09-23 09:34:43 +02:00
print-tree.h
profile.c
profile.h
read-md.c Introduce class rtx_reader 2016-09-21 20:55:06 +00:00
read-md.h Introduce class rtx_reader 2016-09-21 20:55:06 +00:00
read-rtl.c Introduce class rtx_reader 2016-09-21 20:55:06 +00:00
README.Portability
real.c
real.h
realmpfr.c
realmpfr.h
recog.c recog.c (rest_of_handle_split_after_reload): Delete. 2016-09-16 21:39:05 +00:00
recog.h
ree.c
reg-notes.def
reg-stack.c
regcprop.c Revert accidental commit. 2016-09-22 15:20:43 +00:00
regcprop.h
reginfo.c
regrename.c
regrename.h
regs.h
regset.h
regstat.c
reload1.c tm.texi.in (INITIAL_FRAME_POINTER_OFFSET): Remove. 2016-09-09 23:08:54 +00:00
reload.c
reload.h
reorg.c make next/prev active_insn and active_insn_p take rtx_insn * 2016-09-22 13:16:41 +00:00
resource.c make next/prev active_insn and active_insn_p take rtx_insn * 2016-09-22 13:16:41 +00:00
resource.h
rtl-chkp.c
rtl-chkp.h
rtl-error.c
rtl-error.h
rtl-iter.h
rtl-tests.c
rtl.c
rtl.def
rtl.h make next_cc0_user take rtx_insn * 2016-09-22 13:17:34 +00:00
rtlanal.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
rtlhash.c
rtlhash.h
rtlhooks-def.h
rtlhooks.c
sancov.c
sanitizer.def
sanopt.c re PR sanitizer/77396 (address sanitizer crashes if all static global variables are optimized) 2016-09-02 19:11:42 +02:00
sbitmap.c
sbitmap.h
sched-deps.c
sched-ebb.c
sched-int.h re PR rtl-optimization/77425 (Pointer test follows dereference in sched-int.h) 2016-09-15 14:27:35 +02:00
sched-rgn.c
sdbout.c debug.h (gcc_debug_hooks): Add filename parameter to early_finish hook. 2016-09-20 07:37:53 +00:00
sdbout.h
sel-sched-dump.c
sel-sched-dump.h
sel-sched-ir.c
sel-sched-ir.h
sel-sched.c
sel-sched.h
selftest-run-tests.c Introduce class edit_context 2016-09-02 18:00:57 +00:00
selftest.c selftest.c: avoid explicit "selftest::" qualifiers 2016-08-31 13:22:43 +00:00
selftest.h Introduce class edit_context 2016-09-02 18:00:57 +00:00
sese.c
sese.h
shrink-wrap.c
shrink-wrap.h
signop.h
simplify-rtx.c make next/prev _nonnote_insn take rtx_insn * 2016-09-22 13:16:17 +00:00
sparseset.c
sparseset.h
spellcheck-tree.c
spellcheck-tree.h
spellcheck.c
spellcheck.h
sreal.c
sreal.h
ssa-iterators.h
ssa.h
stab.def
stack-ptr-mod.c
statistics.c
statistics.h
stmt.c
stmt.h
stor-layout.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
stor-layout.h
store-motion.c
streamer-hooks.c
streamer-hooks.h
stringpool.c
stringpool.h
substring-locations.c Move class substring_loc from c-family into gcc 2016-09-07 16:56:23 +00:00
substring-locations.h Move class substring_loc from c-family into gcc 2016-09-07 16:56:23 +00:00
symbol-summary.h
symtab.c
sync-builtins.def
system.h
target-def.h
target-globals.c
target-globals.h
target-hooks-macros.h
target-insns.def
target.def [ARM] Add support for -mpure-code option 2016-09-22 17:02:47 +00:00
target.h
targhooks.c PR middle-end/49905 - Better sanity checking on sprintf src & dest to 2016-09-20 19:39:27 -06:00
targhooks.h PR middle-end/49905 - Better sanity checking on sprintf src & dest to 2016-09-20 19:39:27 -06:00
timevar.c
timevar.def Add Early VRP 2016-09-20 23:23:55 +00:00
timevar.h
tlink.c
toplev.c Add IPA VRP 2016-09-20 23:29:05 +00:00
toplev.h
tracer.c
tracer.h
trans-mem.c
trans-mem.h
tree-affine.c
tree-affine.h
tree-call-cdce.c
tree-cfg.c Iterator to visit SSA 2016-09-15 02:03:51 +00:00
tree-cfg.h
tree-cfgcleanup.c
tree-cfgcleanup.h
tree-chkp-opt.c
tree-chkp.c
tree-chkp.h
tree-chrec.c re PR middle-end/77436 (Incorrect constant result for summing loop inserted) 2016-09-01 13:38:25 +00:00
tree-chrec.h
tree-complex.c
tree-core.h
tree-data-ref.c re PR tree-optimization/77605 (wrong code at -O3 on x86_64-linux-gnu) 2016-09-19 06:55:17 +00:00
tree-data-ref.h
tree-dfa.c
tree-dfa.h
tree-diagnostic.c
tree-diagnostic.h
tree-dump.c * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) 2016-09-23 09:34:43 +02:00
tree-dump.h
tree-eh.c
tree-eh.h
tree-emutls.c
tree-hash-traits.h
tree-hasher.h
tree-if-conv.c
tree-inline.c re PR tree-optimization/77665 (ICE in expand_GOMP_SIMD_VF, at internal-fn.c:172) 2016-09-22 13:17:24 +02:00
tree-inline.h
tree-into-ssa.c Iterator to visit SSA 2016-09-15 02:03:51 +00:00
tree-into-ssa.h
tree-iterator.c
tree-iterator.h
tree-loop-distribution.c
tree-nested.c
tree-nested.h
tree-nrv.c
tree-object-size.c PR tree-optimization/71831 - __builtin_object_size poor results with no 2016-09-01 20:14:50 -06:00
tree-object-size.h PR tree-optimization/71831 - __builtin_object_size poor results with no 2016-09-01 20:14:50 -06:00
tree-outof-ssa.c
tree-outof-ssa.h
tree-parloops.c
tree-parloops.h
tree-pass.h PR middle-end/49905 - Better sanity checking on sprintf src & dest to 2016-09-20 19:39:27 -06:00
tree-phinodes.c
tree-phinodes.h
tree-predcom.c
tree-pretty-print.c * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) 2016-09-23 09:34:43 +02:00
tree-pretty-print.h
tree-profile.c Detect whether target can use -fprofile-update=atomic 2016-09-06 14:13:21 +00:00
tree-scalar-evolution.c
tree-scalar-evolution.h
tree-sra.c * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...) 2016-09-23 09:34:43 +02:00
tree-ssa-address.c
tree-ssa-address.h
tree-ssa-alias.c Iterator to visit SSA 2016-09-15 02:03:51 +00:00
tree-ssa-alias.h
tree-ssa-ccp.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
tree-ssa-ccp.h
tree-ssa-coalesce.c Iterator to visit SSA 2016-09-15 02:03:51 +00:00
tree-ssa-coalesce.h
tree-ssa-copy.c Iterator to visit SSA 2016-09-15 02:03:51 +00:00
tree-ssa-dce.c
tree-ssa-dom.c re PR tree-optimization/77454 (IMM ERROR w/ -O2 and above) 2016-09-13 21:19:33 +02:00
tree-ssa-dom.h
tree-ssa-dse.c
tree-ssa-forwprop.c
tree-ssa-ifcombine.c
tree-ssa-live.c
tree-ssa-live.h
tree-ssa-loop-ch.c
tree-ssa-loop-im.c
tree-ssa-loop-ivcanon.c
tree-ssa-loop-ivopts.c re PR tree-optimization/77444 (Bogus assignments in cand_value_at) 2016-09-02 19:12:27 +02:00
tree-ssa-loop-ivopts.h
tree-ssa-loop-manip.c
tree-ssa-loop-manip.h
tree-ssa-loop-niter.c
tree-ssa-loop-niter.h
tree-ssa-loop-prefetch.c
tree-ssa-loop-unswitch.c
tree-ssa-loop.c
tree-ssa-loop.h
tree-ssa-math-opts.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
tree-ssa-operands.c Iterator to visit SSA 2016-09-15 02:03:51 +00:00
tree-ssa-operands.h
tree-ssa-phionlycprop.c
tree-ssa-phiopt.c
tree-ssa-phiprop.c
tree-ssa-pre.c re PR tree-optimization/77514 (ICE in VN_INFO_GET, at tree-ssa-sccvn.c:406 w/ -O2 (and above)) 2016-09-19 06:54:10 +00:00
tree-ssa-propagate.c Add Early VRP 2016-09-20 23:23:55 +00:00
tree-ssa-propagate.h Add Early VRP 2016-09-20 23:23:55 +00:00
tree-ssa-reassoc.c Incorrect arithmetic optimization involving bitfield arguments 2016-09-21 03:28:24 +00:00
tree-ssa-sccvn.c re PR tree-optimization/77646 (GCC Segfault with -O3) 2016-09-20 12:20:37 +00:00
tree-ssa-sccvn.h
tree-ssa-scopedtables.c
tree-ssa-scopedtables.h
tree-ssa-sink.c
tree-ssa-strlen.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
tree-ssa-structalias.c re PR tree-optimization/77648 (Setting conversion to a integer to double to 0 3/4 through a loop) 2016-09-21 07:38:33 +00:00
tree-ssa-tail-merge.c
tree-ssa-ter.c Iterator to visit SSA 2016-09-15 02:03:51 +00:00
tree-ssa-ter.h
tree-ssa-threadbackward.c passes.def (pass_early_thread_jumps): Schedule after forwprop. 2016-09-18 18:44:53 +00:00
tree-ssa-threadbackward.h
tree-ssa-threadedge.c
tree-ssa-threadedge.h
tree-ssa-threadupdate.c
tree-ssa-threadupdate.h
tree-ssa-uncprop.c
tree-ssa-uninit.c
tree-ssa.c Iterator to visit SSA 2016-09-15 02:03:51 +00:00
tree-ssa.h
tree-ssanames.c
tree-ssanames.h Iterator to visit SSA 2016-09-15 02:03:51 +00:00
tree-stdarg.c
tree-stdarg.h
tree-streamer-in.c
tree-streamer-out.c
tree-streamer.c
tree-streamer.h
tree-switch-conversion.c
tree-tailcall.c
tree-vect-data-refs.c re PR tree-optimization/77621 (Internal compiler error for mtune=atom + msse2) 2016-09-21 07:37:18 +00:00
tree-vect-generic.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
tree-vect-loop-manip.c
tree-vect-loop.c re PR tree-optimization/77503 (ICE in vect_transform_stmt compiling postgresql) 2016-09-15 16:31:35 +00:00
tree-vect-patterns.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
tree-vect-slp.c
tree-vect-stmts.c re PR tree-optimization/77550 (std::deque with -O3 has infinite std::distance) 2016-09-21 13:03:59 +00:00
tree-vectorizer.c
tree-vectorizer.h re PR tree-optimization/77503 (ICE in vect_transform_stmt compiling postgresql) 2016-09-15 16:31:35 +00:00
tree-vrp.c Use ipa-vrp result in tree-vrp 2016-09-20 23:41:01 +00:00
tree-vrp.h
tree.c
tree.def
tree.h
treestruct.def
tsan.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
tsan.h
tsystem.h
typeclass.h
typed-splay-tree.c Improvements to typed_splay_tree 2016-09-02 15:22:21 +00:00
typed-splay-tree.h Improvements to typed_splay_tree 2016-09-02 15:22:21 +00:00
ubsan.c ubsan.c (ubsan_use_new_style_p): Fix check for empty string. 2016-09-03 10:57:05 +00:00
ubsan.h
valtrack.c
valtrack.h
value-prof.c
value-prof.h
var-tracking.c Add inline functions for various bitwise operations. 2016-09-16 15:20:44 -04:00
varasm.c PR target/77676 - powerpc64 and powerpc64le stage2 bootstrap fail 2016-09-22 15:28:07 -06:00
varasm.h
varpool.c
vec.c
vec.h
version.c
version.h
vmsdbg.h
vmsdbgout.c
vtable-verify.c
vtable-verify.h
web.c
wide-int-print.cc
wide-int-print.h
wide-int.cc
wide-int.h
xcoff.h
xcoffout.c
xcoffout.h

Copyright (C) 2000-2016 Free Software Foundation, Inc.

This file is intended to contain a few notes about writing C code
within GCC so that it compiles without error on the full range of
compilers GCC needs to be able to compile on.

The problem is that many ISO-standard constructs are not accepted by
either old or buggy compilers, and we keep getting bitten by them.
This knowledge until now has been sparsely spread around, so I
thought I'd collect it in one useful place.  Please add and correct
any problems as you come across them.

I'm going to start from a base of the ISO C90 standard, since that is
probably what most people code to naturally.  Obviously using
constructs introduced after that is not a good idea.

For the complete coding style conventions used in GCC, please read
http://gcc.gnu.org/codingconventions.html


String literals
---------------

Irix6 "cc -n32" and OSF4 "cc" have problems with constant string
initializers with parens around it, e.g.

const char string[] = ("A string");

This is unfortunate since this is what the GNU gettext macro N_
produces.  You need to find a different way to code it.

Some compilers like MSVC++ have fairly low limits on the maximum
length of a string literal; 509 is the lowest we've come across.  You
may need to break up a long printf statement into many smaller ones.


Empty macro arguments
---------------------

ISO C (6.8.3 in the 1990 standard) specifies the following:

If (before argument substitution) any argument consists of no
preprocessing tokens, the behavior is undefined.

This was relaxed by ISO C99, but some older compilers emit an error,
so code like

#define foo(x, y) x y
foo (bar, )

needs to be coded in some other way.


Avoid unnecessary test before free
----------------------------------

Since SunOS 4 stopped being a reasonable portability target,
(which happened around 2007) there has been no need to guard
against "free (NULL)".  Thus, any guard like the following
constitutes a redundant test:

  if (P)
    free (P);

It is better to avoid the test.[*]
Instead, simply free P, regardless of whether it is NULL.

[*] However, if your profiling exposes a test like this in a
performance-critical loop, say where P is nearly always NULL, and
the cost of calling free on a NULL pointer would be prohibitively
high, consider using __builtin_expect, e.g., like this:

  if (__builtin_expect (ptr != NULL, 0))
    free (ptr);



Trigraphs
---------

You weren't going to use them anyway, but some otherwise ISO C
compliant compilers do not accept trigraphs.


Suffixes on Integer Constants
-----------------------------

You should never use a 'l' suffix on integer constants ('L' is fine),
since it can easily be confused with the number '1'.


			Common Coding Pitfalls
			======================

errno
-----

errno might be declared as a macro.


Implicit int
------------

In C, the 'int' keyword can often be omitted from type declarations.
For instance, you can write

  unsigned variable;

as shorthand for

  unsigned int variable;

There are several places where this can cause trouble.  First, suppose
'variable' is a long; then you might think

  (unsigned) variable

would convert it to unsigned long.  It does not.  It converts to
unsigned int.  This mostly causes problems on 64-bit platforms, where
long and int are not the same size.

Second, if you write a function definition with no return type at
all:

  operate (int a, int b)
  {
    ...
  }

that function is expected to return int, *not* void.  GCC will warn
about this.

Implicit function declarations always have return type int.  So if you
correct the above definition to

  void
  operate (int a, int b)
  ...

but operate() is called above its definition, you will get an error
about a "type mismatch with previous implicit declaration".  The cure
is to prototype all functions at the top of the file, or in an
appropriate header.

Char vs unsigned char vs int
----------------------------

In C, unqualified 'char' may be either signed or unsigned; it is the
implementation's choice.  When you are processing 7-bit ASCII, it does
not matter.  But when your program must handle arbitrary binary data,
or fully 8-bit character sets, you have a problem.  The most obvious
issue is if you have a look-up table indexed by characters.

For instance, the character '\341' in ISO Latin 1 is SMALL LETTER A
WITH ACUTE ACCENT.  In the proper locale, isalpha('\341') will be
true.  But if you read '\341' from a file and store it in a plain
char, isalpha(c) may look up character 225, or it may look up
character -31.  And the ctype table has no entry at offset -31, so
your program will crash.  (If you're lucky.)

It is wise to use unsigned char everywhere you possibly can.  This
avoids all these problems.  Unfortunately, the routines in <string.h>
take plain char arguments, so you have to remember to cast them back
and forth - or avoid the use of strxxx() functions, which is probably
a good idea anyway.

Another common mistake is to use either char or unsigned char to
receive the result of getc() or related stdio functions.  They may
return EOF, which is outside the range of values representable by
char.  If you use char, some legal character value may be confused
with EOF, such as '\377' (SMALL LETTER Y WITH UMLAUT, in Latin-1).
The correct choice is int.

A more subtle version of the same mistake might look like this:

  unsigned char pushback[NPUSHBACK];
  int pbidx;
  #define unget(c) (assert(pbidx < NPUSHBACK), pushback[pbidx++] = (c))
  #define get(c) (pbidx ? pushback[--pbidx] : getchar())
  ...
  unget(EOF);

which will mysteriously turn a pushed-back EOF into a SMALL LETTER Y
WITH UMLAUT.


Other common pitfalls
---------------------

o Expecting 'plain' char to be either sign or unsigned extending.

o Shifting an item by a negative amount or by greater than or equal to
  the number of bits in a type (expecting shifts by 32 to be sensible
  has caused quite a number of bugs at least in the early days).

o Expecting ints shifted right to be sign extended.

o Modifying the same value twice within one sequence point.

o Host vs. target floating point representation, including emitting NaNs
  and Infinities in a form that the assembler handles.

o qsort being an unstable sort function (unstable in the sense that
  multiple items that sort the same may be sorted in different orders
  by different qsort functions).

o Passing incorrect types to fprintf and friends.

o Adding a function declaration for a module declared in another file to
  a .c file instead of to a .h file.