Commit Graph

184828 Commits

Author SHA1 Message Date
David Malcolm
60fb5cf454 analyzer: split out struct bit_range from class concrete_binding
gcc/analyzer/ChangeLog:
	* store.cc (concrete_binding::dump_to_pp): Move bulk of
	implementation to...
	(bit_range::dump_to_pp): ...this new function.
	(bit_range::cmp): New.
	(concrete_binding::overlaps_p): Update for use of bit_range.
	(concrete_binding::cmp_ptr_ptr): Likewise.
	* store.h (struct bit_range): New.
	(class concrete_binding): Replace fields m_start_bit_offset and
	m_size_in_bits with new field m_bit_range.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-02 15:19:45 -04:00
David Malcolm
a3a96565e8 analyzer: remove redundant typedef
Delete an overzealous copy&paste.

gcc/analyzer/ChangeLog:
	* svalue.h (conjured_svalue::iterator_t): Delete.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-02 15:19:44 -04:00
David Malcolm
c805b51a71 analyzer: remove unused prototypes
gcc/analyzer/ChangeLog:
	* store.h (store::get_direct_binding): Remove unused decl.
	(store::get_default_binding): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-02 15:19:44 -04:00
David Malcolm
7b2c2f3130 analyzer: show types for poisoned_svalue and compound_svalue
gcc/analyzer/ChangeLog:
	* svalue.cc (poisoned_svalue::dump_to_pp): Dump type.
	(compound_svalue::dump_to_pp): Dump any type.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-02 15:19:44 -04:00
David Malcolm
83dd64bdad diagnostic-show-locus: tweak rejection logic
gcc/ChangeLog:
	* diagnostic-show-locus.c (diagnostic_show_locus): Don't reject
	printing the same location twice if there are fix-it hints,
	multiple locations, or a label.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-02 15:19:44 -04:00
David Malcolm
8d58bfb78c analyzer: fix missing leak after call to strsep [PR100615]
PR analyzer/100615 reports a missing leak diagnostic.
The issue is that the code calls strsep which the analyzer doesn't
have special knowledge of, and so conservatively assumes that it
could free the pointer, so drops malloc state for it.

Properly "teaching" the analyzer about strsep would require it
to support bifurcating state at a call, which is currently fiddly to
do, so for now this patch notes that strsep doesn't affect the
malloc state machine, allowing the analyzer to correctly detect the leak.

gcc/analyzer/ChangeLog:
	PR analyzer/100615
	* sm-malloc.cc: Include "analyzer/function-set.h".
	(malloc_state_machine::on_stmt): Call unaffected_by_call_p and
	bail on the functions it recognizes.
	(malloc_state_machine::unaffected_by_call_p): New.

gcc/testsuite/ChangeLog:
	PR analyzer/100615
	* gcc.dg/analyzer/pr100615.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-02 15:19:43 -04:00
David Malcolm
1187f297f7 analyzer: fix ICE on NULL change.m_expr [PR100244]
PR analyzer/100244 reports an ICE on a -Wanalyzer-free-of-non-heap
due to a case where free_of_non_heap::describe_state_change can be
passed a NULL change.m_expr for a suitably complicated symbolic value.

Bulletproof it by checking for change.m_expr being NULL before
dereferencing it.

gcc/analyzer/ChangeLog:
	PR analyzer/100244
	* sm-malloc.cc (free_of_non_heap::describe_state_change):
	Bulletproof against change.m_expr being NULL.

gcc/testsuite/ChangeLog:
	PR analyzer/100244
	* g++.dg/analyzer/pr100244.C: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-02 15:19:43 -04:00
Eric Botcazou
014e6aa467 Change EH pointer encodings to PC relative on Windows
A big difference between ELF and PE-COFF is that, with the latter, you can
build position-independent executables or DLLs without generating PIC; as
a  matter of fact, flag_pic has historically been forced to 0 for 32-bit:

/* Don't allow flag_pic to propagate since gas may produce invalid code
   otherwise.  */

\
do {
        \
  flag_pic = TARGET_64BIT ? 1 : 0; \
} while (0)

The reason is that the linker builds a .reloc section that collects the
absolute relocations in the generated binary, and the loader uses them to
relocate it at load time if need be (e.g. if --dynamicbase is enabled).

Up to binutils 2.35, the GNU linker didn't build the .reloc section for
executables and defaulted to --enable-auto-image-base for DLLs, which means
that DLLs had an essentially unique load address and, therefore, need not
be relocated by the loader in most cases.

With binutils 2.36 and later, the GNU linker builds a .reloc section for
executables (thus making them PIE), --enable-auto-image-base is disabled
and --dynamicbase is enabled by default, which means that essentially all
the binaries are relocated at load time.

This badly breaks the 32-bit compiler configured to use DWARF-2 EH because
the loader corrupts the .eh_frame section when processing the relocations
contained in the .reloc section.

gcc/
	* config/i386/i386.c (asm_preferred_eh_data_format): Always use the
	PIC encodings for PE-COFF targets.
2021-07-02 10:27:41 +02:00
GCC Administrator
c6f4b2547d Daily bump. 2021-07-02 00:18:20 +00:00
Eric Botcazou
3a17c1663a Use intermediate integer type with proper signedness
This is a minor regression present on mainline and 11 branch, whereby the
value of the Enum_Rep attribute is always unsigned.

gcc/ada/
	PR ada/101094
	* exp_attr.adb (Get_Integer_Type): Return an integer type with the
	same signedness as the input type.
2021-07-01 18:14:13 +02:00
GCC Administrator
c2db680d5b Daily bump. 2021-07-01 00:18:16 +00:00
Pat Haugen
7f954b851a Update Power10 scheduling description for new fused instruction types.
Backported from master:
	2021-06-08  Pat Haugen  <pthaugen@linux.ibm.com>

gcc/ChangeLog:
	* config/rs6000/power10.md (power10-fused-load, power10-fused-store,
	power10-fused_alu, power10-fused-vec, power10-fused-branch): New.
2021-06-30 10:28:26 -05:00
GCC Administrator
444d04fbc4 Daily bump. 2021-06-30 00:18:23 +00:00
Ian Lance Taylor
528ed79401 compiler: in composite literals use temps only for interfaces
For a composite literal we only need to introduce a temporary variable
if we may be converting to an interface type, so only do it then.
This saves over 80% of compilation time when using gccgo to compile
cmd/internal/obj/x86, as the GCC middle-end spends a lot of time
pointlessly computing interactions between temporary variables.

For PR debug/101064
For golang/go#46600

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/331513
2021-06-29 11:01:44 -07:00
Marek Polacek
2cf8d3fc05 c++: Failure to delay noexcept parsing with ptr-operator [PR100752]
We weren't passing 'flags' to the recursive call to cp_parser_declarator
in the ptr-operator case and as an effect, delayed parsing of noexcept
didn't work as advertised.  The following change passes more than just
CP_PARSER_FLAGS_DELAY_NOEXCEPT but that doesn't seem to break anything.

I'm now also passing member_p and static_p, as a consequence, two tests
needed small tweaks.

	PR c++/100752

gcc/cp/ChangeLog:

	* parser.c (cp_parser_declarator): Pass flags down to
	cp_parser_declarator.  Also pass static_p/member_p.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/noexcept69.C: New test.
	* g++.dg/parse/saved1.C: Adjust dg-error.
	* g++.dg/template/crash50.C: Likewise.

(cherry picked from commit f9c80eb12c)
2021-06-29 09:18:40 -04:00
Kewen Lin
f6306457ee rs6000: Fix typos in float128 ISA3.1 support
The recent float128 ISA3.1 support (r12-1340) has some typos,
it makes the libgcc build fail if it's with one binutils
(assembler) which doesn't support Power10 insns.  The error
looks like:

Error: invalid switch -mpower10
Error: unrecognized option -mpower10
... [...libgcc/shared-object.mk:14: float128-p10.o] Error 1

What this patch does are:
  - fix test target typo libgcc_cv_powerpc_3_1_float128_hw
    (written wrongly as libgcc_cv_powerpc_float128_hw, so it's
     going to build ISA3.1 stuffs just when detecting ISA3.0).
  - fix test used for libgcc_cv_powerpc_3_1_float128_hw check.
  - fix test option used for libgcc_cv_powerpc_3_1_float128_hw
    check.
  - remove the ISA3.1 related contents from t-float128-hw.
  - add new macro FLOAT128_HW_INSNS_ISA3_1 to differentiate
    ISA3.1 content from ISA3.0 part in ifunc support.

Bootstrapped/regtested on:
  - powerpc64le-linux-gnu P10
  - powerpc64le-linux-gnu P9 (w/i and w/o p10 supported as)
  - powerpc64-linux-gnu P8 (w/i and w/o p10 supported as)

libgcc/ChangeLog:

	PR target/101235
	* configure: Regenerate.
	* configure.ac (test for libgcc_cv_powerpc_3_1_float128_hw): Fix
	typos among the name, CFLAGS and the test.
	* config/rs6000/t-float128-hw (fp128_3_1_hw_funcs, fp128_3_1_hw_src,
	fp128_3_1_hw_static_obj, fp128_3_1_hw_shared_obj, fp128_3_1_hw_obj):
	Remove.
	* config/rs6000/t-float128-p10-hw (FLOAT128_HW_INSNS): Append
	macro FLOAT128_HW_INSNS_ISA3_1.
	(FP128_3_1_CFLAGS_HW): Fix option typo.
	* config/rs6000/float128-ifunc.c (SW_OR_HW_ISA3_1): Guard this with
	FLOAT128_HW_INSNS_ISA3_1.
	(__floattikf_resolve): Likewise.
	(__floatuntikf_resolve): Likewise.
	(__fixkfti_resolve): Likewise.
	(__fixunskfti_resolve): Likewise.
	(__floattikf): Likewise.
	(__floatuntikf): Likewise.
	(__fixkfti): Likewise.
	(__fixunskfti): Likewise.

(cherry picked from commit 47749c43ac)
2021-06-28 22:12:41 -05:00
GCC Administrator
8c19295e32 Daily bump. 2021-06-29 00:18:12 +00:00
GCC Administrator
680496aa41 Daily bump. 2021-06-28 00:18:00 +00:00
GCC Administrator
3dfa256711 Daily bump. 2021-06-27 00:17:59 +00:00
GCC Administrator
96358cbbdd Daily bump. 2021-06-26 00:18:20 +00:00
Richard Biener
62bbb113ae Fix SLP permute propagation error
This fixes SLP permute propagation to not propagate across operations
that have different semantics on different lanes like for example
the recently added COMPLEX_ADD_ROT90.

2021-06-24  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (vect_optimize_slp): Do not propagate
	across operations that have different semantics on different
	lanes.
2021-06-25 09:25:30 +02:00
Richard Biener
48097089ae tree-optimization/101158 - adjust SLP call matching sequence
This moves the check for same operands after verifying we're
facing compatible calls.

2021-06-22  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101158
	* tree-vect-slp.c (vect_build_slp_tree_1): Move same operand
	checking after checking for matching operation.

	* gfortran.dg/pr101158.f90: New testcase.

(cherry picked from commit 7a22d8a764)
2021-06-25 09:05:06 +02:00
Richard Biener
8dc3768ffb tree-optimization/101151 - fix irreducible region check for sinking
The check whether two blocks are in the same irreducible region
and thus post-dominance checks being unreliable was incomplete
since an irreducible region can contain reducible sub-regions but
if one block is in the irreducible part and one not the check
still doesn't work as expected.

2021-06-22  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101151
	* tree-ssa-sink.c (statement_sink_location): Expand irreducible
	region check.

	* gcc.dg/torture/pr101151.c: New testcase.

(cherry picked from commit a2ef8395fa)
2021-06-25 09:04:25 +02:00
Richard Biener
00ab8e994b tree-optimization/101105 - fix runtime alias test optimization
We were ignoring DR_STEP for VF == 1 which is OK only in case
the scalar order is preserved or both DR steps are the same.

2021-06-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/101105
	* tree-vect-data-refs.c (vect_prune_runtime_alias_test_list):
	Only ignore steps when they are equal or scalar order is preserved.

	* gcc.dg/torture/pr101105.c: New testcase.

(cherry picked from commit 50374fdacb)
2021-06-25 09:04:06 +02:00
Richard Biener
e0dae9c92a middle-end/100672 - fix bogus right shift folding
This fixes the bogus use of TYPE_PRECISION on vector types
from optimizing -((int)x >> 31) into (unsigned)x >> 31.

2021-05-19  Richard Biener  <rguenther@suse.de>

	PR middle-end/100672
	* fold-const.c (fold_negate_expr_1): Use element_precision.
	(negate_expr_p): Likewise.

	* gcc.dg/torture/pr100672.c: New testcase.

(cherry picked from commit 8d51039cb7)
2021-06-25 09:01:31 +02:00
GCC Administrator
49230cc051 Daily bump. 2021-06-25 00:18:34 +00:00
Eric Botcazou
f19b20de1b Emit .file 0 directive earlier in DWARF 5
When the assembler supports it, the compiler automatically passes --gdwarf-5
to it, which has an interesting side effect: any assembly instruction prior
to the first .file directive defines a new line associated with .file 0 in
the .debug_line section and of course the numbering of these implicit lines
has nothing to do with that of the source code.  This can be problematic in
Ada when we do not generate .file/.loc directives for compiled-generated
functions to avoid too jumpy a debugging experience.

gcc/
	* dwarf2out.c (dwarf2out_assembly_start): Emit .file 0 marker here..
	(dwarf2out_finish): ...instead of here.
2021-06-24 14:20:23 +02:00
Eric Botcazou
cfc9fdcec8 Fix --gdwarf-5 configure tests for Windows
The issues are that 1) they use readelf instead of objdump and 2) they use
ELF syntax in the assembly code.

gcc/
	* configure.ac (--gdwarf-5 option): Use objdump instead of readelf.
	(working --gdwarf-4/--gdwarf-5 for all sources): Likewise.
	(--gdwarf-4 not refusing generated .debug_line): Adjust for Windows.
	* configure: Regenerate.
2021-06-24 14:20:12 +02:00
Sandra Loosemore
1a2bbc08d9 Fortran: fix sm computation in CFI_allocate [PR93524]
Backported from trunk.

This patch fixes a bug in setting the step multiplier field in the
C descriptor for array dimensions > 2.

2021-06-21  Sandra Loosemore  <sandra@codesourcery.com>
	    Tobias Burnus  <tobias@codesourcery.com>

libgfortran/
	PR fortran/93524
	* runtime/ISO_Fortran_binding.c (CFI_allocate): Fix
	sm computation.

gcc/testsuite/
	PR fortran/93524
	* gfortran.dg/pr93524.c: New.
	* gfortran.dg/pr93524.f90: New.
2021-06-23 17:59:46 -07:00
GCC Administrator
f754ef63b7 Daily bump. 2021-06-24 00:18:21 +00:00
Aaron Sawdey
ea2f428bfe Do not enable pcrel-opt by default
Backported from trunk.

SPEC2017 testing on p10 shows that this optimization does not have a
positive impact on performance. So we are no longer going to enable it
by default. The test cases for it needed to be updated so they always
enable it to test it.

gcc/

	* config/rs6000/rs6000-cpus.def: Take OPTION_MASK_PCREL_OPT out
	of OTHER_POWER10_MASKS so it will not be enabled by default.

gcc/testsuite/

	* gcc.target/powerpc/pcrel-opt-inc-di.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-df.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-di.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-hi.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-qi.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-sf.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-si.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-ld-vector.c: Enable -mpcrel-opt to
	test it.
	* gcc.target/powerpc/pcrel-opt-st-df.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-di.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-hi.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-qi.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-sf.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-si.c: Enable -mpcrel-opt to test it.
	* gcc.target/powerpc/pcrel-opt-st-vector.c: Enable -mpcrel-opt to
	test it.

(cherry picked from commit b7574ca6ed)
2021-06-23 15:08:48 -05:00
Michael Meissner
8d21764dcb Backport patch from master branch.
Add IEEE 128-bit min/max support on PowerPC.

This patch adds the support for the IEEE 128-bit floating point C minimum and
maximum instructions.  The next patch will add the support for using the
compare and set mask instruction to implement conditional moves.

This patch does not try to re-use the code used for SF/DF min/max
support.  It defines a separate insn for the IEEE 128-bit support.  It
uses the code iterator <minmax> to simplify adding both operations.

GCC will not convert ternary operations into using min/max instructions
provided in this patch unless the user uses -Ofast.  The next patch that adds
conditional move instructions will enable the ternary conversion in many cases.

gcc/
2021-06-23  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/rs6000.c (rs6000_emit_minmax): Add support for ISA
	3.1 IEEE 128-bit floating point xsmaxcqp/xsmincqp instructions.
	* config/rs6000/rs6000.md (s<minmax><mode>3, IEEE128 iterator):
	New insns.

gcc/testsuite/
2021-06-23  Michael Meissner  <meissner@linux.ibm.com>

	* gcc.target/powerpc/float128-minmax-2.c: New test.
2021-06-23 15:02:39 -04:00
Uros Bizjak
e99256fc5e i386: Prevent unwanted combine from LZCNT to BSR [PR101175]
The current RTX pattern for BSR allows combine pass to convert LZCNT insn
to BSR. Note that the LZCNT has a defined behavior to return the operand
size when operand is zero, where BSR has not.

Add a BSR specific setting of zero-flag to RTX pattern of BSR insn
in order to avoid matching unwanted combinations.

2021-06-23  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	PR target/101175
	* config/i386/i386.md (bsr_rex64): Add zero-flag setting RTX.
	(bsr): Ditto.
	(*bsrhi): Remove.
	(clz<mode>2): Update RTX pattern for additions.

gcc/testsuite/

	PR target/101175
	* gcc.target/i386/pr101175.c: New test.

(cherry picked from commit 1e16f2b472)
2021-06-23 16:20:04 +02:00
Jakub Jelinek
f50a222dff openmp: Fix up *_reduction clause handling with UDRs on PARM_DECLs [PR101167]
The following testcase FAILs, because the UDR combiner is invoked incorrectly.
lower_omp_rec_clauses expects that when it sets
DECL_VALUE_EXPR/DECL_HAS_VALUE_EXPR_P
for both the placeholder and the var that everything will be properly
regimplified, but as the variable in question is a PARM_DECL rather than
VAR_DECL, lower_omp_regimplify_p doesn't say that it should be regimplified
and so it is not.

2021-06-23  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/101167
	* omp-low.c (lower_omp_regimplify_p): Regimplify also PARM_DECLs
	and RESULT_DECLs that have DECL_HAS_VALUE_EXPR_P set.

	* testsuite/libgomp.c-c++-common/task-reduction-15.c: New test.

(cherry picked from commit 679506c383)
2021-06-23 15:13:54 +02:00
Jakub Jelinek
b6e4453172 inline-asm: Fix ICE with bitfields in "m" operands [PR100785]
Bitfields, while they live in memory, aren't something inline-asm can easily
operate on.
For C and "=m" or "+m", we were diagnosing bitfields in the past in the
FE, where c_mark_addressable had:
      case COMPONENT_REF:
        if (DECL_C_BIT_FIELD (TREE_OPERAND (x, 1)))
          {
            error
              ("cannot take address of bit-field %qD", TREE_OPERAND (x, 1));
            return false;
          }
but that check got moved in GCC 6 to build_unary_op instead and now we
emit an error during expansion and ICE afterwards (i.e. error-recovery).
For "m" it used to be diagnosed in c_mark_addressable too, but since
GCC 6 it is ice-on-invalid.
For C++, this was never diagnosed in the FE, but used to be diagnosed
in the gimplifier and/or during expansion before 4.8.

The following patch does multiple things:
1) diagnoses it in the FEs
2) simplifies during expansion the inline asm if any errors have been
   reported (similarly how e.g. vregs pass if it detects errors on
   inline-asm either deletes them or simplifies to bare minimum -
   just labels), so that we don't have error-recovery ICEs there

2021-06-11  Jakub Jelinek  <jakub@redhat.com>

	PR inline-asm/100785
gcc/
	* cfgexpand.c (expand_asm_stmt): If errors are emitted,
	remove all inputs, outputs and clobbers from the asm and
	set template to "".
gcc/c/
	* c-typeck.c (c_mark_addressable): Diagnose trying to make
	bit-fields addressable.
gcc/cp/
	* typeck.c (cxx_mark_addressable): Diagnose trying to make
	bit-fields addressable.
gcc/testsuite/
	* c-c++-common/pr100785.c: New test.

(cherry picked from commit 644c2cc5f2)
2021-06-23 15:13:24 +02:00
Martin Liska
914540797a Sync mklog.py from master.
contrib/ChangeLog:

	* mklog.py: Sync.
	* test_mklog.py: Likewise.
2021-06-23 10:10:37 +02:00
Martin Liska
930a883915 contrib: add git-commit-mklog wrapper
contrib/ChangeLog:

	* gcc-git-customization.sh: Use the new wrapper.
	* git-commit-mklog.py: New file.
	* prepare-commit-msg: Support GCC_MKLOG_ARGS.
2021-06-23 09:46:48 +02:00
GCC Administrator
4b8a7cac14 Daily bump. 2021-06-23 00:18:00 +00:00
Thomas Rodgers
c24384efbb libstdc++: Fix for deadlock in std::counting_semaphore [PR100806]
libstdc++-v3/ChangeLog:
	PR libstdc++/100806
	* include/bits/semaphore_base.h (__atomic_semaphore::_M_release):
	Force _M_release() to wake all waiting threads.
	* testsuite/30_threads/semaphore/100806.cc: New test.

(cherry picked from commit e02840c1a9)
2021-06-22 11:07:58 -07:00
liuhongt
d4175a5d9b Fix ICE for vpexpand*.
gcc/ChangeLog

	PR target/100310
	* config/i386/i386-expand.c
	(ix86_expand_special_args_builtin): Keep constm1_operand only
	if it satisfies insn's operand predicate.

gcc/testsuite/ChangeLog

	PR target/100310
	* gcc.target/i386/pr100310.c: New test.
2021-06-22 09:40:46 +08:00
GCC Administrator
c761445840 Daily bump. 2021-06-22 00:18:08 +00:00
Carl Love
88b66b3768 RS6000 Add 128-bit Binary Integer sign extend operations
This patch adds the 128-bit sign extension instruction support and
corresponding builtin support.

RS6000 Add 128-bit Binary Integer sign extend operations

2021-06-08  Carl Love  <cel@us.ibm.com>

gcc/ChangeLog

	* config/rs6000/altivec.h (vec_signextll, vec_signexti, vec_signextq):
	Add define for new builtins.
	* config/rs6000/altivec.md(altivec_vreveti2): Add define_expand.
	* config/rs6000/rs6000-builtin.def (VSIGNEXTI, VSIGNEXTLL):  Add
	overloaded builtin definitions.
	(VSIGNEXTSB2W, VSIGNEXTSH2W, VSIGNEXTSB2D, VSIGNEXTSH2D,VSIGNEXTSW2D,
	VSIGNEXTSD2Q):	Add builtin expansions.
	(SIGNEXT): Add P10 overload definition.
	* config/rs6000/rs6000-call.c (P9V_BUILTIN_VEC_VSIGNEXTI,
	P9V_BUILTIN_VEC_VSIGNEXTLL, P10_BUILTIN_VEC_SIGNEXT): Add
	overloaded argument definitions.
	* config/rs6000/vsx.md (vsx_sign_extend_v2di_v1ti): Add define_insn.
	(vsignextend_v2di_v1ti, vsignextend_qi_<mode>, vsignextend_hi_<mode>,
	vsignextend_si_v2di)[VIlong]: Add define_expand.
	Make define_insn vsx_sign_extend_si_v2di visible.
	* doc/extend.texi:  Add documentation for the vec_signexti,
	vec_signextll builtins and vec_signextq.

gcc/testsuite/ChangeLog

	* gcc.target/powerpc/int_128bit-runnable.c (extsd2q): Update expected
	count.
	Add tests for vec_signextq.
	* gcc.target/powerpc/p9-sign_extend-runnable.c:  New test case.
2021-06-21 17:33:34 -05:00
Carl Love
e7147f01af Conversions between 128-bit integer and floating point values.
The files fixkfti-sw.c and fixunskfti-sw.c are renamed versions of
fixkfti.c and fixunskfti.c respectively to do the conversions in software.
The function names in the files were updated with the rename as well as
some white spaces fixes. The file float128-p10.c contains the functions
for using the ISA 3.1 hardware instructions to perform the conversions.

2021-06-15  Carl Love  <cel@us.ibm.com>

gcc/ChangeLog

	* config/rs6000/rs6000.c (__fixkfti, __fixunskfti, __floattikf,
	__floatuntikf): Names changed to __fixkfti_sw, __fixunskfti_sw,
	__floattikf_sw, __floatuntikf_sw respectively.
	* config/rs6000/rs6000.md (floatti<mode>2, floatunsti<mode>2,
	fix_trunc<mode>ti2, fixuns_trunc<mode>ti2): Add
	define_insn for mode IEEE 128.

gcc/testsuite/ChangeLog

	* gcc.target/powerpc/fp128_conversions.c: New file.
	* gcc.target/powerpc/int_128bit-runnable.c(vextsd2q,
	vcmpuq, vcmpsq, vcmpequq, vcmpequq., vcmpgtsq, vcmpgtsq.
	vcmpgtuq, vcmpgtuq.): Update scan-assembler-times.
	(ppc_native_128bit): Remove dg-require-effective-target.

libgcc/ChangeLog

	* config.host: Add if test and set for
	libgcc_cv_powerpc_3_1_float128_hw.
	* config/rs6000/fixkfti.c: Renamed to fixkfti-sw.c.
	Change calls of __fixkfti to __fixkfti_sw.
	* config/rs6000/fixunskfti.c: Renamed to fixunskfti-sw.c.
	Change calls of __fixunskfti to __fixunskfti_sw.
	* config/rs6000/float128-p10.c (__floattikf_hw,
	__floatuntikf_hw, __fixkfti_hw, __fixunskfti_hw): New file.
	* config/rs6000/float128-ifunc.c (SW_OR_HW_ISA3_1): New macro.
	(__floattikf_resolve, __floatuntikf_resolve, __fixkfti_resolve,
	__fixunskfti_resolve): Add resolve functions.
	(__floattikf, __floatuntikf, __fixkfti, __fixunskfti): New functions.
	* config/rs6000/float128-sed (floattitf, __floatuntitf,
	__fixtfti, __fixunstfti): Add editor commands to change names.
	* config/rs6000/float128-sed-hw (__floattitf,
	__floatuntitf, __fixtfti, __fixunstfti): Add editor commands to
	change names.
	* config/rs6000/floattikf.c: Renamed to floattikf-sw.c.
	* config/rs6000/floatuntikf.c: Renamed to floatuntikf-sw.c.
	* config/rs6000/quad-float128.h (__floattikf_sw,
	__floatuntikf_sw, __fixkfti_sw, __fixunskfti_sw, __floattikf_hw,
	__floatuntikf_hw, __fixkfti_hw, __fixunskfti_hw, __floattikf,
	__floatuntikf, __fixkfti, __fixunskfti): New extern declarations.
	* config/rs6000/t-float128 (floattikf, floatuntikf,
	fixkfti, fixunskfti): Remove file names from fp128_ppc_funcs.
	(floattikf-sw, floatuntikf-sw, fixkfti-sw, fixunskfti-sw): Add
	file names to fp128_ppc_funcs.
	* config/rs6000/t-float128-hw(fp128_3_1_hw_funcs,
	fp128_3_1_hw_src, fp128_3_1_hw_static_obj, fp128_3_1_hw_shared_obj,
	fp128_3_1_hw_obj): Add variables for ISA 3.1 support.
	* config/rs6000/t-float128-p10-hw: New file.
	* configure: Update script for isa 3.1 128-bit float support.
	* configure.ac: Add check for 128-bit float hardware support.
2021-06-21 17:33:31 -05:00
Carl Love
ac9afc035a rs6000, Add test 128-bit shifts for just the int128 type.
This patch also renames and moves the VSX_TI iterator from vsx.md to
VEC_TI in vector.md.  The uses of VEC_TI are also updated.

2021-04-29  Carl Love  <cel@us.ibm.com>

gcc/ChangeLog

	* config/rs6000/altivec.md (altivec_vslq, altivec_vsrq):
	Rename to altivec_vslq_<mode>, altivec_vsrq_<mode>, mode VEC_TI.
	* config/rs6000/vector.md (VEC_TI): Was named VSX_TI in vsx.md.
	(vashlv1ti3): Change to vashl<mode>3, mode VEC_TI.
	(vlshrv1ti3): Change to vlshr<mode>3, mode VEC_TI.
	* config/rs6000/vsx.md (VSX_TI): Remove define_mode_iterator. Update
	uses of VSX_TI to VEC_TI.

gcc/testsuite/ChangeLog

	* gcc.target/powerpc/int_128bit-runnable.c: Add shift_right, shift_left
	tests.
2021-06-21 17:33:29 -05:00
Carl Love
b715c100ba Add 128-bit int to 128-bit DFP (floattitd2) and 128-bit DFP to 128-bit int (fixtdti2) support
2021-06-08  Carl Love  <cel@us.ibm.com>

gcc/ChangeLog

	* config/rs6000/dfp.md (floattitd2, fixtdti2): New define_insns.

gcc/testsuite/ChangeLog

	* gcc.target/powerpc/int_128bit-runnable.c: Add 128-bit DFP
	conversion tests.
2021-06-21 17:33:26 -05:00
Carl Love
2937d4d291 RS6000 add 128-bit Integer Operations part 1
2021-06-015  Carl Love  <cel@us.ibm.com>

gcc/ChangeLog

	* config/rs6000/altivec.h (vec_dive, vec_mod): Add define for new
	builtins.
	* config/rs6000/altivec.md (UNSPEC_VMULEUD, UNSPEC_VMULESD,
	UNSPEC_VMULOUD, UNSPEC_VMULOSD): New unspecs.
	(altivec_eqv1ti, altivec_gtv1ti, altivec_gtuv1ti, altivec_vmuleud,
	altivec_vmuloud, altivec_vmulesd, altivec_vmulosd, altivec_vrlq,
	altivec_vrlqmi, altivec_vrlqmi_inst, altivec_vrlqnm,
	altivec_vrlqnm_inst, altivec_vslq, altivec_vsrq, altivec_vsraq,
	altivec_vcmpequt_p, altivec_vcmpgtst_p, altivec_vcmpgtut_p): New
	define_insn.
	(vec_widen_umult_even_v2di, vec_widen_smult_even_v2di,
	vec_widen_umult_odd_v2di, vec_widen_smult_odd_v2di, altivec_vrlqmi,
	altivec_vrlqnm): New define_expands.
	* config/rs6000/rs6000-builtin.def (VCMPEQUT_P, VCMPGTST_P,
	VCMPGTUT_P): Add macro expansions.
	(BU_P10V_AV_P): Add builtin predicate definition.
	(VCMPGTUT, VCMPGTST, VCMPEQUT, CMPNET, CMPGE_1TI,
	CMPGE_U1TI, CMPLE_1TI, CMPLE_U1TI, VNOR_V1TI_UNS, VNOR_V1TI, VCMPNET_P,
	VCMPAET_P, VMULEUD, VMULESD, VMULOUD, VMULOSD, VRLQ,
	VSLQ, VSRQ, VSRAQ, VRLQNM, DIV_V1TI, UDIV_V1TI, DIVES_V1TI, DIVEU_V1TI,
	MODS_V1TI, MODU_V1TI, VRLQMI): New macro expansions.
	(VRLQ, VSLQ, VSRQ, VSRAQ, DIVE, MOD): New overload expansions.
	* config/rs6000/rs6000-call.c (P10_BUILTIN_VCMPEQUT,
	P10V_BUILTIN_CMPGE_1TI, P10V_BUILTIN_CMPGE_U1TI,
	P10V_BUILTIN_VCMPGTUT, P10V_BUILTIN_VCMPGTST,
	P10V_BUILTIN_CMPLE_1TI, P10V_BUILTIN_VCMPLE_U1TI,
	P10V_BUILTIN_DIV_V1TI, P10V_BUILTIN_UDIV_V1TI,
	P10V_BUILTIN_VMULESD, P10V_BUILTIN_VMULEUD,
	P10V_BUILTIN_VMULOSD, P10V_BUILTIN_VMULOUD,
	P10V_BUILTIN_VNOR_V1TI, P10V_BUILTIN_VNOR_V1TI_UNS,
	P10V_BUILTIN_VRLQ, P10V_BUILTIN_VRLQMI,
	P10V_BUILTIN_VRLQNM, P10V_BUILTIN_VSLQ,
	P10V_BUILTIN_VSRQ, P10V_BUILTIN_VSRAQ,
	P10V_BUILTIN_VCMPGTUT_P, P10V_BUILTIN_VCMPGTST_P,
	P10V_BUILTIN_VCMPEQUT_P, P10V_BUILTIN_VCMPGTUT_P,
	P10V_BUILTIN_VCMPGTST_P, P10V_BUILTIN_CMPNET,
	P10V_BUILTIN_VCMPNET_P, P10V_BUILTIN_VCMPAET_P,
	P10V_BUILTIN_DIVES_V1TI, P10V_BUILTIN_MODS_V1TI,
	P10V_BUILTIN_MODU_V1TI):
	New overloaded definitions.
	(rs6000_gimple_fold_builtin) [P10V_BUILTIN_VCMPEQUT,
	P10V_BUILTIN_CMPNET, P10V_BUILTIN_CMPGE_1TI,
	P10V_BUILTIN_CMPGE_U1TI, P10V_BUILTIN_VCMPGTUT,
	P10V_BUILTIN_VCMPGTST, P10V_BUILTIN_CMPLE_1TI,
	P10V_BUILTIN_CMPLE_U1TI]: New case statements.
	(rs6000_init_builtins) [bool_V1TI_type_node, int_ftype_int_v1ti_v1ti]:
	New assignments.
	(altivec_init_builtins): New E_V1TImode case statement.
	(builtin_function_type)[P10_BUILTIN_128BIT_VMULEUD,
	P10_BUILTIN_128BIT_VMULOUD, P10_BUILTIN_128BIT_DIVEU_V1TI,
	P10_BUILTIN_128BIT_MODU_V1TI, P10_BUILTIN_CMPGE_U1TI,
	P10_BUILTIN_VCMPGTUT, P10_BUILTIN_VCMPEQUT]: New case statements.
	* config/rs6000/rs6000.c (rs6000_handle_altivec_attribute) [E_TImode,
	E_V1TImode]: New case statements.
	* config/rs6000/rs6000.h (rs6000_builtin_type_index): New enum
	value RS6000_BTI_bool_V1TI.
	* config/rs6000/vector.md (vector_gtv1ti,vector_nltv1ti,
	vector_gtuv1ti, vector_nltuv1ti, vector_ngtv1ti, vector_ngtuv1ti,
	vector_eq_v1ti_p, vector_ne_v1ti_p, vector_ae_v1ti_p,
	vector_gt_v1ti_p, vector_gtu_v1ti_p, vrotlv1ti3, vashlv1ti3,
	vlshrv1ti3, vashrv1ti3): New define_expands.
	* config/rs6000/vsx.md (UNSPEC_VSX_DIVSQ, UNSPEC_VSX_DIVUQ,
	UNSPEC_VSX_DIVESQ, UNSPEC_VSX_DIVEUQ, UNSPEC_VSX_MODSQ,
	UNSPEC_VSX_MODUQ): New unspecs.
	(mulv2di3, vsx_div_v1ti, vsx_udiv_v1ti, vsx_dives_v1ti,
	vsx_diveu_v1ti,	vsx_mods_v1ti, vsx_modu_v1ti, xxswapd_v1ti): New
	define_insns.
	(vcmpnet): New define_expand.
	* doc/extend.texi: Add documentation for the new builtins vec_rl,
	vec_rlmi, vec_rlnm, vec_sl, vec_sr, vec_sra, vec_mule, vec_mulo,
	vec_div, vec_dive, vec_mod, vec_cmpeq, vec_cmpne, vec_cmpgt, vec_cmplt,
	vec_cmpge, vec_cmple, vec_all_eq, vec_all_ne, vec_all_gt, vec_all_lt,
	vec_all_ge, vec_all_le, vec_any_eq, vec_any_ne, vec_any_gt, vec_any_lt,
	vec_any_ge, vec_any_le.

gcc/testsuite/ChangeLog

	* gcc.target/powerpc/int_128bit-runnable.c: New test file.
2021-06-21 17:33:07 -05:00
Carl Love
931d1705c9 rs6000, Fix arguments in altivec_vrlwmi and altivec_rlwdi builtins
2021-06-07  Carl Love  <cel@us.ibm.com>

gcc/
	* config/rs6000/altivec.md (altivec_vrl<VI_char>mi): Fix
	bug in argument generation.

gcc/testsuite/
	* gcc.target/powerpc/check-builtin-vec_rlnm-runnable.c:
	New runnable test case.
	* gcc.target/powerpc/vec-rlmi-rlnm.c: Update scan assembler times
	for xxlor instruction.
2021-06-21 17:32:59 -05:00
Jason Merrill
2348a458e1 c++: deleted after first declaration [PR101106]
An explicitly deleted function must be deleted on its first declaration.  We
were diagnosing this error only with -Wpedantic, but always giving the
"previous declaration" note.  For GCC 11, keep the -Wpedantic dependency,
just make the note depend on the previous diagnostic.

	PR c++/101106

gcc/cp/ChangeLog:

	* decl.c (duplicate_decls): Condition note on return value of pedwarn.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/deleted15.C: New test.
2021-06-21 16:42:33 -04:00
Jason Merrill
4f28192238 c++: remove redundant warning [PR100879]
Before my r277864, build_new_op promoted enums to int before passing them on
to cp_build_binary_op; after that commit, it doesn't, so
warn_for_sign_compare sees the enum operands and gives a redundant warning.
This warning dates back to 1995, and seems to have been dead code for a long
time--likely since build_new_op was added in 1997--so let's just remove it.

	PR c++/100879

gcc/c-family/ChangeLog:

	* c-warn.c (warn_for_sign_compare): Remove C++ enum mismatch
	warning.

gcc/testsuite/ChangeLog:

	* g++.dg/diagnostic/enum3.C: New test.
2021-06-21 16:42:33 -04:00
Aaron Sawdey
4c4bebb834 Fix p10 fusion regtests
Backported from trunk.

Update the count of matches for the fusion combine patterns after
the recent changes to them.  At Segher's request, used \m and \M
in the match patterns. Also I have grouped together all alternatives of
each fusion insn, which should hopefully make this test a little less
fragile.

gcc/testsuite/ChangeLog

	* gcc.target/powerpc/fusion-p10-2logical.c: Update pattern
	match counts.
	* gcc.target/powerpc/fusion-p10-addadd.c: Update pattern match
	counts.
	* gcc.target/powerpc/fusion-p10-ldcmpi.c: Update pattern match
	counts.
	* gcc.target/powerpc/fusion-p10-logadd.c: Update pattern match
	counts.

(cherry picked from commit a798b3f15c)
2021-06-21 15:38:08 -05:00