aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog258
-rw-r--r--gcc/testsuite/c-c++-common/Wlogical-not-parentheses-2.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp23/cplusplus.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp26/cplusplus.C3
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/missing-header-pr110164.C10
-rw-r--r--gcc/testsuite/g++.dg/torture/pr110332.C16
-rw-r--r--gcc/testsuite/g++.target/powerpc/pr105325.C28
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/malloc-macro-inline-events.c5
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-ascii.c55
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-debug.c40
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-emoji.c55
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-json.c13
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-sarif.c24
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-unicode.c55
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-10.c29
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-11.c82
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-12.c53
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-13.c43
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-14.c110
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-15.c42
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-2.c30
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-3.c45
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-4.c45
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-ascii.c40
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-unicode.c42
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-6.c125
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-7.c36
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-8.c34
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-9.c42
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr101962.c2
-rw-r--r--gcc/testsuite/gcc.dg/missing-header-fixit-5.c10
-rw-r--r--gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c6
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-ascii-bw.c57
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-ascii-color.c58
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-none.c5
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-unicode-bw.c58
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-unicode-color.c59
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c258
-rw-r--r--gcc/testsuite/gcc.dg/plugin/plugin.exp6
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr110332-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr110332-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr110381.c40
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr110371.c20
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr110280.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/ashldi3-1.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/ashlti3-2.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-vptest-4.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-vptest-5.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-vptest-6.c40
-rw-r--r--gcc/testsuite/gcc.target/i386/mvc17.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr109973-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr109973-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr110018-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr110018-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr110309.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-ptest-4.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-ptest-5.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-ptest-6.c40
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c16
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/gimple_fold-1.c43
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/select_vl-1.c5
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/select_vl-2.c25
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.h44
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.h149
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-2.c10
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-3.c22
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-1.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-10.c23
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-11.c29
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-12.c28
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-2.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-3.c9
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-4.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-5.c8
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-6.c9
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-7.c23
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-8.c29
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-9.c28
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-1.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-10.c40
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-11.c60
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-12.c60
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-2.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-3.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-4.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-5.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-6.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-7.c40
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-8.c60
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-9.c60
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-1.c35
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-10.c35
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-11.c55
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-12.c55
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-2.c55
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-3.c55
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-4.c35
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-5.c55
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-6.c55
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-7.c35
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-8.c55
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-9.c55
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/tuple-28.c59
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/tuple-29.c59
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/tuple-30.c58
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/tuple-31.c30
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/tuple-32.c16
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-2.c8
-rw-r--r--gcc/testsuite/gcc.target/s390/larl-1.c32
-rw-r--r--gcc/testsuite/gdc.dg/pr110359.d22
-rw-r--r--gcc/testsuite/gdc.test/compilable/shared.d66
-rw-r--r--gcc/testsuite/gdc.test/compilable/test22739.d10
-rw-r--r--gcc/testsuite/gdc.test/compilable/test23799.d37
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/bug9631.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/cerrors.d16
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail17646.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail19948.d2
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail22857.d18
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail23816.d16
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/import22857.d4
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/shared.d19
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test21164.d3
-rw-r--r--gcc/testsuite/gdc.test/runnable/complex3.d31
-rw-r--r--gcc/testsuite/gfortran.dg/value_9.f9078
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp5
-rw-r--r--gcc/testsuite/lib/multiline.exp7
-rw-r--r--gcc/testsuite/lib/prune.exp7
-rw-r--r--gcc/testsuite/lib/target-supports.exp30
-rw-r--r--gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h3
133 files changed, 4060 insertions, 306 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3e3f0ad..470cff2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,261 @@
+2023-06-25 Juzhe-Zhong <juzhe.zhong@rivai.ai>
+
+ * gcc.target/riscv/rvv/autovec/partial/select_vl-1.c: Add dump checks.
+ * gcc.target/riscv/rvv/autovec/partial/select_vl-2.c: New test.
+
+2023-06-25 Li Xu <xuli1@eswincomputing.com>
+
+ * gcc.target/riscv/rvv/base/vlmul_ext-2.c: New test.
+
+2023-06-25 Juzhe-Zhong <juzhe.zhong@rivai.ai>
+
+ * gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.c: New test.
+ * gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.h: New test.
+ * gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.c: New test.
+ * gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.h: New test.
+ * gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-2.c: New test.
+ * gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-3.c: New test.
+
+2023-06-25 Pan Li <pan2.li@intel.com>
+
+ * gcc.target/riscv/rvv/base/abi-10.c: Revert.
+ * gcc.target/riscv/rvv/base/abi-11.c: Ditto.
+ * gcc.target/riscv/rvv/base/abi-12.c: Ditto.
+ * gcc.target/riscv/rvv/base/abi-15.c: Ditto.
+ * gcc.target/riscv/rvv/base/abi-8.c: Ditto.
+ * gcc.target/riscv/rvv/base/abi-9.c: Ditto.
+ * gcc.target/riscv/rvv/base/abi-17.c: Ditto.
+ * gcc.target/riscv/rvv/base/abi-18.c: Ditto.
+
+2023-06-25 Pan Li <pan2.li@intel.com>
+
+ * gcc.target/riscv/rvv/base/tuple-28.c: Removed.
+ * gcc.target/riscv/rvv/base/tuple-29.c: Removed.
+ * gcc.target/riscv/rvv/base/tuple-30.c: Removed.
+ * gcc.target/riscv/rvv/base/tuple-31.c: Removed.
+ * gcc.target/riscv/rvv/base/tuple-32.c: Removed.
+
+2023-06-25 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr110309.c: New test.
+
+2023-06-25 yulong <shiyulong@iscas.ac.cn>
+
+ * gcc.target/riscv/rvv/base/abi-10.c: Add float16 tuple type case.
+ * gcc.target/riscv/rvv/base/abi-11.c: Ditto.
+ * gcc.target/riscv/rvv/base/abi-12.c: Ditto.
+ * gcc.target/riscv/rvv/base/abi-15.c: Ditto.
+ * gcc.target/riscv/rvv/base/abi-8.c: Ditto.
+ * gcc.target/riscv/rvv/base/abi-9.c: Ditto.
+ * gcc.target/riscv/rvv/base/abi-17.c: New test.
+ * gcc.target/riscv/rvv/base/abi-18.c: New test.
+
+2023-06-24 Juzhe-Zhong <juzhe.zhong@rivai.ai>
+
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-1.c: Adjust tests.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-2.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-3.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-4.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-5.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-6.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-1.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-2.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-3.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-4.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-5.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-6.c: Ditto.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-10.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-11.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-12.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-7.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-8.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop-9.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-10.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-11.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-12.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-7.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-8.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run-9.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-1.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-10.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-11.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-12.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-2.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-3.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-4.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-5.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-6.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-7.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-8.c: New test.
+ * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-9.c: New test.
+
+2023-06-24 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/plugin/diagnostic_plugin_test_text_art.c: Add
+ #define INCLUDE_VECTOR.
+
+2023-06-23 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/110164
+ * g++.dg/diagnostic/missing-header-pr110164.C: New test.
+
+2023-06-23 Marek Polacek <polacek@redhat.com>
+
+ * lib/target-supports.exp (check_effective_target_c++23): Return
+ 1 also if check_effective_target_c++26.
+ (check_effective_target_c++23_down): New.
+ (check_effective_target_c++26_only): New.
+ (check_effective_target_c++26): New.
+ * g++.dg/cpp23/cplusplus.C: Adjust expected value.
+ * g++.dg/cpp26/cplusplus.C: New test.
+
+2023-06-23 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/110360
+ * gfortran.dg/value_9.f90: New test.
+
+2023-06-23 Michael Meissner <meissner@linux.ibm.com>
+ Aaron Sawdey <acsawdey@linux.ibm.com>
+
+ PR target/105325
+ * g++.target/powerpc/pr105325.C: New test.
+ * gcc.target/powerpc/fusion-p10-ldcmpi.c: Update insn counts.
+
+2023-06-23 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h: Make
+ this header use pragma system_header.
+
+2023-06-23 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
+
+ PR tree-optimization/110280
+ * gcc.target/aarch64/sve/pr110280.c: New test.
+
+2023-06-22 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/110332
+ * g++.dg/torture/pr110332.C: New testcase.
+ * gcc.dg/torture/pr110332-1.c: Likewise.
+ * gcc.dg/torture/pr110332-2.c: Likewise.
+
+2023-06-22 Roger Sayle <roger@nextmovesoftware.com>
+ Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/i386/avx-vptest-4.c: New test case.
+ * gcc.target/i386/avx-vptest-5.c: Likewise.
+ * gcc.target/i386/avx-vptest-6.c: Likewise.
+ * gcc.target/i386/pr109973-1.c: Update test case.
+ * gcc.target/i386/pr109973-2.c: Likewise.
+ * gcc.target/i386/sse4_1-ptest-4.c: New test case.
+ * gcc.target/i386/sse4_1-ptest-5.c: Likewise.
+ * gcc.target/i386/sse4_1-ptest-6.c: Likewise.
+
+2023-06-22 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/106626
+ * gcc.dg/analyzer/data-model-1.c (test_16): Update for
+ out-of-bounds working.
+ * gcc.dg/analyzer/out-of-bounds-diagram-1-ascii.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-1-debug.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-1-emoji.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-1-json.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-1-sarif.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-1-unicode.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-10.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-11.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-12.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-13.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-14.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-15.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-2.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-3.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-4.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-5-ascii.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-5-unicode.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-6.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-7.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-8.c: New test.
+ * gcc.dg/analyzer/out-of-bounds-diagram-9.c: New test.
+ * gcc.dg/analyzer/pattern-test-2.c: Update expected results.
+ * gcc.dg/analyzer/pr101962.c: Update expected results.
+ * gcc.dg/plugin/analyzer_gil_plugin.c: Add logger param to
+ pending_diagnostic::emit implementations.
+
+2023-06-22 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/plugin/diagnostic-test-text-art-ascii-bw.c: New test.
+ * gcc.dg/plugin/diagnostic-test-text-art-ascii-color.c: New test.
+ * gcc.dg/plugin/diagnostic-test-text-art-none.c: New test.
+ * gcc.dg/plugin/diagnostic-test-text-art-unicode-bw.c: New test.
+ * gcc.dg/plugin/diagnostic-test-text-art-unicode-color.c: New test.
+ * gcc.dg/plugin/diagnostic_plugin_test_text_art.c: New test plugin.
+ * gcc.dg/plugin/plugin.exp (plugin_test_list): Add them.
+
+2023-06-22 David Malcolm <dmalcolm@redhat.com>
+
+ * c-c++-common/Wlogical-not-parentheses-2.c: Split up the
+ multiline directive.
+ * gcc.dg/analyzer/malloc-macro-inline-events.c: Remove redundant
+ dg-regexp directives.
+ * gcc.dg/missing-header-fixit-5.c: Split up the multiline
+ directives.
+ * lib/gcc-dg.exp (gcc-dg-prune): Move call to
+ handle-multiline-outputs from prune_gcc_output to here.
+ * lib/multiline.exp (dg-end-multiline-output): Move call to
+ maybe-handle-nn-line-numbers from prune_gcc_output to here.
+ * lib/prune.exp (prune_gcc_output): Move calls to
+ maybe-handle-nn-line-numbers and handle-multiline-outputs from
+ here to the above.
+
+2023-06-21 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/87477
+ PR fortran/107900
+ PR fortran/110224
+ PR fortran/88688
+ PR fortran/94380
+ PR fortran/95398
+ * gfortran.dg/pr107900.f90 : New test
+ * gfortran.dg/pr110224.f90 : New test
+ * gfortran.dg/pr88688.f90 : New test
+ * gfortran.dg/pr94380.f90 : New test
+ * gfortran.dg/pr95398.f90 : Set -std=f2008, bump the line
+ numbers in the error tests by two and change the text in two.
+
+2023-06-21 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/108961
+ * gfortran.dg/pr108961.f90: New test.
+
+2023-06-21 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/110018
+ * gcc.target/i386/pr110018-1.c: Use explicit signed types.
+ * gcc.target/i386/pr110018-2.c: New test.
+
+2023-06-21 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * gcc.target/aarch64/sve/gather_earlyclobber.c: New test.
+ * gcc.target/aarch64/sve2/gather_earlyclobber.c: New test.
+
+2023-06-21 Richard Biener <rguenther@suse.de>
+
+ * gcc.target/i386/vect-partial-vectors-1.c: New testcase.
+ * gcc.target/i386/vect-partial-vectors-2.c: Likewise.
+
+2023-06-21 Jan Beulich <jbeulich@suse.com>
+
+ * gcc.target/i386/avx512f-copysign.c: New test.
+
+2023-06-21 Jan Beulich <jbeulich@suse.com>
+
+ * gcc.target/i386/avx512f-dupv2di.c: Add
+ -mprefer-vector-width=512.
+
+2023-06-21 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr110018-1.c: New test.
+
2023-06-20 Lewis Hyatt <lhyatt@gmail.com>
PR c++/66290
diff --git a/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-2.c b/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-2.c
index ba8dce8..2d93820 100644
--- a/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-2.c
+++ b/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-2.c
@@ -12,6 +12,8 @@ foo (int aaa, int bbb)
/* { dg-begin-multiline-output "" }
r += !aaa == bbb;
^~
+ { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
r += !aaa == bbb;
^~~~
( )
diff --git a/gcc/testsuite/g++.dg/cpp23/cplusplus.C b/gcc/testsuite/g++.dg/cpp23/cplusplus.C
index 29a941b..ff331c2 100644
--- a/gcc/testsuite/g++.dg/cpp23/cplusplus.C
+++ b/gcc/testsuite/g++.dg/cpp23/cplusplus.C
@@ -1,4 +1,4 @@
// { dg-do compile }
// { dg-options "-std=c++23" }
-static_assert(__cplusplus > 202002L);
+static_assert(__cplusplus == 202302L);
diff --git a/gcc/testsuite/g++.dg/cpp26/cplusplus.C b/gcc/testsuite/g++.dg/cpp26/cplusplus.C
new file mode 100644
index 0000000..08c502e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp26/cplusplus.C
@@ -0,0 +1,3 @@
+// { dg-do compile { target c++26_only } }
+
+static_assert(__cplusplus > 202302L);
diff --git a/gcc/testsuite/g++.dg/diagnostic/missing-header-pr110164.C b/gcc/testsuite/g++.dg/diagnostic/missing-header-pr110164.C
new file mode 100644
index 0000000..1598007
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/missing-header-pr110164.C
@@ -0,0 +1,10 @@
+// { dg-require-effective-target c++11 }
+
+#include <map>
+
+std::array<int, 10> a1; /* { dg-error "incomplete type" } */
+/* { dg-message "'std::array' is defined in header '<array>'; this is probably fixable by adding '#include <array>'" "hint" { target *-*-* } .-1 } */
+
+std::array<int, 10> a2 {5}; /* { dg-error "incomplete type" } */
+/* { dg-message "'std::array' is defined in header '<array>'; this is probably fixable by adding '#include <array>'" "hint" { target *-*-* } .-1 } */
+
diff --git a/gcc/testsuite/g++.dg/torture/pr110332.C b/gcc/testsuite/g++.dg/torture/pr110332.C
new file mode 100644
index 0000000..31dc93e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr110332.C
@@ -0,0 +1,16 @@
+// { dg-do compile }
+
+struct SlotIndex { int lie; };
+SlotIndex si7, si8;
+
+unsigned u9, u6;
+bool b3, b4;
+unsigned &value() {
+ return b4 ? u6 : u9;
+}
+void transferValues() {
+ unsigned RegIdx;
+ SlotIndex End;
+ RegIdx = value();
+ End = b3 ? si7 : si8;
+}
diff --git a/gcc/testsuite/g++.target/powerpc/pr105325.C b/gcc/testsuite/g++.target/powerpc/pr105325.C
new file mode 100644
index 0000000..18a2e52
--- /dev/null
+++ b/gcc/testsuite/g++.target/powerpc/pr105325.C
@@ -0,0 +1,28 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target powerpc_prefixed_addr } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -fstack-protector" } */
+
+/* PR target/105324. Test that power10 fusion does not generate an LWA/CMPDI
+ with a large offset that the assembler rejects. Instead it should a
+ PLWZ/CMPWI combination.
+
+ Originally, the code was dying because the fusion load + compare -1/0/1
+ patterns did not handle the possibility that the load might be prefixed.
+ The -fstack-protector option is needed to show the bug. */
+
+struct Ath__array1D {
+ int _current;
+ int getCnt() { return _current; }
+};
+struct extMeasure {
+ int _mapTable[10000];
+ Ath__array1D _metRCTable;
+};
+void measureRC() {
+ extMeasure m;
+ for (; m._metRCTable.getCnt();)
+ for (;;)
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
index 86d1ccf..3c4a45f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
@@ -240,8 +240,8 @@ void test_16 (void)
__analyzer_eval (strlen (msg) == 11); /* { dg-warning "TRUE" } */
/* Out-of-bounds. */
- __analyzer_eval (msg[100] == 'e'); /* { dg-warning "UNKNOWN" } */
- // TODO: some kind of warning for the out-of-bounds access
+ __analyzer_eval (msg[100] == 'e'); /* { dg-warning "UNKNOWN" "eval result" } */
+ /* { dg-warning "buffer over-read" "out-of-bounds" { target *-*-* } .-1 } */
}
static const char *__attribute__((noinline))
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-macro-inline-events.c b/gcc/testsuite/gcc.dg/analyzer/malloc-macro-inline-events.c
index f08aee6..9134bb4 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-macro-inline-events.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-macro-inline-events.c
@@ -12,11 +12,6 @@ int test (void *ptr)
WRAPPED_FREE (ptr); /* { dg-message "in expansion of macro 'WRAPPED_FREE'" } */
WRAPPED_FREE (ptr); /* { dg-message "in expansion of macro 'WRAPPED_FREE'" } */
- /* Erase the spans indicating the header file
- (to avoid embedding path assumptions). */
- /* { dg-regexp "\[^|\]+/malloc-macro.h:\[0-9\]+:\[0-9\]+:" } */
- /* { dg-regexp "\[^|\]+/malloc-macro.h:\[0-9\]+:\[0-9\]+:" } */
-
/* { dg-begin-multiline-output "" }
NN | #define WRAPPED_FREE(PTR) free(PTR)
| ^~~~~~~~~
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-ascii.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-ascii.c
new file mode 100644
index 0000000..5e6eadc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-ascii.c
@@ -0,0 +1,55 @@
+/* { dg-additional-options "-fdiagnostics-show-path-depths" } */
+/* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
+/* { dg-additional-options "-fdiagnostics-text-art-charset=ascii" } */
+
+#include <stdint.h>
+
+int32_t arr[10];
+
+void int_arr_write_element_after_end_off_by_one(int32_t x)
+{
+ arr[10] = x; /* { dg-line line } */
+}
+/* { dg-warning "buffer overflow" "warning" { target *-*-* } line } */
+/* { dg-message "valid subscripts for 'arr' are '\\\[0\\\]' to '\\\[9\\\]'" "valid subscript note" { target *-*-* } line } */
+
+
+/* { dg-begin-multiline-output "" }
+ arr[10] = x;
+ ~~~~~~~~^~~
+ event 1 (depth 0)
+ |
+ | int32_t arr[10];
+ | ^~~
+ | |
+ | (1) capacity: 40 bytes
+ |
+ +--> 'int_arr_write_element_after_end_off_by_one': event 2 (depth 1)
+ |
+ | arr[10] = x;
+ | ~~~~~~~~^~~
+ | |
+ | (2) out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40
+ |
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ +--------------------------------+
+ |write from 'x' (type: 'int32_t')|
+ +--------------------------------+
+ |
+ |
+ v
+ +--------+-----------------+---------++--------------------------------+
+ | [0] | ... | [9] || |
+ +--------+-----------------+---------+| after valid range |
+ | 'arr' (type: 'int32_t[10]') || |
+ +------------------------------------++--------------------------------+
+ |~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~||~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~|
+ | |
+ +---------+--------+ +---------+---------+
+ |capacity: 40 bytes| |overflow of 4 bytes|
+ +------------------+ +-------------------+
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-debug.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-debug.c
new file mode 100644
index 0000000..4c4d9d1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-debug.c
@@ -0,0 +1,40 @@
+/* Test of -fanalyzer-debug-text-art. */
+
+/* { dg-additional-options "-fdiagnostics-text-art-charset=ascii -fanalyzer-debug-text-art" } */
+
+#include <stdint.h>
+
+int32_t arr[10];
+
+void int_arr_write_element_after_end_off_by_one(int32_t x)
+{
+ arr[10] = x; /* { dg-line line } */
+}
+/* { dg-warning "buffer overflow" "warning" { target *-*-* } line } */
+/* { dg-message "valid subscripts for 'arr' are '\\\[0\\\]' to '\\\[9\\\]'" "valid subscript note" { target *-*-* } line } */
+
+/* { dg-begin-multiline-output "" }
+
+ +---------+-----------+-----------+---+--------------------------------+
+ | tc0 | tc1 | tc2 |tc3| tc4 |
+ +---------+-----------+-----------+---+--------------------------------+
+ |bytes 0-3|bytes 4-35 |bytes 36-39| | bytes 40-43 |
+ +---------+-----------+-----------+ +--------------------------------+
+ +--------------------------------+
+ |write from 'x' (type: 'int32_t')|
+ +--------------------------------+
+ |
+ |
+ v
+ +---------+-----------+-----------+ +--------------------------------+
+ | [0] | ... | [9] | | |
+ +---------+-----------+-----------+ | after valid range |
+ | 'arr' (type: 'int32_t[10]') | | |
+ +---------------------------------+ +--------------------------------+
+ |~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~| |~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~|
+ | |
+ +---------+--------+ +---------+---------+
+ |capacity: 40 bytes| |overflow of 4 bytes|
+ +------------------+ +-------------------+
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-emoji.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-emoji.c
new file mode 100644
index 0000000..1c61252
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-emoji.c
@@ -0,0 +1,55 @@
+/* { dg-additional-options "-fdiagnostics-show-path-depths" } */
+/* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
+/* { dg-additional-options "-fdiagnostics-text-art-charset=emoji" } */
+
+#include <stdint.h>
+
+int32_t arr[10];
+
+void int_arr_write_element_after_end_off_by_one(int32_t x)
+{
+ arr[10] = x; /* { dg-line line } */
+}
+/* { dg-warning "buffer overflow" "warning" { target *-*-* } line } */
+/* { dg-message "valid subscripts for 'arr' are '\\\[0\\\]' to '\\\[9\\\]'" "valid subscript note" { target *-*-* } line } */
+
+
+/* { dg-begin-multiline-output "" }
+ arr[10] = x;
+ ~~~~~~~~^~~
+ event 1 (depth 0)
+ |
+ | int32_t arr[10];
+ | ^~~
+ | |
+ | (1) capacity: 40 bytes
+ |
+ +--> 'int_arr_write_element_after_end_off_by_one': event 2 (depth 1)
+ |
+ | arr[10] = x;
+ | ~~~~~~~~^~~
+ | |
+ | (2) out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40
+ |
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌────────────────────────────────┐
+ │write from 'x' (type: 'int32_t')│
+ └────────────────────────────────┘
+ │
+ │
+ v
+ ┌────────┬─────────────────┬─────────┐┌────────────────────────────────┐
+ │ [0] │ ... │ [9] ││ │
+ ├────────┴─────────────────┴─────────┤│ after valid range │
+ │ 'arr' (type: 'int32_t[10]') ││ │
+ └────────────────────────────────────┘└────────────────────────────────┘
+ ├─────────────────┬──────────────────┤├───────────────┬────────────────┤
+ │ │
+ ╭─────────┴────────╮ ╭───────────┴──────────╮
+ │capacity: 40 bytes│ │⚠️ overflow of 4 bytes│
+ ╰──────────────────╯ ╰──────────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-json.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-json.c
new file mode 100644
index 0000000..0a2cc34
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-json.c
@@ -0,0 +1,13 @@
+/* { dg-additional-options "-fdiagnostics-format=json-file" } */
+
+/* The custom JSON format doesn't support text art, so this is just a simple
+ smoketext. */
+
+#include <stdint.h>
+
+int32_t arr[10];
+
+void int_arr_write_element_after_end_off_by_one(int32_t x)
+{
+ arr[10] = x;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-sarif.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-sarif.c
new file mode 100644
index 0000000..051a1ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-sarif.c
@@ -0,0 +1,24 @@
+/* We require -fdiagnostics-text-art-charset= to get any text art here
+ because of the test suite using -fdiagnostics-plain-output. */
+
+/* { dg-additional-options "-fdiagnostics-format=sarif-file -fdiagnostics-text-art-charset=ascii" } */
+
+#include <stdint.h>
+
+int32_t arr[10];
+
+void int_arr_write_element_after_end_off_by_one(int32_t x)
+{
+ arr[10] = x;
+}
+
+/* Verify that some JSON was written to a file with the expected name.
+
+ { dg-final { verify-sarif-file } }
+
+ Expect the "alt-text" to be captured.
+ { dg-final { scan-sarif-file "\"text\": \"Diagram visualizing the predicted out-of-bounds access\"," } }
+
+ Expect the diagram to have 4 leading spaces (to indicate a code block),
+ and that at least part of the diagram was written out.
+ { dg-final { scan-sarif-file "\"markdown\": \" .*capacity: 40 bytes.*\"" } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-unicode.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-unicode.c
new file mode 100644
index 0000000..71f66ff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-unicode.c
@@ -0,0 +1,55 @@
+/* { dg-additional-options "-fdiagnostics-show-path-depths" } */
+/* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <stdint.h>
+
+int32_t arr[10];
+
+void int_arr_write_element_after_end_off_by_one(int32_t x)
+{
+ arr[10] = x; /* { dg-line line } */
+}
+/* { dg-warning "buffer overflow" "warning" { target *-*-* } line } */
+/* { dg-message "valid subscripts for 'arr' are '\\\[0\\\]' to '\\\[9\\\]'" "valid subscript note" { target *-*-* } line } */
+
+
+/* { dg-begin-multiline-output "" }
+ arr[10] = x;
+ ~~~~~~~~^~~
+ event 1 (depth 0)
+ |
+ | int32_t arr[10];
+ | ^~~
+ | |
+ | (1) capacity: 40 bytes
+ |
+ +--> 'int_arr_write_element_after_end_off_by_one': event 2 (depth 1)
+ |
+ | arr[10] = x;
+ | ~~~~~~~~^~~
+ | |
+ | (2) out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40
+ |
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌────────────────────────────────┐
+ │write from 'x' (type: 'int32_t')│
+ └────────────────────────────────┘
+ │
+ │
+ v
+ ┌────────┬─────────────────┬─────────┐┌────────────────────────────────┐
+ │ [0] │ ... │ [9] ││ │
+ ├────────┴─────────────────┴─────────┤│ after valid range │
+ │ 'arr' (type: 'int32_t[10]') ││ │
+ └────────────────────────────────────┘└────────────────────────────────┘
+ ├─────────────────┬──────────────────┤├───────────────┬────────────────┤
+ │ │
+ ╭─────────┴────────╮ ╭─────────┴─────────╮
+ │capacity: 40 bytes│ │overflow of 4 bytes│
+ ╰──────────────────╯ ╰───────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-10.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-10.c
new file mode 100644
index 0000000..4a7b8e3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-10.c
@@ -0,0 +1,29 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <stdint.h>
+#include <stdlib.h>
+
+int32_t int_vla_write_element_symbolic_before_start (int32_t x, size_t n)
+{
+ int32_t arr[n]; /* { dg-message "\\(1\\) capacity: 'n \\* 4' bytes" } */
+ arr[-2] = 42; /* { dg-warning "stack-based buffer underwrite" } */
+}
+
+/* { dg-begin-multiline-output "" }
+
+ ┌───────────────────┐
+ │write of '(int) 42'│
+ └───────────────────┘
+ │
+ │
+ v
+ ┌───────────────────┐ ┌────────────────────────────────┐
+ │before valid range │ │buffer allocated on stack at (1)│
+ └───────────────────┘ └────────────────────────────────┘
+ ├─────────┬─────────┤├───────┬───────┤├───────────────┬────────────────┤
+ │ │ │
+ ╭─────────┴───────────╮ ╭───┴───╮ ╭───────────┴───────────╮
+ │underwrite of 4 bytes│ │4 bytes│ │capacity: 'n * 4' bytes│
+ ╰─────────────────────╯ ╰───────╯ ╰───────────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-11.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-11.c
new file mode 100644
index 0000000..f8eb158
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-11.c
@@ -0,0 +1,82 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+/* { dg-require-effective-target alloca } */
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+void test6 (size_t size)
+{
+ int32_t *buf = __builtin_alloca (4 * size);
+ memset (buf, 0, 4 * size);
+ int32_t last = *(buf + 4 * size); /* { dg-warning "stack-based buffer over-read" } */
+}
+
+/* (size * 16) - (size * 4) leads to a gap of (size * 12). */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌─────────────────┐
+ │ read of 4 bytes │
+ └─────────────────┘
+ ^
+ │
+ │
+ ┌────────────────────────────────┐ ┌─────────────────┐
+ │buffer allocated on stack at (1)│ │after valid range│
+ └────────────────────────────────┘ └─────────────────┘
+ ├───────────────┬────────────────┤├────────┬────────┤├────────┬────────┤
+ │ │ │
+ │ │ ╭──────────┴─────────╮
+ │ │ │over-read of 4 bytes│
+ │ │ ╰────────────────────╯
+ ╭───────────┴──────────╮ ╭────────┴────────╮
+ │size: 'size * 4' bytes│ │'size * 12' bytes│
+ ╰──────────────────────╯ ╰─────────────────╯
+
+ { dg-end-multiline-output "" } */
+
+void test7 (size_t size)
+{
+ int32_t *buf = __builtin_alloca (4 * size + 3); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
+ buf[size] = 42; /* { dg-warning "stack-based buffer overflow" } */
+}
+
+/* { dg-begin-multiline-output "" }
+
+ ┌───────────────────────────────────────┐
+ │ write of '(int) 42' │
+ └───────────────────────────────────────┘
+ │ │
+ │ │
+ v v
+ ┌──────────────────────────────────────────────────┐┌──────────────────┐
+ │ buffer allocated on stack at (1) ││after valid range │
+ └──────────────────────────────────────────────────┘└──────────────────┘
+ ├────────────────────────┬─────────────────────────┤├────────┬─────────┤
+ │ │
+ ╭───────────────┴──────────────╮ ╭─────────┴────────╮
+ │capacity: 'size * 4 + 3' bytes│ │overflow of 1 byte│
+ ╰──────────────────────────────╯ ╰──────────────────╯
+
+ { dg-end-multiline-output "" } */
+
+
+/* We're currently not able to generate a diagram for this case;
+ make sure we handle this case gracefully. */
+
+char *test99 (const char *x, const char *y)
+{
+ size_t len_x = __builtin_strlen (x);
+ size_t len_y = __builtin_strlen (y);
+ /* BUG (root cause): forgot to add 1 for terminator. */
+ size_t sz = len_x + len_y;
+ char *result = __builtin_malloc (sz);
+ if (!result)
+ return NULL;
+ __builtin_memcpy (result, x, len_x);
+ __builtin_memcpy (result + len_x, y, len_y);
+ /* BUG (symptom): off-by-one out-of-bounds write to heap. */
+ result[len_x + len_y] = '\0'; /* { dg-warning "heap-based buffer overflow" } */
+ return result;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-12.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-12.c
new file mode 100644
index 0000000..3573750
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-12.c
@@ -0,0 +1,53 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+/* { dg-require-effective-target alloca } */
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+void test8 (size_t size, size_t offset)
+{
+ char src[size];
+ char dst[size];
+ memcpy (dst, src, size + offset); /* { dg-line test8 } */
+ /* { dg-warning "over-read" "warning" { target *-*-* } test8 } */
+ /* { dg-warning "overflow" "warning" { target *-*-* } test8 } */
+}
+
+/* { dg-begin-multiline-output "" }
+
+ ┌──────────────────────────────────────────────────────────────────────┐
+ │ read of 'size + offset' bytes │
+ └──────────────────────────────────────────────────────────────────────┘
+ ^ ^
+ │ │
+ │ │
+ ┌──────────────────────────────────┐┌──────────────────────────────────┐
+ │ buffer allocated on stack at (1) ││ after valid range │
+ └──────────────────────────────────┘└──────────────────────────────────┘
+ ├────────────────┬─────────────────┤├────────────────┬─────────────────┤
+ │ │
+ ╭─────────┴────────╮ ╭─────────────┴─────────────╮
+ │size: 'size' bytes│ │over-read of 'offset' bytes│
+ ╰──────────────────╯ ╰───────────────────────────╯
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌──────────────────────────────────────────────────────────────────────┐
+ │ write of 'size + offset' bytes │
+ └──────────────────────────────────────────────────────────────────────┘
+ │ │
+ │ │
+ v v
+ ┌──────────────────────────────────┐┌──────────────────────────────────┐
+ │ buffer allocated on stack at (1) ││ after valid range │
+ └──────────────────────────────────┘└──────────────────────────────────┘
+ ├────────────────┬─────────────────┤├────────────────┬─────────────────┤
+ │ │
+ ╭───────────┴──────────╮ ╭─────────────┴────────────╮
+ │capacity: 'size' bytes│ │overflow of 'offset' bytes│
+ ╰──────────────────────╯ ╰──────────────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-13.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-13.c
new file mode 100644
index 0000000..dcd1263
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-13.c
@@ -0,0 +1,43 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <string.h>
+
+void
+test_non_ascii ()
+{
+ char buf[9];
+ strcpy (buf, "Liberté\n"); /* { dg-warning "stack-based buffer overflow" } */
+ /* { dg-warning "'__builtin_memcpy' writing 10 bytes into a region of size 9 overflows the destination" "" { target *-*-* } .-1 } */
+}
+
+/* Example of non-ASCII UTF-8 that's short enough to fully quote, whilst
+ containing control characters. */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌──────┬──────┬──────┬──────┬──────┬──────┬────┬────┬──────┐┌─────────────────┐
+ │ [0] │ [1] │ [2] │ [3] │ [4] │ [5] │[6] │[7] │ [8] ││ [9] │
+ ├──────┼──────┼──────┼──────┼──────┼──────┼────┼────┼──────┤├─────────────────┤
+ │ 0x4c │ 0x69 │ 0x62 │ 0x65 │ 0x72 │ 0x74 │0xc3│0xa9│ 0x0a ││ 0x00 │
+ ├──────┼──────┼──────┼──────┼──────┼──────┼────┴────┼──────┤├─────────────────┤
+ │U+004c│U+0069│U+0062│U+0065│U+0072│U+0074│ U+00e9 │U+000a││ U+0000 │
+ ├──────┼──────┼──────┼──────┼──────┼──────┼─────────┼──────┤├─────────────────┤
+ │ L │ i │ b │ e │ r │ t │ é │ ││ NUL │
+ ├──────┴──────┴──────┴──────┴──────┴──────┴─────────┴──────┴┴─────────────────┤
+ │ string literal (type: 'char[10]') │
+ └─────────────────────────────────────────────────────────────────────────────┘
+ │ │ │ │ │ │ │ │ │ │
+ │ │ │ │ │ │ │ │ │ │
+ v v v v v v v v v v
+ ┌──────┬────────────────────────────────────────────┬──────┐┌─────────────────┐
+ │ [0] │ ... │ [8] ││ │
+ ├──────┴────────────────────────────────────────────┴──────┤│after valid range│
+ │ 'buf' (type: 'char[9]') ││ │
+ └──────────────────────────────────────────────────────────┘└─────────────────┘
+ ├────────────────────────────┬─────────────────────────────┤├────────┬────────┤
+ │ │
+ ╭────────┴────────╮ ╭─────────┴────────╮
+ │capacity: 9 bytes│ │overflow of 1 byte│
+ ╰─────────────────╯ ╰──────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-14.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-14.c
new file mode 100644
index 0000000..3cedf06
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-14.c
@@ -0,0 +1,110 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <stdint.h>
+
+extern int32_t arr_0[0]; /* { dg-message "capacity: 0 bytes" } */
+extern int32_t arr_1[1]; /* { dg-message "capacity: 4 bytes" } */
+extern int32_t arr_2[2]; /* { dg-message "capacity: 8 bytes" } */
+extern int32_t arr_3[3]; /* { dg-message "capacity: 12 bytes" } */
+extern int32_t arr_4[4]; /* { dg-message "capacity: 16 bytes" } */
+
+void test_immediately_after (int x)
+{
+ arr_0[0] = x; /* { dg-warning "buffer overflow" } */
+ arr_1[1] = x; /* { dg-warning "buffer overflow" } */
+ arr_2[2] = x; /* { dg-warning "buffer overflow" } */
+ arr_3[3] = x; /* { dg-warning "buffer overflow" } */
+ arr_4[4] = x; /* { dg-warning "buffer overflow" } */
+}
+
+/* Expect no diagram for the arr_0 case: there's no valid region
+to write to. */
+
+/* The arr_1 case. */
+/* { dg-begin-multiline-output "" }
+
+ ┌──────────────────────────────────┐
+ │ write from 'x' (type: 'int') │
+ └──────────────────────────────────┘
+ │
+ │
+ v
+ ┌──────────────────────────────────┐┌──────────────────────────────────┐
+ │ [0] ││ │
+ ├──────────────────────────────────┤│ after valid range │
+ │ 'arr_1' (type: 'int32_t[1]') ││ │
+ └──────────────────────────────────┘└──────────────────────────────────┘
+ ├────────────────┬─────────────────┤├────────────────┬─────────────────┤
+ │ │
+ ╭────────┴────────╮ ╭─────────┴─────────╮
+ │capacity: 4 bytes│ │overflow of 4 bytes│
+ ╰─────────────────╯ ╰───────────────────╯
+
+ { dg-end-multiline-output "" } */
+
+/* The arr_2 case. */
+/* { dg-begin-multiline-output "" }
+
+ ┌────────────────────────────┐
+ │write from 'x' (type: 'int')│
+ └────────────────────────────┘
+ │
+ │
+ v
+ ┌────────────────────┬───────────────────┐┌────────────────────────────┐
+ │ [0] │ [1] ││ │
+ ├────────────────────┴───────────────────┤│ after valid range │
+ │ 'arr_2' (type: 'int32_t[2]') ││ │
+ └────────────────────────────────────────┘└────────────────────────────┘
+ ├───────────────────┬────────────────────┤├─────────────┬──────────────┤
+ │ │
+ ╭────────┴────────╮ ╭─────────┴─────────╮
+ │capacity: 8 bytes│ │overflow of 4 bytes│
+ ╰─────────────────╯ ╰───────────────────╯
+
+ { dg-end-multiline-output "" } */
+
+/* The arr_3 case. */
+// Perhaps we should show [1] rather than ellipsize here.
+/* { dg-begin-multiline-output "" }
+
+ ┌────────────────────────────┐
+ │write from 'x' (type: 'int')│
+ └────────────────────────────┘
+ │
+ │
+ v
+ ┌─────────────┬─────────────┬────────────┐┌────────────────────────────┐
+ │ [0] │ ... │ [2] ││ │
+ ├─────────────┴─────────────┴────────────┤│ after valid range │
+ │ 'arr_3' (type: 'int32_t[3]') ││ │
+ └────────────────────────────────────────┘└────────────────────────────┘
+ ├───────────────────┬────────────────────┤├─────────────┬──────────────┤
+ │ │
+ ╭─────────┴────────╮ ╭─────────┴─────────╮
+ │capacity: 12 bytes│ │overflow of 4 bytes│
+ ╰──────────────────╯ ╰───────────────────╯
+
+ { dg-end-multiline-output "" } */
+
+/* The arr_4 case. */
+/* { dg-begin-multiline-output "" }
+
+ ┌────────────────────────────┐
+ │write from 'x' (type: 'int')│
+ └────────────────────────────┘
+ │
+ │
+ v
+ ┌──────────┬──────────────────┬──────────┐┌────────────────────────────┐
+ │ [0] │ ... │ [3] ││ │
+ ├──────────┴──────────────────┴──────────┤│ after valid range │
+ │ 'arr_4' (type: 'int32_t[4]') ││ │
+ └────────────────────────────────────────┘└────────────────────────────┘
+ ├───────────────────┬────────────────────┤├─────────────┬──────────────┤
+ │ │
+ ╭─────────┴────────╮ ╭─────────┴─────────╮
+ │capacity: 16 bytes│ │overflow of 4 bytes│
+ ╰──────────────────╯ ╰───────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-15.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-15.c
new file mode 100644
index 0000000..e2a6381
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-15.c
@@ -0,0 +1,42 @@
+/* Regression test for ICE with short values of
+ --param=analyzer-text-art-string-ellipsis-threshold=. */
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode --param=analyzer-text-art-string-ellipsis-threshold=0" } */
+
+#include <string.h>
+
+void
+test_non_ascii ()
+{
+ char buf[9];
+ strcpy (buf, "Liberté\n"); /* { dg-warning "stack-based buffer overflow" } */
+ /* { dg-warning "'__builtin_memcpy' writing 10 bytes into a region of size 9 overflows the destination" "" { target *-*-* } .-1 } */
+}
+
+/* { dg-begin-multiline-output "" }
+
+ ┌──────┬──────┬──────┬──────┬──────┬──────┬────┬────┬──────┐┌─────────────────┐
+ │ [0] │ [1] │ [2] │ [3] │ [4] │ [5] │[6] │[7] │ [8] ││ [9] │
+ ├──────┼──────┼──────┼──────┼──────┼──────┼────┼────┼──────┤├─────────────────┤
+ │ 0x4c │ 0x69 │ 0x62 │ 0x65 │ 0x72 │ 0x74 │0xc3│0xa9│ 0x0a ││ 0x00 │
+ ├──────┼──────┼──────┼──────┼──────┼──────┼────┴────┼──────┤├─────────────────┤
+ │U+004c│U+0069│U+0062│U+0065│U+0072│U+0074│ U+00e9 │U+000a││ U+0000 │
+ ├──────┼──────┼──────┼──────┼──────┼──────┼─────────┼──────┤├─────────────────┤
+ │ L │ i │ b │ e │ r │ t │ é │ ││ NUL │
+ ├──────┴──────┴──────┴──────┴──────┴──────┴─────────┴──────┴┴─────────────────┤
+ │ string literal (type: 'char[10]') │
+ └─────────────────────────────────────────────────────────────────────────────┘
+ │ │ │ │ │ │ │ │ │ │
+ │ │ │ │ │ │ │ │ │ │
+ v v v v v v v v v v
+ ┌──────┬────────────────────────────────────────────┬──────┐┌─────────────────┐
+ │ [0] │ ... │ [8] ││ │
+ ├──────┴────────────────────────────────────────────┴──────┤│after valid range│
+ │ 'buf' (type: 'char[9]') ││ │
+ └──────────────────────────────────────────────────────────┘└─────────────────┘
+ ├────────────────────────────┬─────────────────────────────┤├────────┬────────┤
+ │ │
+ ╭────────┴────────╮ ╭─────────┴────────╮
+ │capacity: 9 bytes│ │overflow of 1 byte│
+ ╰─────────────────╯ ╰──────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-2.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-2.c
new file mode 100644
index 0000000..535dab1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-2.c
@@ -0,0 +1,30 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <stdint.h>
+#include <stdlib.h>
+
+void int_vla_write_element_after_end_off_by_one(int32_t x, size_t n)
+{
+ int32_t arr[n]; /* { dg-message "\\(1\\) capacity: 'n \\* 4' bytes" } */
+
+ arr[n] = x; /* { dg-warning "stack-based buffer overflow" } */
+}
+
+/* { dg-begin-multiline-output "" }
+
+ ┌──────────────────────────────────┐
+ │ write from 'x' (type: 'int32_t') │
+ └──────────────────────────────────┘
+ │
+ │
+ v
+ ┌──────────────────────────────────┐┌──────────────────────────────────┐
+ │ buffer allocated on stack at (1) ││ after valid range │
+ └──────────────────────────────────┘└──────────────────────────────────┘
+ ├────────────────┬─────────────────┤├────────────────┬─────────────────┤
+ │ │
+ ╭───────────┴───────────╮ ╭─────────┴─────────╮
+ │capacity: 'n * 4' bytes│ │overflow of 4 bytes│
+ ╰───────────────────────╯ ╰───────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-3.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-3.c
new file mode 100644
index 0000000..064f3fa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-3.c
@@ -0,0 +1,45 @@
+/* The multiline output assumes sizeof(size_t) == 8.
+ { dg-require-effective-target lp64 } */
+
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+struct str {
+ size_t len;
+ char data[];
+};
+
+struct str *
+make_str_badly (const char *src)
+{
+ size_t len = strlen(src);
+ struct str *str = malloc(sizeof(str) + len); /* { dg-message "\\(1\\) capacity: 'len \\+ 8' bytes" } */
+ if (!str)
+ return NULL;
+ str->len = len;
+ memcpy(str->data, src, len);
+ str->data[len] = '\0'; /* { dg-warning "heap-based buffer overflow" } */
+ return str;
+}
+
+/* { dg-begin-multiline-output "" }
+
+ ┌──────────────────────────────────┐
+ │ write of '(char) 0' │
+ └──────────────────────────────────┘
+ │
+ │
+ v
+ ┌──────────────────────────────────┐┌──────────────────────────────────┐
+ │ buffer allocated on heap at (1) ││ after valid range │
+ └──────────────────────────────────┘└──────────────────────────────────┘
+ ├────────────────┬─────────────────┤├────────────────┬─────────────────┤
+ │ │
+ ╭────────────┴────────────╮ ╭─────────┴────────╮
+ │capacity: 'len + 8' bytes│ │overflow of 1 byte│
+ ╰─────────────────────────╯ ╰──────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-4.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-4.c
new file mode 100644
index 0000000..ec8e4ab
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-4.c
@@ -0,0 +1,45 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <string.h>
+
+#define LOREM_IPSUM \
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod" \
+ " tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim" \
+ " veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea" \
+ " commodo consequat. Duis aute irure dolor in reprehenderit in voluptate" \
+ " velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint" \
+ " occaecat cupidatat non proident, sunt in culpa qui officia deserunt" \
+ " mollit anim id est laborum."
+
+void
+test_long_string ()
+{
+ char buf[100];
+ strcpy (buf, LOREM_IPSUM); /* { dg-warning "stack-based buffer overflow" } */
+ /* { dg-warning "'__builtin_memcpy' writing 446 bytes into a region of size 100 overflows the destination" "" { target *-*-* } .-1 } */
+}
+
+/* { dg-begin-multiline-output "" }
+
+ ┌───┬───┬───┬───┬───┬───┬──────────┬─────┬─────┬─────┬─────┬─────┬─────┐
+ │[0]│[1]│[2]│[3]│[4]│[5]│ │[440]│[441]│[442]│[443]│[444]│[445]│
+ ├───┼───┼───┼───┼───┼───┤ ... ├─────┼─────┼─────┼─────┼─────┼─────┤
+ │'L'│'o'│'r'│'e'│'m'│' '│ │ 'o' │ 'r' │ 'u' │ 'm' │ '.' │ NUL │
+ ├───┴───┴───┴───┴───┴───┴──────────┴─────┴─────┴─────┴─────┴─────┴─────┤
+ │ string literal (type: 'char[446]') │
+ └──────────────────────────────────────────────────────────────────────┘
+ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
+ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
+ v v v v v v v v v v v v v v v
+ ┌───┬─────────────────────┬────┐┌──────────────────────────────────────┐
+ │[0]│ ... │[99]││ │
+ ├───┴─────────────────────┴────┤│ after valid range │
+ │ 'buf' (type: 'char[100]') ││ │
+ └──────────────────────────────┘└──────────────────────────────────────┘
+ ├──────────────┬───────────────┤├──────────────────┬───────────────────┤
+ │ │
+ ╭─────────┴─────────╮ ╭──────────┴──────────╮
+ │capacity: 100 bytes│ │overflow of 346 bytes│
+ ╰───────────────────╯ ╰─────────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-ascii.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-ascii.c
new file mode 100644
index 0000000..e82bce9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-ascii.c
@@ -0,0 +1,40 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=ascii" } */
+
+#include <string.h>
+
+void
+test_non_ascii ()
+{
+ char buf[5];
+ strcpy (buf, "文字化け"); /* { dg-warning "stack-based buffer overflow" } */
+ /* { dg-warning "'__builtin_memcpy' writing 13 bytes into a region of size 5 overflows the destination" "" { target *-*-* } .-1 } */
+}
+
+/* Without unicode support, we shouldn't show the printable unicode chars. */
+
+/* { dg-begin-multiline-output "" }
+
+ +-----+-----+-----+----+----++----+----+----+----+----+----+----+------+
+ | [0] | [1] | [2] |[3] |[4] ||[5] |[6] |[7] |[8] |[9] |[10]|[11]| [12] |
+ +-----+-----+-----+----+----++----+----+----+----+----+----+----+------+
+ |0xe6 |0x96 |0x87 |0xe5|0xad||0x97|0xe5|0x8c|0x96|0xe3|0x81|0x91| 0x00 |
+ +-----+-----+-----+----+----++----+----+----+----+----+----+----+------+
+ | U+6587 | U+5b57 | U+5316 | U+3051 |U+0000|
+ +-----------------+---------------+--------------+--------------+------+
+ | string literal (type: 'char[13]') |
+ +----------------------------------------------------------------------+
+ | | | | | | | | | | | | |
+ | | | | | | | | | | | | |
+ v v v v v v v v v v v v v
+ +-----+----------------+----++-----------------------------------------+
+ | [0] | ... |[4] || |
+ +-----+----------------+----+| after valid range |
+ | 'buf' (type: 'char[5]') || |
+ +---------------------------++-----------------------------------------+
+ |~~~~~~~~~~~~~+~~~~~~~~~~~~~||~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~|
+ | |
+ +--------+--------+ +---------+---------+
+ |capacity: 5 bytes| |overflow of 8 bytes|
+ +-----------------+ +-------------------+
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-unicode.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-unicode.c
new file mode 100644
index 0000000..48fa12f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-unicode.c
@@ -0,0 +1,42 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <string.h>
+
+void
+test_non_ascii ()
+{
+ char buf[5];
+ strcpy (buf, "文字化け"); /* { dg-warning "stack-based buffer overflow" } */
+ /* { dg-warning "'__builtin_memcpy' writing 13 bytes into a region of size 5 overflows the destination" "" { target *-*-* } .-1 } */
+}
+
+/* With unicode support, we should show the printable unicode chars. */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌─────┬─────┬─────┬────┬────┐┌────┬────┬────┬────┬────┬────┬────┬──────┐
+ │ [0] │ [1] │ [2] │[3] │[4] ││[5] │[6] │[7] │[8] │[9] │[10]│[11]│ [12] │
+ ├─────┼─────┼─────┼────┼────┤├────┼────┼────┼────┼────┼────┼────┼──────┤
+ │0xe6 │0x96 │0x87 │0xe5│0xad││0x97│0xe5│0x8c│0x96│0xe3│0x81│0x91│ 0x00 │
+ ├─────┴─────┴─────┼────┴────┴┴────┼────┴────┴────┼────┴────┴────┼──────┤
+ │ U+6587 │ U+5b57 │ U+5316 │ U+3051 │U+0000│
+ ├─────────────────┼───────────────┼──────────────┼──────────────┼──────┤
+ │ 文 │ 字 │ 化 │ け │ NUL │
+ ├─────────────────┴───────────────┴──────────────┴──────────────┴──────┤
+ │ string literal (type: 'char[13]') │
+ └──────────────────────────────────────────────────────────────────────┘
+ │ │ │ │ │ │ │ │ │ │ │ │ │
+ │ │ │ │ │ │ │ │ │ │ │ │ │
+ v v v v v v v v v v v v v
+ ┌─────┬────────────────┬────┐┌─────────────────────────────────────────┐
+ │ [0] │ ... │[4] ││ │
+ ├─────┴────────────────┴────┤│ after valid range │
+ │ 'buf' (type: 'char[5]') ││ │
+ └───────────────────────────┘└─────────────────────────────────────────┘
+ ├─────────────┬─────────────┤├────────────────────┬────────────────────┤
+ │ │
+ ╭────────┴────────╮ ╭─────────┴─────────╮
+ │capacity: 5 bytes│ │overflow of 8 bytes│
+ ╰─────────────────╯ ╰───────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-6.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-6.c
new file mode 100644
index 0000000..25bf9d5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-6.c
@@ -0,0 +1,125 @@
+/* { dg-require-effective-target lp64 }
+ Misbehaves with -m32 due to optimization turning the pointer arithmetic into:
+ _2 = &buf + 4294967246;
+ memcpy (_2, _1, 4096);
+*/
+
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <string.h>
+
+#define LOREM_IPSUM \
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod" \
+ " tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim" \
+ " veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea" \
+ " commodo consequat. Duis aute irure dolor in reprehenderit in voluptate" \
+ " velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint" \
+ " occaecat cupidatat non proident, sunt in culpa qui officia deserunt" \
+ " mollit anim id est laborum."
+
+/* This memcpy reads from both before and after the bounds of the
+ string literal, and writes to both before and after the bounds of "buf". */
+
+void
+test_bad_memcpy ()
+{
+ char buf[100];
+ memcpy (buf - 50, LOREM_IPSUM - 100, 4096); /* { dg-warning "stack-based buffer overflow" } */
+ /* { dg-warning "stack-based buffer underwrite" "" { target *-*-* } .-1 } */
+ /* { dg-warning "buffer under-read" "" { target *-*-* } .-2 } */
+ /* { dg-warning "buffer over-read" "" { target *-*-* } .-3 } */
+ /* { dg-warning "'memcpy' writing 4096 bytes into a region of size 0 overflows the destination" "" { target *-*-* } .-4 } */
+}
+
+/* { dg-begin-multiline-output "" }
+
+ ┌─────────────────────────────────────────────────────────────────────────┐
+ │ read of 4096 bytes │
+ └─────────────────────────────────────────────────────────────────────────┘
+ ^ ^ ^ ^ ^
+ │ │ │ │ │
+ │ │ │ │ │
+ ┌──────────────────┐┌──────────┬──────────┬────────────┐┌─────────────────┐
+ │ ││ [0] │ ... │ [445] ││ │
+ │before valid range│├──────────┴──────────┴────────────┤│after valid range│
+ │ ││string literal (type: 'char[446]')││ │
+ └──────────────────┘└──────────────────────────────────┘└─────────────────┘
+ ├────────┬─────────┤├────────────────┬─────────────────┤├────────┬────────┤
+ │ │ │
+ ╭────────┴──────────────╮ ╭───────┴───────╮ ╭───────────┴───────────╮
+ │under-read of 100 bytes│ │size: 446 bytes│ │over-read of 3550 bytes│
+ ╰───────────────────────╯ ╰───────────────╯ ╰───────────────────────╯
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌──────────────────────────────────────────────────────────────────────┐
+ │ write of 4096 bytes │
+ └──────────────────────────────────────────────────────────────────────┘
+ │ │ │ │ │
+ │ │ │ │ │
+ v v v v v
+ ┌──────────────────┐┌───────┬───────┬─────────┐┌───────────────────────┐
+ │ ││ [0] │ ... │ [99] ││ │
+ │before valid range│├───────┴───────┴─────────┤│ after valid range │
+ │ ││'buf' (type: 'char[100]')││ │
+ └──────────────────┘└─────────────────────────┘└───────────────────────┘
+ ├────────┬─────────┤├────────────┬────────────┤├───────────┬───────────┤
+ │ │ │
+ │ ╭─────────┴─────────╮ ╭───────────┴──────────╮
+ │ │capacity: 100 bytes│ │overflow of 3946 bytes│
+ │ ╰───────────────────╯ ╰──────────────────────╯
+ ╭────────┴─────────────╮
+ │underwrite of 50 bytes│
+ ╰──────────────────────╯
+
+ { dg-end-multiline-output "" } */
+
+/* The read and write diagrams are each emitted twice: once for the "before"
+ and once for the "after" diagnostic. */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌─────────────────────────────────────────────────────────────────────────┐
+ │ read of 4096 bytes │
+ └─────────────────────────────────────────────────────────────────────────┘
+ ^ ^ ^ ^ ^
+ │ │ │ │ │
+ │ │ │ │ │
+ ┌──────────────────┐┌──────────┬──────────┬────────────┐┌─────────────────┐
+ │ ││ [0] │ ... │ [445] ││ │
+ │before valid range│├──────────┴──────────┴────────────┤│after valid range│
+ │ ││string literal (type: 'char[446]')││ │
+ └──────────────────┘└──────────────────────────────────┘└─────────────────┘
+ ├────────┬─────────┤├────────────────┬─────────────────┤├────────┬────────┤
+ │ │ │
+ ╭────────┴──────────────╮ ╭───────┴───────╮ ╭───────────┴───────────╮
+ │under-read of 100 bytes│ │size: 446 bytes│ │over-read of 3550 bytes│
+ ╰───────────────────────╯ ╰───────────────╯ ╰───────────────────────╯
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌──────────────────────────────────────────────────────────────────────┐
+ │ write of 4096 bytes │
+ └──────────────────────────────────────────────────────────────────────┘
+ │ │ │ │ │
+ │ │ │ │ │
+ v v v v v
+ ┌──────────────────┐┌───────┬───────┬─────────┐┌───────────────────────┐
+ │ ││ [0] │ ... │ [99] ││ │
+ │before valid range│├───────┴───────┴─────────┤│ after valid range │
+ │ ││'buf' (type: 'char[100]')││ │
+ └──────────────────┘└─────────────────────────┘└───────────────────────┘
+ ├────────┬─────────┤├────────────┬────────────┤├───────────┬───────────┤
+ │ │ │
+ │ ╭─────────┴─────────╮ ╭───────────┴──────────╮
+ │ │capacity: 100 bytes│ │overflow of 3946 bytes│
+ │ ╰───────────────────╯ ╰──────────────────────╯
+ ╭────────┴─────────────╮
+ │underwrite of 50 bytes│
+ ╰──────────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-7.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-7.c
new file mode 100644
index 0000000..25a9acc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-7.c
@@ -0,0 +1,36 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <string.h>
+
+void
+test_string_with_control_chars ()
+{
+ char buf[8];
+ strcpy (buf, "\tone\n\ttwo\n"); /* { dg-warning "stack-based buffer overflow" } */
+ /* { dg-warning "'__builtin_memcpy' writing 11 bytes into a region of size 8 overflows the destination" "" { target *-*-* } .-1 } */
+}
+
+/* { dg-begin-multiline-output "" }
+
+ ┌──────┬──────┬──────┬─────┬─────┬─────┬─────┬─────┐┌─────┬─────┬──────┐
+ │ [0] │ [1] │ [2] │ [3] │ [4] │ [5] │ [6] │ [7] ││ [8] │ [9] │ [10] │
+ ├──────┼──────┼──────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼──────┤
+ │ 0x09 │ 'o' │ 'n' │ 'e' │0x0a │0x09 │ 't' │ 'w' ││ 'o' │0x0a │ NUL │
+ ├──────┴──────┴──────┴─────┴─────┴─────┴─────┴─────┴┴─────┴─────┴──────┤
+ │ string literal (type: 'char[11]') │
+ └──────────────────────────────────────────────────────────────────────┘
+ │ │ │ │ │ │ │ │ │ │ │
+ │ │ │ │ │ │ │ │ │ │ │
+ v v v v v v v v v v v
+ ┌──────┬─────────────────────────────────────┬─────┐┌──────────────────┐
+ │ [0] │ ... │ [7] ││ │
+ ├──────┴─────────────────────────────────────┴─────┤│after valid range │
+ │ 'buf' (type: 'char[8]') ││ │
+ └──────────────────────────────────────────────────┘└──────────────────┘
+ ├────────────────────────┬─────────────────────────┤├────────┬─────────┤
+ │ │
+ ╭────────┴────────╮ ╭─────────┴─────────╮
+ │capacity: 8 bytes│ │overflow of 3 bytes│
+ ╰─────────────────╯ ╰───────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-8.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-8.c
new file mode 100644
index 0000000..24d8735
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-8.c
@@ -0,0 +1,34 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <stdlib.h>
+#include <stdint.h>
+
+/* Gap of 4, then an overflow of 4. */
+
+void test2 (size_t size)
+{
+ int32_t *buf = __builtin_malloc (size * sizeof(int32_t)); /* { dg-message "\\(1\\) capacity: 'size \\* 4' bytes" } */
+ if (!buf) return;
+
+ buf[size + 1] = 42; /* { dg-warning "heap-based buffer overflow" } */
+ __builtin_free (buf);
+}
+
+/* { dg-begin-multiline-output "" }
+
+ ┌───────────────────┐
+ │write of '(int) 42'│
+ └───────────────────┘
+ │
+ │
+ v
+ ┌───────────────────────────────┐ ┌───────────────────┐
+ │buffer allocated on heap at (1)│ │ after valid range │
+ └───────────────────────────────┘ └───────────────────┘
+ ├───────────────┬───────────────┤├───────┬────────┤├─────────┬─────────┤
+ │ │ │
+ ╭─────────────┴────────────╮ ╭───┴───╮ ╭─────────┴─────────╮
+ │capacity: 'size * 4' bytes│ │4 bytes│ │overflow of 4 bytes│
+ ╰──────────────────────────╯ ╰───────╯ ╰───────────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-9.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-9.c
new file mode 100644
index 0000000..bb9ad66
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-9.c
@@ -0,0 +1,42 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+
+#include <stdint.h>
+
+struct st
+{
+ char buf[16];
+ int32_t x;
+ int32_t y;
+};
+
+struct st arr[10];
+
+int32_t struct_arr_read_x_element_before_start_far(void)
+{
+ return arr[-100].x; /* { dg-warning "buffer under-read" "warning" } */
+ /* { dg-message "out-of-bounds read from byte -2384 till byte -2381 but 'arr' starts at byte 0" "final event" { target *-*-* } .-1 } */
+ /* { dg-message "valid subscripts for 'arr' are '\\\[0\\\]' to '\\\[9\\\]'" "valid subscript note" { target *-*-* } .-2 } */
+}
+
+// TODO: show index of accessed element
+// TODO: show field of accessed element
+/* { dg-begin-multiline-output "" }
+
+ ┌───────────────────────────┐
+ │read of 'int32_t' (4 bytes)│
+ └───────────────────────────┘
+ ^
+ │
+ │
+ ┌───────────────────────────┐ ┌─────────┬─────────┬─────────┐
+ │ │ │ [0] │ ... │ [9] │
+ │ before valid range │ ├─────────┴─────────┴─────────┤
+ │ │ │'arr' (type: 'struct st[10]')│
+ └───────────────────────────┘ └─────────────────────────────┘
+ ├─────────────┬─────────────┤├────┬─────┤├──────────────┬──────────────┤
+ │ │ │
+ ╭──────────┴──────────╮ ╭─────┴────╮ ╭───────┴───────╮
+ │under-read of 4 bytes│ │2380 bytes│ │size: 240 bytes│
+ ╰─────────────────────╯ ╰──────────╯ ╰───────────────╯
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c b/gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c
index 7c8d1b3..5b8ff7b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c
@@ -26,7 +26,7 @@ void test_2 (void *p, void *q)
foo(p);
/* { dg-warning "pattern match on 'p != 0'" "p != 0" { target *-*-* } cond_2 } */
- /* { dg-warning "pattern match on 'tmp1 | tmp2 != 0'" "tmp1 | tmp2 != 0" { target *-*-* } cond_2 } */
+ /* { dg-warning "pattern match on 'p == 0 | q == 0 != 0'" "tmp1 | tmp2 != 0" { target *-*-* } cond_2 } */
/* { dg-warning "pattern match on 'q != 0'" "q != 0" { target *-*-* } cond_2 } */
}
@@ -42,6 +42,6 @@ void test_3 (void *p, void *q)
foo(p);
/* { dg-warning "pattern match on 'p == 0'" "p == 0" { target *-*-* } cond_3 } */
- /* { dg-warning "pattern match on 'tmp1 & tmp2 == 0'" "tmp1 & tmp2 == 0" { target *-*-* } cond_3 } */
+ /* { dg-warning "pattern match on 'p == 0 & q == 0 == 0'" "tmp1 & tmp2 == 0" { target *-*-* } cond_3 } */
/* { dg-warning "pattern match on 'q == 0'" "q == 0" { target *-*-* } cond_3 } */
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr101962.c b/gcc/testsuite/gcc.dg/analyzer/pr101962.c
index b878aad..5eb7cf0 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr101962.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr101962.c
@@ -16,7 +16,7 @@ maybe_inc_int_ptr (int *ptr)
int
test_1 (void)
{
- int stack; /* { dg-message "region created on stack here" } */
+ int stack;
int *a = &stack;
a = maybe_inc_int_ptr (a);
a = maybe_inc_int_ptr (a);
diff --git a/gcc/testsuite/gcc.dg/missing-header-fixit-5.c b/gcc/testsuite/gcc.dg/missing-header-fixit-5.c
index 916033c..bf44feb 100644
--- a/gcc/testsuite/gcc.dg/missing-header-fixit-5.c
+++ b/gcc/testsuite/gcc.dg/missing-header-fixit-5.c
@@ -12,14 +12,18 @@ foo (char *m, int i)
/* { dg-begin-multiline-output "" }
11 | if (isdigit (m[0]))
| ^~~~~~~
+ { dg-end-multiline-output "" } */
+ /* { dg-begin-multiline-output "" }
+++ |+#include <ctype.h>
1 |
{ dg-end-multiline-output "" } */
{
return abs (i); /* { dg-warning "implicit declaration of function" } */
/* { dg-begin-multiline-output "" }
- 19 | return abs (i);
+ 21 | return abs (i);
| ^~~
+ { dg-end-multiline-output "" } */
+ /* { dg-begin-multiline-output "" }
+++ |+#include <stdlib.h>
1 |
{ dg-end-multiline-output "" } */
@@ -27,8 +31,10 @@ foo (char *m, int i)
else
putchar (m[0]); /* { dg-warning "implicit declaration of function" } */
/* { dg-begin-multiline-output "" }
- 28 | putchar (m[0]);
+ 32 | putchar (m[0]);
| ^~~~~~~
+ { dg-end-multiline-output "" } */
+ /* { dg-begin-multiline-output "" }
+++ |+#include <stdio.h>
1 |
{ dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c b/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c
index e494315..e0fc9cd 100644
--- a/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c
@@ -155,7 +155,7 @@ class double_save_thread : public gil_diagnostic
return m_call == sub_other.m_call;
}
- bool emit (rich_location *rich_loc) final override
+ bool emit (rich_location *rich_loc, logger *) final override
{
return warning_at (rich_loc, get_controlling_option (),
"nested usage of %qs", "Py_BEGIN_ALLOW_THREADS");
@@ -194,7 +194,7 @@ class fncall_without_gil : public gil_diagnostic
&& m_arg_idx == sub_other.m_arg_idx);
}
- bool emit (rich_location *rich_loc) final override
+ bool emit (rich_location *rich_loc, logger *) final override
{
auto_diagnostic_group d;
if (m_callee_fndecl)
@@ -245,7 +245,7 @@ class pyobject_usage_without_gil : public gil_diagnostic
((const pyobject_usage_without_gil&)base_other).m_expr);
}
- bool emit (rich_location *rich_loc) final override
+ bool emit (rich_location *rich_loc, logger *) final override
{
auto_diagnostic_group d;
return warning_at (rich_loc, get_controlling_option (),
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-ascii-bw.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-ascii-bw.c
new file mode 100644
index 0000000..e4239aa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-ascii-bw.c
@@ -0,0 +1,57 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=ascii -fdiagnostics-color=never" } */
+
+int non_empty;
+
+/* { dg-begin-multiline-output "" }
+
+ A
+ B
+ C
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜
+ ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟
+
+
+
+
+ ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙
+ ♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ +--+
+ |🙂|
+ +--+
+
+ { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
+
+ +-------+-----+---------------+---------------------+-----------------------+-----------------------+
+ |Offsets|Octet| 0 | 1 | 2 | 3 |
+ +-------+-----+-+-+-+-+-+-+-+-+-+-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | Octet | Bit |0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|
+ +-------+-----+-+-+-+-+-+-+-+-+-+-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | 0 | 0 |Version| IHL | DSCP | ECN | Total Length |
+ +-------+-----+-------+-------+---------------+-----+--------+--------------------------------------+
+ | 4 | 32 | Identification | Flags | Fragment Offset |
+ +-------+-----+---------------+---------------------+--------+--------------------------------------+
+ | 8 | 64 | Time To Live | Protocol | Header Checksum |
+ +-------+-----+---------------+---------------------+-----------------------------------------------+
+ | 12 | 96 | Source IP Address |
+ +-------+-----+-------------------------------------------------------------------------------------+
+ | 16 | 128 | Destination IP Address |
+ +-------+-----+-------------------------------------------------------------------------------------+
+ | 20 | 160 | |
+ +-------+-----+ |
+ | ... | ... | Options |
+ +-------+-----+ |
+ | 56 | 448 | |
+ +-------+-----+-------------------------------------------------------------------------------------+
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-ascii-color.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-ascii-color.c
new file mode 100644
index 0000000..0650428
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-ascii-color.c
@@ -0,0 +1,58 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=ascii -fdiagnostics-color=always" } */
+
+int non_empty;
+
+/* { dg-begin-multiline-output "" }
+
+ A
+ B
+ C
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜ 
+ ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟ 
+         
+         
+         
+         
+ ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙ 
+ ♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖ 
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ +--+
+ |🙂|
+ +--+
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ +-------+-----+---------------+---------------------+-----------------------+-----------------------+
+ |Offsets|Octet| 0 | 1 | 2 | 3 |
+ +-------+-----+-+-+-+-+-+-+-+-+-+-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | Octet | Bit |0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|
+ +-------+-----+-+-+-+-+-+-+-+-+-+-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | 0 | 0 |Version| IHL | DSCP | ECN | Total Length |
+ +-------+-----+-------+-------+---------------+-----+--------+--------------------------------------+
+ | 4 | 32 | Identification | Flags | Fragment Offset |
+ +-------+-----+---------------+---------------------+--------+--------------------------------------+
+ | 8 | 64 | Time To Live | Protocol | Header Checksum |
+ +-------+-----+---------------+---------------------+-----------------------------------------------+
+ | 12 | 96 | Source IP Address |
+ +-------+-----+-------------------------------------------------------------------------------------+
+ | 16 | 128 | Destination IP Address |
+ +-------+-----+-------------------------------------------------------------------------------------+
+ | 20 | 160 | |
+ +-------+-----+ |
+ | ... | ... | Options |
+ +-------+-----+ |
+ | 56 | 448 | |
+ +-------+-----+-------------------------------------------------------------------------------------+
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-none.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-none.c
new file mode 100644
index 0000000..c8118b4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-none.c
@@ -0,0 +1,5 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=none" } */
+
+int non_empty;
+
+/* We expect no output. */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-unicode-bw.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-unicode-bw.c
new file mode 100644
index 0000000..c9f5b36
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-unicode-bw.c
@@ -0,0 +1,58 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode -fdiagnostics-color=never" } */
+
+int non_empty;
+
+/* { dg-begin-multiline-output "" }
+
+ A
+ B
+ C
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜
+ ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟
+
+
+
+
+ ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙
+ ♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌──┐
+ │🙂│
+ └──┘
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌───────┬─────┬───────────────┬─────────────────────┬───────────────────────┬───────────────────────┐
+ │Offsets│Octet│ 0 │ 1 │ 2 │ 3 │
+ ├───────┼─────┼─┬─┬─┬─┬─┬─┬─┬─┼─┬─┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┤
+ │ Octet │ Bit │0│1│2│3│4│5│6│7│8│9│10│11│12│13│14│15│16│17│18│19│20│21│22│23│24│25│26│27│28│29│30│31│
+ ├───────┼─────┼─┴─┴─┴─┼─┴─┴─┴─┼─┴─┴──┴──┴──┴──┼──┴──┼──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┤
+ │ 0 │ 0 │Version│ IHL │ DSCP │ ECN │ Total Length │
+ ├───────┼─────┼───────┴───────┴───────────────┴─────┼────────┬──────────────────────────────────────┤
+ │ 4 │ 32 │ Identification │ Flags │ Fragment Offset │
+ ├───────┼─────┼───────────────┬─────────────────────┼────────┴──────────────────────────────────────┤
+ │ 8 │ 64 │ Time To Live │ Protocol │ Header Checksum │
+ ├───────┼─────┼───────────────┴─────────────────────┴───────────────────────────────────────────────┤
+ │ 12 │ 96 │ Source IP Address │
+ ├───────┼─────┼─────────────────────────────────────────────────────────────────────────────────────┤
+ │ 16 │ 128 │ Destination IP Address │
+ ├───────┼─────┼─────────────────────────────────────────────────────────────────────────────────────┤
+ │ 20 │ 160 │ │
+ ├───────┼─────┤ │
+ │ ... │ ... │ Options │
+ ├───────┼─────┤ │
+ │ 56 │ 448 │ │
+ └───────┴─────┴─────────────────────────────────────────────────────────────────────────────────────┘
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-unicode-color.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-unicode-color.c
new file mode 100644
index 0000000..f402836
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-text-art-unicode-color.c
@@ -0,0 +1,59 @@
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode -fdiagnostics-color=always" } */
+
+int non_empty;
+
+
+/* { dg-begin-multiline-output "" }
+
+ A
+ B
+ C
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜ 
+ ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟ 
+         
+         
+         
+         
+ ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙ 
+ ♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖ 
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌──┐
+ │🙂│
+ └──┘
+
+ { dg-end-multiline-output "" } */
+
+/* { dg-begin-multiline-output "" }
+
+ ┌───────┬─────┬───────────────┬─────────────────────┬───────────────────────┬───────────────────────┐
+ │Offsets│Octet│ 0 │ 1 │ 2 │ 3 │
+ ├───────┼─────┼─┬─┬─┬─┬─┬─┬─┬─┼─┬─┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┼──┬──┬──┬──┬──┬──┬──┬──┤
+ │ Octet │ Bit │0│1│2│3│4│5│6│7│8│9│10│11│12│13│14│15│16│17│18│19│20│21│22│23│24│25│26│27│28│29│30│31│
+ ├───────┼─────┼─┴─┴─┴─┼─┴─┴─┴─┼─┴─┴──┴──┴──┴──┼──┴──┼──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┤
+ │ 0 │ 0 │Version│ IHL │ DSCP │ ECN │ Total Length │
+ ├───────┼─────┼───────┴───────┴───────────────┴─────┼────────┬──────────────────────────────────────┤
+ │ 4 │ 32 │ Identification │ Flags │ Fragment Offset │
+ ├───────┼─────┼───────────────┬─────────────────────┼────────┴──────────────────────────────────────┤
+ │ 8 │ 64 │ Time To Live │ Protocol │ Header Checksum │
+ ├───────┼─────┼───────────────┴─────────────────────┴───────────────────────────────────────────────┤
+ │ 12 │ 96 │ Source IP Address │
+ ├───────┼─────┼─────────────────────────────────────────────────────────────────────────────────────┤
+ │ 16 │ 128 │ Destination IP Address │
+ ├───────┼─────┼─────────────────────────────────────────────────────────────────────────────────────┤
+ │ 20 │ 160 │ │
+ ├───────┼─────┤ │
+ │ ... │ ... │ Options │
+ ├───────┼─────┤ │
+ │ 56 │ 448 │ │
+ └───────┴─────┴─────────────────────────────────────────────────────────────────────────────────────┘
+
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c
new file mode 100644
index 0000000..58b219b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c
@@ -0,0 +1,258 @@
+/* { dg-options "-O" } */
+
+/* This plugin exercises the text_art code. */
+
+#define INCLUDE_VECTOR
+#include "gcc-plugin.h"
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "plugin-version.h"
+#include "diagnostic.h"
+#include "diagnostic-diagram.h"
+#include "text-art/canvas.h"
+#include "text-art/table.h"
+
+int plugin_is_GPL_compatible;
+
+using namespace text_art;
+
+/* Canvas tests. */
+
+static void
+emit_canvas (const canvas &c, const char *alt_text)
+{
+ diagnostic_diagram diagram (c, alt_text);
+ diagnostic_emit_diagram (global_dc, diagram);
+}
+
+static void
+test_abc ()
+{
+ style_manager sm;
+ canvas c (canvas::size_t (3, 3), sm);
+ c.paint (canvas::coord_t (0, 0), styled_unichar ('A'));
+ c.paint (canvas::coord_t (1, 1), styled_unichar ('B'));
+ c.paint (canvas::coord_t (2, 2), styled_unichar ('C'));
+ emit_canvas (c, "test_abc");
+}
+
+/* Test of procedural art using 24-bit color: chess starting position. */
+
+static void
+test_chessboard ()
+{
+ /* With the exception of NONE, these are in order of the chess symbols
+ in the Unicode Miscellaneous Symbols block. */
+ enum class piece { KING, QUEEN, ROOK, BISHOP, KNIGHT, PAWN, NONE };
+ enum class color { BLACK, WHITE, NONE };
+
+ style_manager sm;
+
+ /* We assume double-column chars for the pieces, so allow two canvas
+ columns per square. */
+ canvas canvas (canvas::size_t (16, 8), sm);
+
+ for (int x = 0; x < 8; x++)
+ for (int y = 0; y < 8; y++)
+ {
+ enum piece piece_kind;
+ enum color piece_color;
+ switch (y)
+ {
+ case 0:
+ case 7:
+ switch (x)
+ {
+ default:
+ gcc_unreachable ();
+ case 0:
+ piece_kind = piece::ROOK;
+ break;
+ case 1:
+ piece_kind = piece::KNIGHT;
+ break;
+ case 2:
+ piece_kind = piece::BISHOP;
+ break;
+ case 3:
+ piece_kind = piece::QUEEN;
+ break;
+ case 4:
+ piece_kind = piece::KING;
+ break;
+ case 5:
+ piece_kind = piece::BISHOP;
+ break;
+ case 6:
+ piece_kind = piece::KNIGHT;
+ break;
+ case 7:
+ piece_kind = piece::ROOK;
+ break;
+ }
+ piece_color = (y == 0) ? color::BLACK : color::WHITE;
+ break;
+ case 1:
+ case 6:
+ piece_kind = piece::PAWN;
+ piece_color = (y == 1) ? color::BLACK : color::WHITE;
+ break;
+ default:
+ piece_kind = piece::NONE;
+ piece_color = color::NONE;
+ break;
+ }
+
+ style s;
+ const bool white_square = (x + y) % 2 == 0;
+ if (white_square)
+ s.m_bg_color = style::color (0xf0, 0xd9, 0xb5);
+ else
+ s.m_bg_color = style::color (0xb5, 0x88, 0x63);
+ switch (piece_color)
+ {
+ default:
+ gcc_unreachable ();
+ case color::WHITE:
+ s.m_fg_color = style::color (0xff, 0xff, 0xff);
+ break;
+ case color::BLACK:
+ s.m_fg_color = style::color (0x00, 0x00, 0x00);
+ break;
+ case color::NONE:
+ break;
+ }
+ style::id_t style_id = sm.get_or_create_id (s);
+
+ cppchar_t ch;
+ if (piece_kind == piece::NONE)
+ ch = ' ';
+ else
+ {
+ const cppchar_t WHITE_KING = 0x2654;
+ const cppchar_t BLACK_KING = 0x265A;
+ cppchar_t base ((piece_color == color::WHITE)
+ ? WHITE_KING : BLACK_KING);
+ ch = base + ((int)piece_kind - (int)piece::KING);
+ }
+ canvas.paint (canvas::coord_t (x * 2, y),
+ canvas::cell_t (ch, false, style_id));
+ canvas.paint (canvas::coord_t (x * 2 + 1, y),
+ canvas::cell_t (' ', false, style_id));
+ }
+ emit_canvas (canvas, "test_chessboard");
+}
+
+/* Table tests. */
+
+static void
+emit_table (const table &table, const style_manager &sm, const char *alt_text)
+{
+ const text_art::theme *theme = global_dc->m_diagrams.m_theme;
+ if (!theme)
+ return;
+ canvas c (table.to_canvas (*theme, sm));
+ emit_canvas (c, alt_text);
+}
+
+static void
+test_double_width_chars ()
+{
+ style_manager sm;
+ table table (table::size_t (1, 1));
+ table.set_cell (table::coord_t (0,0),
+ styled_string ((cppchar_t)0x1f642));
+
+ emit_table (table, sm, "test_double_width_chars");
+}
+
+static void
+test_ipv4_header ()
+{
+ style_manager sm;
+ table table (table::size_t (34, 10));
+ table.set_cell (table::coord_t (0, 0), styled_string (sm, "Offsets"));
+ table.set_cell (table::coord_t (1, 0), styled_string (sm, "Octet"));
+ table.set_cell (table::coord_t (0, 1), styled_string (sm, "Octet"));
+ for (int octet = 0; octet < 4; octet++)
+ table.set_cell_span (table::rect_t (table::coord_t (2 + (octet * 8), 0),
+ table::size_t (8, 1)),
+ styled_string::from_fmt (sm, nullptr, "%i", octet));
+ table.set_cell (table::coord_t (1, 1), styled_string (sm, "Bit"));
+ for (int bit = 0; bit < 32; bit++)
+ table.set_cell (table::coord_t (bit + 2, 1),
+ styled_string::from_fmt (sm, nullptr, "%i", bit));
+ for (int word = 0; word < 6; word++)
+ {
+ table.set_cell (table::coord_t (0, word + 2),
+ styled_string::from_fmt (sm, nullptr, "%i", word * 4));
+ table.set_cell (table::coord_t (1, word + 2),
+ styled_string::from_fmt (sm, nullptr, "%i", word * 32));
+ }
+
+ table.set_cell (table::coord_t (0, 8), styled_string (sm, "..."));
+ table.set_cell (table::coord_t (1, 8), styled_string (sm, "..."));
+ table.set_cell (table::coord_t (0, 9), styled_string (sm, "56"));
+ table.set_cell (table::coord_t (1, 9), styled_string (sm, "448"));
+
+#define SET_BITS(FIRST, LAST, NAME) \
+ do { \
+ const int first = (FIRST); \
+ const int last = (LAST); \
+ const char *name = (NAME); \
+ const int row = first / 32; \
+ gcc_assert (last / 32 == row); \
+ table::rect_t rect (table::coord_t ((first % 32) + 2, row + 2), \
+ table::size_t (last + 1 - first , 1)); \
+ table.set_cell_span (rect, styled_string (sm, name)); \
+ } while (0)
+
+ SET_BITS (0, 3, "Version");
+ SET_BITS (4, 7, "IHL");
+ SET_BITS (8, 13, "DSCP");
+ SET_BITS (14, 15, "ECN");
+ SET_BITS (16, 31, "Total Length");
+
+ SET_BITS (32 + 0, 32 + 15, "Identification");
+ SET_BITS (32 + 16, 32 + 18, "Flags");
+ SET_BITS (32 + 19, 32 + 31, "Fragment Offset");
+
+ SET_BITS (64 + 0, 64 + 7, "Time To Live");
+ SET_BITS (64 + 8, 64 + 15, "Protocol");
+ SET_BITS (64 + 16, 64 + 31, "Header Checksum");
+
+ SET_BITS (96 + 0, 96 + 31, "Source IP Address");
+ SET_BITS (128 + 0, 128 + 31, "Destination IP Address");
+
+ table.set_cell_span(table::rect_t (table::coord_t (2, 7),
+ table::size_t (32, 3)),
+ styled_string (sm, "Options"));
+
+ emit_table (table, sm, "test_ipv4_header");
+}
+
+static void
+show_diagrams ()
+{
+ test_abc ();
+ test_chessboard ();
+ test_double_width_chars ();
+ test_ipv4_header ();
+}
+
+int
+plugin_init (struct plugin_name_args *plugin_info,
+ struct plugin_gcc_version *version)
+{
+ const char *plugin_name = plugin_info->base_name;
+ int argc = plugin_info->argc;
+ struct plugin_argument *argv = plugin_info->argv;
+
+ if (!plugin_default_version_check (version, &gcc_version))
+ return 1;
+
+ show_diagrams ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp
index 4d6304c..60723a2 100644
--- a/gcc/testsuite/gcc.dg/plugin/plugin.exp
+++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp
@@ -114,6 +114,12 @@ set plugin_test_list [list \
diagnostic-path-format-inline-events-1.c \
diagnostic-path-format-inline-events-2.c \
diagnostic-path-format-inline-events-3.c } \
+ { diagnostic_plugin_test_text_art.c \
+ diagnostic-test-text-art-none.c \
+ diagnostic-test-text-art-ascii-bw.c \
+ diagnostic-test-text-art-ascii-color.c \
+ diagnostic-test-text-art-unicode-bw.c \
+ diagnostic-test-text-art-unicode-color.c } \
{ location_overflow_plugin.c \
location-overflow-test-1.c \
location-overflow-test-2.c \
diff --git a/gcc/testsuite/gcc.dg/torture/pr110332-1.c b/gcc/testsuite/gcc.dg/torture/pr110332-1.c
new file mode 100644
index 0000000..438993e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr110332-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+struct s { int lie; };
+struct s si7, si8;
+unsigned u9, u6;
+_Bool b3, b4;
+unsigned transferValues(struct s *End) {
+ unsigned RegIdx;
+ unsigned *t = b4 ? &u6 : &u9;
+ RegIdx = *t;
+ *End = *(b3 ? &si7 : &si8);
+ return RegIdx;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr110332-2.c b/gcc/testsuite/gcc.dg/torture/pr110332-2.c
new file mode 100644
index 0000000..18b656f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr110332-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+_Bool a;
+struct s { int t; } c, d;
+unsigned e, f;
+unsigned transferValues(struct s *End) {
+ unsigned RegIdx = *(a ? &e : &f);
+ *End = *(a ? &c : &d);
+ return RegIdx;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr110381.c b/gcc/testsuite/gcc.dg/vect/pr110381.c
new file mode 100644
index 0000000..2313dbf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr110381.c
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+
+struct FOO {
+ double a;
+ double b;
+ double c;
+};
+
+double __attribute__((noipa))
+sum_8_foos(const struct FOO* foos)
+{
+ double sum = 0;
+
+ for (int i = 0; i < 8; ++i)
+ {
+ struct FOO foo = foos[i];
+
+ /* Need to use an in-order reduction here, preserving
+ the load permutation. */
+ sum += foo.a;
+ sum += foo.c;
+ sum += foo.b;
+ }
+
+ return sum;
+}
+
+int main()
+{
+ struct FOO foos[8];
+
+ __builtin_memset (foos, 0, sizeof (foos));
+ foos[0].a = __DBL_MAX__;
+ foos[0].b = 5;
+ foos[0].c = -__DBL_MAX__;
+
+ if (sum_8_foos (foos) != 5)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/pr110371.c b/gcc/testsuite/gcc.target/aarch64/pr110371.c
new file mode 100644
index 0000000..444e514e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr110371.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef struct dest
+{
+ double m[3][3];
+} dest;
+
+typedef struct src
+{
+ int m[3][3];
+} src;
+
+void
+foo (dest *a, src* s)
+{
+ for (int i = 0; i != 3; i++)
+ for (int j = 0; j != 3; j++)
+ a->m[i][j] = s->m[i][j];
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
new file mode 100644
index 0000000..d3279f3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-optimized" } */
+
+#include "arm_sve.h"
+
+svuint32_t l()
+{
+ _Alignas(16) const unsigned int lanes[4] = {0, 0, 0, 0};
+ return svld1rq_u32(svptrue_b8(), lanes);
+}
+
+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ashldi3-1.c b/gcc/testsuite/gcc.target/i386/ashldi3-1.c
new file mode 100644
index 0000000..b61d63b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ashldi3-1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2" } */
+
+long long foo(long long x, int y)
+{
+ long long t = (long long)y << 32;
+ return x ^ t;
+}
+
+long long bar(long long x, int y)
+{
+ long long t = (long long)y << 35;
+ return x ^ t;
+}
+
+/* { dg-final { scan-assembler-times "xorl" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/ashlti3-2.c b/gcc/testsuite/gcc.target/i386/ashlti3-2.c
new file mode 100644
index 0000000..7e21ab9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ashlti3-2.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2" } */
+
+__int128 foo(__int128 x, long long y)
+{
+ __int128 t = (__int128)y << 64;
+ return x ^ t;
+}
+
+__int128 bar(__int128 x, long long y)
+{
+ __int128 t = (__int128)y << 67;
+ return x ^ t;
+}
+
+/* { dg-final { scan-assembler-not "xorl" } } */
+/* { dg-final { scan-assembler-times "xorq" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx-vptest-4.c b/gcc/testsuite/gcc.target/i386/avx-vptest-4.c
new file mode 100644
index 0000000..0a234e1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-vptest-4.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx" } */
+
+typedef long long __m256i __attribute__ ((__vector_size__ (32)));
+
+int foo (__m256i x, __m256i y)
+{
+ __m256i a = x & ~y;
+ return __builtin_ia32_ptestz256 (a, a);
+}
+
+int bar (__m256i x, __m256i y)
+{
+ __m256i a = ~x & y;
+ return __builtin_ia32_ptestz256 (a, a);
+}
+
+/* { dg-final { scan-assembler-times "vptest\[ \\t\]+%" 2 } } */
+/* { dg-final { scan-assembler-times "setc" 2 } } */
+/* { dg-final { scan-assembler-not "vpandn" } } */
+/* { dg-final { scan-assembler-not "sete" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx-vptest-5.c b/gcc/testsuite/gcc.target/i386/avx-vptest-5.c
new file mode 100644
index 0000000..fd0e5e2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-vptest-5.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx" } */
+
+typedef long long __m256i __attribute__ ((__vector_size__ (32)));
+
+int foo (__m256i x, __m256i y)
+{
+ __m256i a = x & ~y;
+ return !__builtin_ia32_ptestz256 (a, a);
+}
+
+int bar (__m256i x, __m256i y)
+{
+ __m256i a = ~x & y;
+ return !__builtin_ia32_ptestz256 (a, a);
+}
+
+/* { dg-final { scan-assembler-times "vptest\[ \\t\]+%" 2} } */
+/* { dg-final { scan-assembler-times "setnc" 2 } } */
+/* { dg-final { scan-assembler-not "vpandn" } } */
+/* { dg-final { scan-assembler-not "setne" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx-vptest-6.c b/gcc/testsuite/gcc.target/i386/avx-vptest-6.c
new file mode 100644
index 0000000..5821a92
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-vptest-6.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx" } */
+
+typedef long long __m256i __attribute__ ((__vector_size__ (32)));
+
+extern void ext (void);
+
+void foo (__m256i x, __m256i y)
+{
+ __m256i a = x & ~y;
+ if (__builtin_ia32_ptestz256 (a, a))
+ ext();
+}
+
+void bar (__m256i x, __m256i y)
+{
+ __m256i a = ~x & y;
+ if (__builtin_ia32_ptestz256 (a, a))
+ ext();
+}
+
+void foo2 (__m256i x, __m256i y)
+{
+ __m256i a = x & ~y;
+ if (__builtin_ia32_ptestz256 (a, a))
+ ext();
+}
+
+void bar2 (__m256i x, __m256i y)
+{
+ __m256i a = ~x & y;
+ if (__builtin_ia32_ptestz256 (a, a))
+ ext();
+}
+
+/* { dg-final { scan-assembler-times "ptest\[ \\t\]+%" 4 } } */
+/* { dg-final { scan-assembler-times "jn?c" 4 } } */
+/* { dg-final { scan-assembler-not "pandn" } } */
+/* { dg-final { scan-assembler-not "jne" } } */
+/* { dg-final { scan-assembler-not "je" } } */
diff --git a/gcc/testsuite/gcc.target/i386/mvc17.c b/gcc/testsuite/gcc.target/i386/mvc17.c
new file mode 100644
index 0000000..2c7cc2f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mvc17.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-ifunc "" } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "rep mov" 1 } } */
+
+__attribute__((target_clones("default","arch=icelake-server")))
+void
+foo (char *a, char *b, int size)
+{
+ __builtin_memcpy (a, b, size & 0x7F);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr109973-1.c b/gcc/testsuite/gcc.target/i386/pr109973-1.c
index a1b6136b..1d812dd 100644
--- a/gcc/testsuite/gcc.target/i386/pr109973-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr109973-1.c
@@ -10,4 +10,4 @@ foo (__m256i x, __m256i y)
return __builtin_ia32_ptestc256 (a, a);
}
-/* { dg-final { scan-assembler "vpand" } } */
+/* { dg-final { scan-assembler "movl\[ \\t]*\\\$1, %eax" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr109973-2.c b/gcc/testsuite/gcc.target/i386/pr109973-2.c
index 167f6ee..1068c3e 100644
--- a/gcc/testsuite/gcc.target/i386/pr109973-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr109973-2.c
@@ -10,4 +10,4 @@ foo (__m128i x, __m128i y)
return __builtin_ia32_ptestc128 (a, a);
}
-/* { dg-final { scan-assembler "pand" } } */
+/* { dg-final { scan-assembler "movl\[ \\t]*\\\$1, %eax" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr110018-1.c b/gcc/testsuite/gcc.target/i386/pr110018-1.c
index b6a3be7..24eeca6 100644
--- a/gcc/testsuite/gcc.target/i386/pr110018-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr110018-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mavx512fp16 -mavx512vl -O2 -mavx512dq" } */
+/* { dg-options "-mavx512fp16 -mavx512vl -O2 -mavx512dq -fno-trapping-math" } */
/* { dg-final { scan-assembler-times {(?n)vcvttp[dsh]2[dqw]} 5 } } */
/* { dg-final { scan-assembler-times {(?n)vcvt[dqw]*2p[dsh]} 5 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr110018-2.c b/gcc/testsuite/gcc.target/i386/pr110018-2.c
index a663e07..9a2d9e1 100644
--- a/gcc/testsuite/gcc.target/i386/pr110018-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr110018-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mavx512fp16 -mavx512vl -O2 -mavx512dq" } */
+/* { dg-options "-mavx512fp16 -mavx512vl -O2 -mavx512dq -fno-trapping-math" } */
/* { dg-final { scan-assembler-times {(?n)vcvttp[dsh]2[dqw]} 5 } } */
/* { dg-final { scan-assembler-times {(?n)vcvt[dqw]*2p[dsh]} 5 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr110309.c b/gcc/testsuite/gcc.target/i386/pr110309.c
new file mode 100644
index 0000000..f6e9e9c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr110309.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 --param vect-partial-vector-usage=1 -march=znver4 -mprefer-vector-width=256" } */
+/* { dg-final { scan-assembler-not {(?n)vpblendd.*ymm} } } */
+
+
+void foo (int * __restrict a, int *b)
+{
+ for (int i = 0; i < 6; ++i)
+ a[i] = b[i] + 42;
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-ptest-4.c b/gcc/testsuite/gcc.target/i386/sse4_1-ptest-4.c
new file mode 100644
index 0000000..e74ddb3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-ptest-4.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse4.1" } */
+
+typedef long long __m128i __attribute__ ((__vector_size__ (16)));
+
+int foo (__m128i x, __m128i y)
+{
+ __m128i a = x & ~y;
+ return __builtin_ia32_ptestz128 (a, a);
+}
+
+int bar (__m128i x, __m128i y)
+{
+ __m128i a = ~x & y;
+ return __builtin_ia32_ptestz128 (a, a);
+}
+
+/* { dg-final { scan-assembler-times "ptest\[ \\t\]+%" 2 } } */
+/* { dg-final { scan-assembler-times "setc" 2 } } */
+/* { dg-final { scan-assembler-not "pandn" } } */
+/* { dg-final { scan-assembler-not "sete" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-ptest-5.c b/gcc/testsuite/gcc.target/i386/sse4_1-ptest-5.c
new file mode 100644
index 0000000..74b0a8c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-ptest-5.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse4.1" } */
+
+typedef long long __m128i __attribute__ ((__vector_size__ (16)));
+
+int foo (__m128i x, __m128i y)
+{
+ __m128i a = x & ~y;
+ return !__builtin_ia32_ptestz128 (a, a);
+}
+
+int bar (__m128i x, __m128i y)
+{
+ __m128i a = ~x & y;
+ return !__builtin_ia32_ptestz128 (a, a);
+}
+
+/* { dg-final { scan-assembler-times "ptest\[ \\t\]+%" 2 } } */
+/* { dg-final { scan-assembler-times "setnc" 2 } } */
+/* { dg-final { scan-assembler-not "pandn" } } */
+/* { dg-final { scan-assembler-not "setne" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-ptest-6.c b/gcc/testsuite/gcc.target/i386/sse4_1-ptest-6.c
new file mode 100644
index 0000000..d9114bb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-ptest-6.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse4.1" } */
+
+typedef long long __m128i __attribute__ ((__vector_size__ (16)));
+
+extern void ext (void);
+
+void foo (__m128i x, __m128i y)
+{
+ __m128i a = x & ~y;
+ if (__builtin_ia32_ptestz128 (a, a))
+ ext();
+}
+
+void bar (__m128i x, __m128i y)
+{
+ __m128i a = ~x & y;
+ if (__builtin_ia32_ptestz128 (a, a))
+ ext();
+}
+
+void foo2 (__m128i x, __m128i y)
+{
+ __m128i a = x & ~y;
+ if (__builtin_ia32_ptestz128 (a, a))
+ ext();
+}
+
+void bar2 (__m128i x, __m128i y)
+{
+ __m128i a = ~x & y;
+ if (__builtin_ia32_ptestz128 (a, a))
+ ext();
+}
+
+/* { dg-final { scan-assembler-times "ptest\[ \\t\]+%" 4 } } */
+/* { dg-final { scan-assembler-times "jn?c" 4 } } */
+/* { dg-final { scan-assembler-not "pandn" } } */
+/* { dg-final { scan-assembler-not "jne" } } */
+/* { dg-final { scan-assembler-not "je" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c
index 526a026..165bd9a 100644
--- a/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c
+++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c
@@ -54,15 +54,17 @@ TEST(uint8_t)
TEST(int8_t)
/* { dg-final { scan-assembler-times "lbz_cmpldi_cr0_QI_clobber_CCUNS_zero" 4 { target lp64 } } } */
-/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_DI_CC_none" 4 { target lp64 } } } */
-/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_clobber_CC_none" 4 { target lp64 } } } */
-/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_DI_CCUNS_none" 1 { target lp64 } } } */
-/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_clobber_CCUNS_none" 1 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_DI_CC_none" 24 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_clobber_CC_none" 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_DI_CCUNS_none" 2 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_clobber_CCUNS_none" 2 { target lp64 } } } */
/* { dg-final { scan-assembler-times "lha_cmpdi_cr0_HI_clobber_CC_sign" 16 { target lp64 } } } */
/* { dg-final { scan-assembler-times "lhz_cmpldi_cr0_HI_clobber_CCUNS_zero" 4 { target lp64 } } } */
/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_EXTSI_CC_sign" 0 { target lp64 } } } */
-/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_clobber_CC_none" 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "lwz_cmpwi_cr0_SI_clobber_CC_none" 8 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "lwz_cmpwi_cr0_SI_SI_CC_none" 8 { target lp64 } } } */
/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_EXTSI_CCUNS_zero" 0 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_SI_CCUNS_none" 2 { target lp64 } } } */
/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_clobber_CCUNS_none" 2 { target lp64 } } } */
/* { dg-final { scan-assembler-times "lbz_cmpldi_cr0_QI_clobber_CCUNS_zero" 2 { target ilp32 } } } */
@@ -73,6 +75,8 @@ TEST(int8_t)
/* { dg-final { scan-assembler-times "lha_cmpdi_cr0_HI_clobber_CC_sign" 8 { target ilp32 } } } */
/* { dg-final { scan-assembler-times "lhz_cmpldi_cr0_HI_clobber_CCUNS_zero" 2 { target ilp32 } } } */
/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_EXTSI_CC_sign" 0 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_clobber_CC_none" 9 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "lwz_cmpwi_cr0_SI_SI_CC_none" 36 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "lwz_cmpwi_cr0_SI_clobber_CC_none" 16 { target ilp32 } } } */
/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_EXTSI_CCUNS_zero" 0 { target ilp32 } } } */
/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_clobber_CCUNS_none" 6 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_SI_CCUNS_none" 2 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/gimple_fold-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/gimple_fold-1.c
new file mode 100644
index 0000000..23407a2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/gimple_fold-1.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m8 -O3 -fdump-tree-optimized-details" } */
+
+#include <stdint-gcc.h>
+
+#define SZ 255
+
+#define DEF(TYPE) void fn_##TYPE (TYPE *__restrict a);
+
+#define RUN(TYPE) \
+ TYPE a##TYPE[SZ]; \
+ for (int i = 0; i < SZ; i++) \
+ { \
+ a##TYPE[i] = 127; \
+ } \
+ fn_##TYPE (a##TYPE);
+
+#define RUN_ALL() \
+ RUN (int8_t) \
+ RUN (int16_t) \
+ RUN (int32_t) \
+ RUN (int64_t) \
+ RUN (uint8_t) \
+ RUN (uint16_t) \
+ RUN (uint32_t) \
+ RUN (uint64_t)
+
+DEF (int8_t)
+DEF (int16_t)
+DEF (int32_t)
+DEF (int64_t)
+DEF (uint8_t)
+DEF (uint16_t)
+DEF (uint32_t)
+DEF (uint64_t)
+
+int
+main ()
+{
+ RUN_ALL ()
+}
+
+/* { dg-final { scan-tree-dump-times "\.LEN_MASK_STORE" 6 "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/select_vl-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/select_vl-1.c
index 74bbf40..e27090d 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/select_vl-1.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/select_vl-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=scalable -fno-vect-cost-model -fno-tree-loop-distribute-patterns -fdump-tree-optimized-details" } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param riscv-autovec-preference=scalable -fno-vect-cost-model -fno-tree-loop-distribute-patterns -fdump-tree-optimized-details" } */
#include <stdint-gcc.h>
@@ -20,7 +20,10 @@
TEST_TYPE (uint32_t) \
TEST_TYPE (int64_t) \
TEST_TYPE (uint64_t) \
+ TEST_TYPE (_Float16) \
TEST_TYPE (float) \
TEST_TYPE (double)
TEST_ALL ()
+
+/* { dg-final { scan-tree-dump-times "\.SELECT_VL" 11 "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/select_vl-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/select_vl-2.c
new file mode 100644
index 0000000..eac7cbc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/select_vl-2.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d --param riscv-autovec-preference=scalable -fno-schedule-insns --param riscv-autovec-lmul=m1 -O3 -ftree-vectorize" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <stdint-gcc.h>
+
+/*
+** foo:
+** vsetivli\t[a-x0-9]+,\s*8,\s*e(8?|16?|32?|64),\s*m(1?|2?|4?|8?|f2?|f4?|f8),\s*t[au],\s*m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ...
+** vsetvli\t[a-x0-9]+,\s*[a-x0-9]+,\s*e(8?|16?|32?|64),\s*m(1?|2?|4?|8?|f2?|f4?|f8),\s*t[au],\s*m[au]
+** add\t[a-x0-9]+,[a-x0-9]+,[a-x0-9]+
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ...
+*/
+void
+foo (int32_t *__restrict a,
+ int32_t *__restrict b,
+ int32_t *__restrict cond)
+{
+ for (int i = 0; i < 8; i++)
+ if (cond[i])
+ a[i] = b[i];
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.c
new file mode 100644
index 0000000..24490dc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfhmin -mabi=ilp32d --param riscv-autovec-preference=fixed-vlmax -fdump-tree-vect-details" } */
+
+#include "single_rgroup-2.h"
+
+TEST_ALL (test_1)
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.h
new file mode 100644
index 0000000..a94f3eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.h
@@ -0,0 +1,44 @@
+#include <assert.h>
+#include <stdint-gcc.h>
+
+#define N 777
+
+#define test_1(TYPE) \
+ TYPE a_##TYPE[N] = {0}; \
+ TYPE b_##TYPE[N] = {0}; \
+ void __attribute__ ((noinline, noclone)) \
+ test_1_##TYPE (int *__restrict cond) \
+ { \
+ unsigned int i = 0; \
+ for (i = 0; i < 8; i++) \
+ if (cond[i]) \
+ b_##TYPE[i] = a_##TYPE[i]; \
+ }
+
+#define run_1(TYPE) \
+ int cond_##TYPE[N] = {0}; \
+ for (unsigned int i = 0; i < N; i++) \
+ a_##TYPE[i] = i * 2 * 33 + 1 + 109; \
+ for (unsigned int i = 0; i < N; i++) \
+ cond_##TYPE[i] = i & 1; \
+ test_1_##TYPE (cond_##TYPE); \
+ for (unsigned int i = 0; i < N; i++) \
+ { \
+ if (cond_##TYPE[i] && i < 8) \
+ assert (b_##TYPE[i] == a_##TYPE[i]); \
+ else \
+ assert (b_##TYPE[i] == 0); \
+ }
+
+#define TEST_ALL(T) \
+ T (int8_t) \
+ T (uint8_t) \
+ T (int16_t) \
+ T (uint16_t) \
+ T (int32_t) \
+ T (uint32_t) \
+ T (int64_t) \
+ T (uint64_t) \
+ T (_Float16) \
+ T (float) \
+ T (double)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.c
new file mode 100644
index 0000000..9cbae13
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfhmin -mabi=ilp32d --param riscv-autovec-preference=scalable -fdump-tree-vect-details" } */
+
+#include "single_rgroup-3.h"
+
+TEST_ALL (test_1)
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 11 "vect" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.h
new file mode 100644
index 0000000..e60e0b1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.h
@@ -0,0 +1,149 @@
+#include <assert.h>
+#include <stdint-gcc.h>
+
+#define N 777
+
+int cond[N] = {0};
+#define test_1(TYPE) \
+ TYPE a_##TYPE[N]; \
+ TYPE b_##TYPE[N]; \
+ void __attribute__ ((noinline, noclone)) test_1_##TYPE (unsigned int n) \
+ { \
+ unsigned int i = 0; \
+ for (i = 0; i < n; i++) \
+ if (cond[i]) \
+ b_##TYPE[i] = a_##TYPE[i]; \
+ }
+
+#define run_1(TYPE) \
+ for (unsigned int i = 0; i < N; i++) \
+ a_##TYPE[i] = i * 2 * 33 + 1 + 109; \
+ test_1_##TYPE (5); \
+ for (unsigned int i = 0; i < N; i++) \
+ { \
+ if (cond[i] && i < 5) \
+ assert (b_##TYPE[i] == a_##TYPE[i]); \
+ else \
+ assert (b_##TYPE[i] == 0); \
+ }
+
+#define run_2(TYPE) \
+ for (unsigned int i = 0; i < N; i++) \
+ a_##TYPE[i] = i * 2 * 57 + 1 + 999; \
+ test_1_##TYPE (17); \
+ for (unsigned int i = 0; i < N; i++) \
+ { \
+ if (cond[i] && i < 17) \
+ assert (b_##TYPE[i] == a_##TYPE[i]); \
+ else \
+ assert (b_##TYPE[i] == 0); \
+ }
+
+#define run_3(TYPE) \
+ for (unsigned int i = 0; i < N; i++) \
+ a_##TYPE[i] = i * 2 * 77 + 1 + 3; \
+ test_1_##TYPE (32); \
+ for (unsigned int i = 0; i < N; i++) \
+ { \
+ if (cond[i] && i < 32) \
+ assert (b_##TYPE[i] == a_##TYPE[i]); \
+ else \
+ assert (b_##TYPE[i] == 0); \
+ }
+
+#define run_4(TYPE) \
+ for (unsigned int i = 0; i < N; i++) \
+ a_##TYPE[i] = i * 2 * 45 + 1 + 11; \
+ test_1_##TYPE (128); \
+ for (unsigned int i = 0; i < N; i++) \
+ { \
+ if (cond[i] && i < 128) \
+ assert (b_##TYPE[i] == a_##TYPE[i]); \
+ else \
+ assert (b_##TYPE[i] == 0); \
+ }
+
+#define run_5(TYPE) \
+ for (unsigned int i = 0; i < N; i++) \
+ a_##TYPE[i] = i * 2 * 199 + 1 + 79; \
+ test_1_##TYPE (177); \
+ for (unsigned int i = 0; i < N; i++) \
+ { \
+ if (cond[i] && i < 177) \
+ assert (b_##TYPE[i] == a_##TYPE[i]); \
+ else \
+ assert (b_##TYPE[i] == 0); \
+ }
+
+#define run_6(TYPE) \
+ for (unsigned int i = 0; i < N; i++) \
+ a_##TYPE[i] = i * 2 * 377 + 1 + 73; \
+ test_1_##TYPE (255); \
+ for (unsigned int i = 0; i < N; i++) \
+ { \
+ if (cond[i] && i < 255) \
+ assert (b_##TYPE[i] == a_##TYPE[i]); \
+ else \
+ assert (b_##TYPE[i] == 0); \
+ }
+
+#define run_7(TYPE) \
+ for (unsigned int i = 0; i < N; i++) \
+ a_##TYPE[i] = i * 2 * 98 + 1 + 66; \
+ test_1_##TYPE (333); \
+ for (unsigned int i = 0; i < N; i++) \
+ { \
+ if (cond[i] && i < 333) \
+ assert (b_##TYPE[i] == a_##TYPE[i]); \
+ else \
+ assert (b_##TYPE[i] == 0); \
+ }
+
+#define run_8(TYPE) \
+ for (unsigned int i = 0; i < N; i++) \
+ a_##TYPE[i] = i * 2 * 7 + 1 * 7; \
+ test_1_##TYPE (512); \
+ for (unsigned int i = 0; i < N; i++) \
+ { \
+ if (cond[i] && i < 512) \
+ assert (b_##TYPE[i] == a_##TYPE[i]); \
+ else \
+ assert (b_##TYPE[i] == 0); \
+ }
+
+#define run_9(TYPE) \
+ for (unsigned int i = 0; i < N; i++) \
+ a_##TYPE[i] = i * 2 + 1 + 88; \
+ test_1_##TYPE (637); \
+ for (unsigned int i = 0; i < N; i++) \
+ { \
+ if (cond[i] && i < 637) \
+ assert (b_##TYPE[i] == a_##TYPE[i]); \
+ else \
+ assert (b_##TYPE[i] == 0); \
+ }
+
+#define run_10(TYPE) \
+ for (unsigned int i = 0; i < N; i++) \
+ a_##TYPE[i] = i * 2 * 331 + 1 + 547; \
+ test_1_##TYPE (777); \
+ for (unsigned int i = 0; i < N; i++) \
+ { \
+ if (cond[i] && i < 777) \
+ assert (b_##TYPE[i] == a_##TYPE[i]); \
+ else \
+ assert (b_##TYPE[i] == 0); \
+ }
+
+#define TEST_ALL(T) \
+ T (int8_t) \
+ T (uint8_t) \
+ T (int16_t) \
+ T (uint16_t) \
+ T (int32_t) \
+ T (uint32_t) \
+ T (int64_t) \
+ T (uint64_t) \
+ T (_Float16) \
+ T (float) \
+ T (double)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-2.c
new file mode 100644
index 0000000..8767efe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-2.c
@@ -0,0 +1,10 @@
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param riscv-autovec-preference=fixed-vlmax" } */
+
+#include "single_rgroup-2.c"
+
+int main (void)
+{
+ TEST_ALL (run_1)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-3.c
new file mode 100644
index 0000000..9ff6e92
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-3.c
@@ -0,0 +1,22 @@
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param riscv-autovec-preference=scalable" } */
+
+#include "single_rgroup-3.c"
+
+int
+main (void)
+{
+ for (int i = 0; i < N; i++)
+ cond[i] = i & 1;
+ TEST_ALL (run_1)
+ TEST_ALL (run_2)
+ TEST_ALL (run_3)
+ TEST_ALL (run_4)
+ TEST_ALL (run_5)
+ TEST_ALL (run_6)
+ TEST_ALL (run_7)
+ TEST_ALL (run_8)
+ TEST_ALL (run_9)
+ TEST_ALL (run_10)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-1.c
index 1996ca6..4420001 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-1.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param=riscv-autovec-preference=scalable" } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math" } */
#include <stdint-gcc.h>
@@ -20,9 +20,13 @@
TEST_TYPE (int32_t) \
TEST_TYPE (uint32_t) \
TEST_TYPE (int64_t) \
- TEST_TYPE (uint64_t)
+ TEST_TYPE (uint64_t) \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
TEST_ALL ()
/* { dg-final { scan-assembler-times {\tvmadd\.vv} 8 } } */
+/* { dg-final { scan-assembler-times {\tvfmadd\.vv} 3 } } */
/* { dg-final { scan-assembler-not {\tvmv} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-10.c
new file mode 100644
index 0000000..fc66def
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-10.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include <stdint-gcc.h>
+
+#define TEST_TYPE(TYPE) \
+ __attribute__ ((noipa)) void ternop_##TYPE (TYPE *__restrict dst, \
+ TYPE *__restrict a, \
+ TYPE *__restrict b, int n) \
+ { \
+ for (int i = 0; i < n; i++) \
+ dst[i] = -(a[i] * b[i]) - dst[i]; \
+ }
+
+#define TEST_ALL() \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
+
+TEST_ALL ()
+
+/* { dg-final { scan-assembler-times {\tvfnmadd\.vv} 3 } } */
+/* { dg-final { scan-assembler-not {\tvmv} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-11.c
new file mode 100644
index 0000000..23c542f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-11.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fno-schedule-insns -ffast-math" } */
+
+#include <stdint-gcc.h>
+
+#define TEST_TYPE(TYPE) \
+ __attribute__ ((noipa)) void ternop_##TYPE (TYPE *__restrict dest1, \
+ TYPE *__restrict dest2, \
+ TYPE *__restrict dest3, \
+ TYPE *__restrict src1, \
+ TYPE *__restrict src2, int n) \
+ { \
+ for (int i = 0; i < n; ++i) \
+ { \
+ dest1[i] = -(src1[i] * src2[i]) - dest1[i]; \
+ dest2[i] = src1[i] * dest1[i] - dest2[i]; \
+ dest3[i] = src2[i] * dest2[i] - dest3[i]; \
+ } \
+ }
+
+#define TEST_ALL() \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
+
+TEST_ALL ()
+
+/* { dg-final { scan-assembler-times {\tvfnmacc\.vv} 3 } } */
+/* { dg-final { scan-assembler-not {\tvmv} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-12.c
new file mode 100644
index 0000000..8ec261b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-12.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include <stdint-gcc.h>
+
+#define TEST_TYPE(TYPE) \
+ __attribute__ ((noipa)) void ternop_##TYPE (TYPE *__restrict dest1, \
+ TYPE *__restrict dest2, \
+ TYPE *__restrict dest3, \
+ TYPE *__restrict src1, \
+ TYPE *__restrict src2, int n) \
+ { \
+ for (int i = 0; i < n; ++i) \
+ { \
+ dest1[i] = -(src1[i] * src2[i]) - dest2[i]; \
+ dest2[i] = src1[i] * dest1[i] - dest2[i]; \
+ dest3[i] = src2[i] * dest2[i] - dest3[i]; \
+ } \
+ }
+
+#define TEST_ALL() \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
+
+TEST_ALL ()
+
+/* { dg-final { scan-assembler-times {\tvmv} 3 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-2.c
index e52e07d..ad2673a 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-2.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param=riscv-autovec-preference=scalable -fno-schedule-insns" } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fno-schedule-insns -ffast-math" } */
#include <stdint-gcc.h>
@@ -26,9 +26,13 @@
TEST_TYPE (int32_t) \
TEST_TYPE (uint32_t) \
TEST_TYPE (int64_t) \
- TEST_TYPE (uint64_t)
+ TEST_TYPE (uint64_t) \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
TEST_ALL ()
/* { dg-final { scan-assembler-times {\tvmacc\.vv} 8 } } */
+/* { dg-final { scan-assembler-times {\tvfmacc\.vv} 3 } } */
/* { dg-final { scan-assembler-not {\tvmv} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-3.c
index 127e701..cd97f4d 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-3.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-3.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param=riscv-autovec-preference=scalable" } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math" } */
#include <stdint-gcc.h>
@@ -26,8 +26,11 @@
TEST_TYPE (int32_t) \
TEST_TYPE (uint32_t) \
TEST_TYPE (int64_t) \
- TEST_TYPE (uint64_t)
+ TEST_TYPE (uint64_t) \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
TEST_ALL ()
-/* { dg-final { scan-assembler-times {\tvmv} 8 } } */
+/* { dg-final { scan-assembler-times {\tvmv} 11 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-4.c
index 1b8b934..a225ea0 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-4.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param=riscv-autovec-preference=scalable" } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math" } */
#include <stdint-gcc.h>
@@ -20,9 +20,13 @@
TEST_TYPE (int32_t) \
TEST_TYPE (uint32_t) \
TEST_TYPE (int64_t) \
- TEST_TYPE (uint64_t)
+ TEST_TYPE (uint64_t) \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
TEST_ALL ()
/* { dg-final { scan-assembler-times {\tvnmsub\.vv} 8 } } */
+/* { dg-final { scan-assembler-times {\tvfnmsub\.vv} 3 } } */
/* { dg-final { scan-assembler-not {\tvmv} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-5.c
index 49c85efb..12dfa0a 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-5.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-5.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param=riscv-autovec-preference=scalable -fno-schedule-insns" } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fno-schedule-insns -ffast-math" } */
#include <stdint-gcc.h>
@@ -26,9 +26,13 @@
TEST_TYPE (int32_t) \
TEST_TYPE (uint32_t) \
TEST_TYPE (int64_t) \
- TEST_TYPE (uint64_t)
+ TEST_TYPE (uint64_t) \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
TEST_ALL ()
/* { dg-final { scan-assembler-times {\tvnmsac\.vv} 8 } } */
+/* { dg-final { scan-assembler-times {\tvfnmsac\.vv} 3 } } */
/* { dg-final { scan-assembler-not {\tvmv} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-6.c
index f38f303..b83590f 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-6.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-6.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d --param=riscv-autovec-preference=scalable" } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math" } */
#include <stdint-gcc.h>
@@ -26,8 +26,11 @@
TEST_TYPE (int32_t) \
TEST_TYPE (uint32_t) \
TEST_TYPE (int64_t) \
- TEST_TYPE (uint64_t)
+ TEST_TYPE (uint64_t) \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
TEST_ALL ()
-/* { dg-final { scan-assembler-times {\tvmv} 8 } } */
+/* { dg-final { scan-assembler-times {\tvmv} 11 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-7.c
new file mode 100644
index 0000000..0f80da4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-7.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include <stdint-gcc.h>
+
+#define TEST_TYPE(TYPE) \
+ __attribute__ ((noipa)) void ternop_##TYPE (TYPE *__restrict dst, \
+ TYPE *__restrict a, \
+ TYPE *__restrict b, int n) \
+ { \
+ for (int i = 0; i < n; i++) \
+ dst[i] = a[i] * b[i] - dst[i]; \
+ }
+
+#define TEST_ALL() \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
+
+TEST_ALL ()
+
+/* { dg-final { scan-assembler-times {\tvfmsub\.vv} 3 } } */
+/* { dg-final { scan-assembler-not {\tvmv} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-8.c
new file mode 100644
index 0000000..ae65298
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-8.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fno-schedule-insns -ffast-math" } */
+
+#include <stdint-gcc.h>
+
+#define TEST_TYPE(TYPE) \
+ __attribute__ ((noipa)) void ternop_##TYPE (TYPE *__restrict dest1, \
+ TYPE *__restrict dest2, \
+ TYPE *__restrict dest3, \
+ TYPE *__restrict src1, \
+ TYPE *__restrict src2, int n) \
+ { \
+ for (int i = 0; i < n; ++i) \
+ { \
+ dest1[i] = src1[i] * src2[i] - dest1[i]; \
+ dest2[i] = src1[i] * dest1[i] - dest2[i]; \
+ dest3[i] = src2[i] * dest2[i] - dest3[i]; \
+ } \
+ }
+
+#define TEST_ALL() \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
+
+TEST_ALL ()
+
+/* { dg-final { scan-assembler-times {\tvfmsac\.vv} 3 } } */
+/* { dg-final { scan-assembler-not {\tvmv} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-9.c
new file mode 100644
index 0000000..299bd2d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop-9.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include <stdint-gcc.h>
+
+#define TEST_TYPE(TYPE) \
+ __attribute__ ((noipa)) void ternop_##TYPE (TYPE *__restrict dest1, \
+ TYPE *__restrict dest2, \
+ TYPE *__restrict dest3, \
+ TYPE *__restrict src1, \
+ TYPE *__restrict src2, int n) \
+ { \
+ for (int i = 0; i < n; ++i) \
+ { \
+ dest1[i] = src1[i] * src2[i] - dest2[i]; \
+ dest2[i] = src1[i] * dest1[i] - dest2[i]; \
+ dest3[i] = src2[i] * dest2[i] - dest3[i]; \
+ } \
+ }
+
+#define TEST_ALL() \
+ TEST_TYPE (_Float16) \
+ TEST_TYPE (float) \
+ TEST_TYPE (double)
+
+TEST_ALL ()
+
+/* { dg-final { scan-assembler-times {\tvmv} 3 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-1.c
index 1f69b69..e0ec9ed 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-1.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-1.c
@@ -1,5 +1,5 @@
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
#include "ternop-1.c"
@@ -80,5 +80,15 @@ int __attribute__ ((optimize (0))) main ()
TEST_LOOP (int64_t, 795)
TEST_LOOP (uint64_t, 795)
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
return 0;
}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-10.c
new file mode 100644
index 0000000..854827f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-10.c
@@ -0,0 +1,40 @@
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-10.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 3 - i; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array1_##NUM, array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ if (array3_##NUM[i] \
+ != (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) - array4_##NUM[i])) \
+ __builtin_abort (); \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-11.c
new file mode 100644
index 0000000..b5a0845
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-11.c
@@ -0,0 +1,60 @@
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-11.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) - array6_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-12.c
new file mode 100644
index 0000000..c7c4b4b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-12.c
@@ -0,0 +1,60 @@
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-12.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) - array7_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-2.c
index 103b98a..ee7c725 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-2.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-2.c
@@ -1,5 +1,5 @@
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
#include "ternop-2.c"
@@ -100,5 +100,15 @@ int __attribute__ ((optimize (0))) main ()
TEST_LOOP (int64_t, 795)
TEST_LOOP (uint64_t, 795)
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
return 0;
}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-3.c
index eac5408..6c4f28e 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-3.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-3.c
@@ -1,5 +1,5 @@
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
#include "ternop-3.c"
@@ -100,5 +100,15 @@ int __attribute__ ((optimize (0))) main ()
TEST_LOOP (int64_t, 795)
TEST_LOOP (uint64_t, 795)
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
return 0;
}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-4.c
index c6f1fe5..44a4771 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-4.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-4.c
@@ -1,5 +1,5 @@
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
#include "ternop-4.c"
@@ -80,5 +80,15 @@ int __attribute__ ((optimize (0))) main ()
TEST_LOOP (int64_t, 795)
TEST_LOOP (uint64_t, 795)
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
return 0;
}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-5.c
index 81af4b6..efe2f36 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-5.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-5.c
@@ -1,5 +1,5 @@
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
#include "ternop-5.c"
@@ -100,5 +100,15 @@ int __attribute__ ((optimize (0))) main ()
TEST_LOOP (int64_t, 795)
TEST_LOOP (uint64_t, 795)
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
return 0;
}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-6.c
index b5e579e..f1ce6a7 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-6.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-6.c
@@ -1,5 +1,5 @@
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
#include "ternop-6.c"
@@ -100,5 +100,15 @@ int __attribute__ ((optimize (0))) main ()
TEST_LOOP (int64_t, 795)
TEST_LOOP (uint64_t, 795)
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
return 0;
}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-7.c
new file mode 100644
index 0000000..1809b23
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-7.c
@@ -0,0 +1,40 @@
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-7.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 3 - i; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array1_##NUM, array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ if (array3_##NUM[i] \
+ != (TYPE) (array1_##NUM[i] * array2_##NUM[i] - array4_##NUM[i])) \
+ __builtin_abort (); \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-8.c
new file mode 100644
index 0000000..f048652
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-8.c
@@ -0,0 +1,60 @@
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-8.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array2_##NUM[i] - array6_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-9.c
new file mode 100644
index 0000000..dcf87f6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run-9.c
@@ -0,0 +1,60 @@
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-9.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array2_##NUM[i] - array7_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (float, 7)
+ TEST_LOOP (double, 7)
+ TEST_LOOP (float, 16)
+ TEST_LOOP (double, 16)
+ TEST_LOOP (float, 77)
+ TEST_LOOP (double, 77)
+ TEST_LOOP (float, 128)
+ TEST_LOOP (double, 128)
+ TEST_LOOP (float, 795)
+ TEST_LOOP (double, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-1.c
new file mode 100644
index 0000000..84fcb68
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-1.c
@@ -0,0 +1,35 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-1.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 3 - i; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array1_##NUM, array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ if (array3_##NUM[i] \
+ != (TYPE) (array1_##NUM[i] * array2_##NUM[i] + array4_##NUM[i])) \
+ __builtin_abort (); \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-10.c
new file mode 100644
index 0000000..d669cd4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-10.c
@@ -0,0 +1,35 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-10.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 3 - i; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array1_##NUM, array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ if (array3_##NUM[i] \
+ != (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) - array4_##NUM[i])) \
+ __builtin_abort (); \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-11.c
new file mode 100644
index 0000000..fac17b6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-11.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-11.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) - array6_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-12.c
new file mode 100644
index 0000000..a51b926
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-12.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-12.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) - array7_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-2.c
new file mode 100644
index 0000000..8fc6a1b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-2.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-2.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array2_##NUM[i] + array6_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] + array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] + array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-3.c
new file mode 100644
index 0000000..3601307
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-3.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-3.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array2_##NUM[i] + array7_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] + array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] + array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-4.c
new file mode 100644
index 0000000..a26bcaa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-4.c
@@ -0,0 +1,35 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-4.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 3 - i; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array1_##NUM, array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ if (array3_##NUM[i] \
+ != (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) + array4_##NUM[i])) \
+ __builtin_abort (); \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-5.c
new file mode 100644
index 0000000..6dee6ba
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-5.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-5.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) + array6_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] + array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] + array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-6.c
new file mode 100644
index 0000000..3fdf2d3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-6.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-6.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) + array7_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] + array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] + array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-7.c
new file mode 100644
index 0000000..a25a6f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-7.c
@@ -0,0 +1,35 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-7.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 3 - i; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array1_##NUM, array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ if (array3_##NUM[i] \
+ != (TYPE) (array1_##NUM[i] * array2_##NUM[i] - array4_##NUM[i])) \
+ __builtin_abort (); \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-8.c
new file mode 100644
index 0000000..1d90bee
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-8.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-8.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array2_##NUM[i] - array6_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-9.c
new file mode 100644
index 0000000..c633f54
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-9.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target { riscv_vector && riscv_zvfh_hw } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
+
+#include "ternop-9.c"
+
+#define TEST_LOOP(TYPE, NUM) \
+ { \
+ TYPE array1_##NUM[NUM] = {}; \
+ TYPE array2_##NUM[NUM] = {}; \
+ TYPE array3_##NUM[NUM] = {}; \
+ TYPE array4_##NUM[NUM] = {}; \
+ TYPE array5_##NUM[NUM] = {}; \
+ TYPE array6_##NUM[NUM] = {}; \
+ TYPE array7_##NUM[NUM] = {}; \
+ TYPE array8_##NUM[NUM] = {}; \
+ for (int i = 0; i < NUM; ++i) \
+ { \
+ array1_##NUM[i] = (i & 1) + 5; \
+ array2_##NUM[i] = i - NUM / 3; \
+ array3_##NUM[i] = NUM - NUM / 3 - i; \
+ array6_##NUM[i] = NUM - NUM / 3 - i; \
+ array4_##NUM[i] = NUM - NUM / 2 + i; \
+ array7_##NUM[i] = NUM - NUM / 2 + i; \
+ array5_##NUM[i] = NUM + i * 7; \
+ array8_##NUM[i] = NUM + i * 7; \
+ asm volatile("" ::: "memory"); \
+ } \
+ ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM, \
+ array2_##NUM, NUM); \
+ for (int i = 0; i < NUM; i++) \
+ { \
+ array6_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array2_##NUM[i] - array7_##NUM[i]); \
+ if (array3_##NUM[i] != array6_##NUM[i]) \
+ __builtin_abort (); \
+ array7_##NUM[i] \
+ = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]); \
+ if (array4_##NUM[i] != array7_##NUM[i]) \
+ __builtin_abort (); \
+ array8_##NUM[i] \
+ = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]); \
+ if (array5_##NUM[i] != array8_##NUM[i]) \
+ __builtin_abort (); \
+ } \
+ }
+
+int __attribute__ ((optimize (0))) main ()
+{
+ TEST_LOOP (_Float16, 7)
+ TEST_LOOP (_Float16, 16)
+ TEST_LOOP (_Float16, 77)
+ TEST_LOOP (_Float16, 128)
+ TEST_LOOP (_Float16, 795)
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-28.c b/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-28.c
deleted file mode 100644
index f36129e..0000000
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-28.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O3 -march=rv32gcv_zvfh -mabi=ilp32d" } */
-
-#include "riscv_vector.h"
-
-void
-f_vfloat16mf4x2_t (void *base, void *out)
-{
- vfloat16mf4x2_t v = *(vfloat16mf4x2_t*)base;
- *(vfloat16mf4x2_t*)out = v;
-}
-
-void
-f_vfloat16mf4x3_t (void *base, void *out)
-{
- vfloat16mf4x3_t v = *(vfloat16mf4x3_t*)base;
- *(vfloat16mf4x3_t*)out = v;
-}
-
-void
-f_vfloat16mf4x4_t (void *base, void *out)
-{
- vfloat16mf4x4_t v = *(vfloat16mf4x4_t*)base;
- *(vfloat16mf4x4_t*)out = v;
-}
-
-void
-f_vfloat16mf4x5_t (void *base, void *out)
-{
- vfloat16mf4x5_t v = *(vfloat16mf4x5_t*)base;
- *(vfloat16mf4x5_t*)out = v;
-}
-
-void
-f_vfloat16mf4x6_t (void *base, void *out)
-{
- vfloat16mf4x6_t v = *(vfloat16mf4x6_t*)base;
- *(vfloat16mf4x6_t*)out = v;
-}
-
-void
-f_vfloat16mf4x7_t (void *base, void *out)
-{
- vfloat16mf4x7_t v = *(vfloat16mf4x7_t*)base;
- *(vfloat16mf4x7_t*)out = v;
-}
-
-void
-f_vfloat16mf4x8_t (void *base, void *out)
-{
- vfloat16mf4x8_t v = *(vfloat16mf4x8_t*)base;
- *(vfloat16mf4x8_t*)out = v;
-}
-
-/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 7 } } */
-/* { dg-final { scan-assembler {srai} } } */
-/* { dg-final { scan-assembler-not {slli} } } */
-/* { dg-final { scan-assembler-times {vle16\.v\tv[0-9]+,0\([a-x0-9]+\)} 35 } } */
-/* { dg-final { scan-assembler-times {vse16\.v\tv[0-9]+,0\([a-x0-9]+\)} 35 } } */ \ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-29.c b/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-29.c
deleted file mode 100644
index c6807c1..0000000
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-29.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O3 -march=rv32gcv_zvfh -mabi=ilp32d" } */
-
-#include "riscv_vector.h"
-
-void
-f_vfloat16mf2x2_t (void *base, void *out)
-{
- vfloat16mf2x2_t v = *(vfloat16mf2x2_t*)base;
- *(vfloat16mf2x2_t*)out = v;
-}
-
-void
-f_vfloat16mf2x3_t (void *base, void *out)
-{
- vfloat16mf2x3_t v = *(vfloat16mf2x3_t*)base;
- *(vfloat16mf2x3_t*)out = v;
-}
-
-void
-f_vfloat16mf2x4_t (void *base, void *out)
-{
- vfloat16mf2x4_t v = *(vfloat16mf2x4_t*)base;
- *(vfloat16mf2x4_t*)out = v;
-}
-
-void
-f_vfloat16mf2x5_t (void *base, void *out)
-{
- vfloat16mf2x5_t v = *(vfloat16mf2x5_t*)base;
- *(vfloat16mf2x5_t*)out = v;
-}
-
-void
-f_vfloat16mf2x6_t (void *base, void *out)
-{
- vfloat16mf2x6_t v = *(vfloat16mf2x6_t*)base;
- *(vfloat16mf2x6_t*)out = v;
-}
-
-void
-f_vfloat16mf2x7_t (void *base, void *out)
-{
- vfloat16mf2x7_t v = *(vfloat16mf2x7_t*)base;
- *(vfloat16mf2x7_t*)out = v;
-}
-
-void
-f_vfloat16mf2x8_t (void *base, void *out)
-{
- vfloat16mf2x8_t v = *(vfloat16mf2x8_t*)base;
- *(vfloat16mf2x8_t*)out = v;
-}
-
-/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 7 } } */
-/* { dg-final { scan-assembler {srai} } } */
-/* { dg-final { scan-assembler-not {slli} } } */
-/* { dg-final { scan-assembler-times {vle16\.v\tv[0-9]+,0\([a-x0-9]+\)} 35 } } */
-/* { dg-final { scan-assembler-times {vse16\.v\tv[0-9]+,0\([a-x0-9]+\)} 35 } } */ \ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-30.c b/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-30.c
deleted file mode 100644
index dd4de3c..0000000
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-30.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O3 -march=rv32gcv_zvfh -mabi=ilp32d" } */
-
-#include "riscv_vector.h"
-
-void
-f_vfloat16m1x2_t (void *base, void *out)
-{
- vfloat16m1x2_t v = *(vfloat16m1x2_t*)base;
- *(vfloat16m1x2_t*)out = v;
-}
-
-void
-f_vfloat16m1x3_t (void *base, void *out)
-{
- vfloat16m1x3_t v = *(vfloat16m1x3_t*)base;
- *(vfloat16m1x3_t*)out = v;
-}
-
-void
-f_vfloat16m1x4_t (void *base, void *out)
-{
- vfloat16m1x4_t v = *(vfloat16m1x4_t*)base;
- *(vfloat16m1x4_t*)out = v;
-}
-
-void
-f_vfloat16m1x5_t (void *base, void *out)
-{
- vfloat16m1x5_t v = *(vfloat16m1x5_t*)base;
- *(vfloat16m1x5_t*)out = v;
-}
-
-void
-f_vfloat16m1x6_t (void *base, void *out)
-{
- vfloat16m1x6_t v = *(vfloat16m1x6_t*)base;
- *(vfloat16m1x6_t*)out = v;
-}
-
-void
-f_vfloat16m1x7_t (void *base, void *out)
-{
- vfloat16m1x7_t v = *(vfloat16m1x7_t*)base;
- *(vfloat16m1x7_t*)out = v;
-}
-
-void
-f_vfloat16m1x8_t (void *base, void *out)
-{
- vfloat16m1x8_t v = *(vfloat16m1x8_t*)base;
- *(vfloat16m1x8_t*)out = v;
-}
-
-/* { dg-final { scan-assembler-not {srai} } } */
-/* { dg-final { scan-assembler-not {slli} } } */
-/* { dg-final { scan-assembler-times {vl1re16\.v\tv[0-9]+,0\([a-x0-9]+\)} 35 } } */
-/* { dg-final { scan-assembler-times {vs1r\.v\tv[0-9]+,0\([a-x0-9]+\)} 35 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-31.c b/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-31.c
deleted file mode 100644
index 48b084e..0000000
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-31.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O3 -march=rv32gcv_zvfh -mabi=ilp32d" } */
-
-#include "riscv_vector.h"
-
-void
-f_vfloat16m2x2_t (void *base, void *out)
-{
- vfloat16m2x2_t v = *(vfloat16m2x2_t*)base;
- *(vfloat16m2x2_t*)out = v;
-}
-
-void
-f_vfloat16m2x3_t (void *base, void *out)
-{
- vfloat16m2x3_t v = *(vfloat16m2x3_t*)base;
- *(vfloat16m2x3_t*)out = v;
-}
-
-void
-f_vfloat16m2x4_t (void *base, void *out)
-{
- vfloat16m2x4_t v = *(vfloat16m2x4_t*)base;
- *(vfloat16m2x4_t*)out = v;
-}
-
-/* { dg-final { scan-assembler-not {srai} } } */
-/* { dg-final { scan-assembler {slli} } } */
-/* { dg-final { scan-assembler-times {vl2re16\.v\tv[0-9]+,0\([a-x0-9]+\)} 9 } } */
-/* { dg-final { scan-assembler-times {vs2r\.v\tv[0-9]+,0\([a-x0-9]+\)} 9 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-32.c b/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-32.c
deleted file mode 100644
index 90693d6..0000000
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple-32.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O3 -march=rv32gcv_zvfh -mabi=ilp32d" } */
-
-#include "riscv_vector.h"
-
-void
-f_vfloat16m4x2_t (void *base, void *out)
-{
- vfloat16m4x2_t v = *(vfloat16m4x2_t*)base;
- *(vfloat16m4x2_t*)out = v;
-}
-
-/* { dg-final { scan-assembler-not {srai} } } */
-/* { dg-final { scan-assembler {slli} } } */
-/* { dg-final { scan-assembler-times {vl4re16\.v\tv[0-9]+,0\([a-x0-9]+\)} 2 } } */
-/* { dg-final { scan-assembler-times {vs4r\.v\tv[0-9]+,0\([a-x0-9]+\)} 2 } } */ \ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-2.c
new file mode 100644
index 0000000..3749d97
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-2.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O0 -Wno-psabi" } */
+
+#include "riscv_vector.h"
+
+void test_vlmul_ext_v_i8mf8_i8mf4(vint8mf8_t op1) {
+ vint8mf4_t res = __riscv_vlmul_ext_v_i8mf8_i8mf4(op1);
+}
diff --git a/gcc/testsuite/gcc.target/s390/larl-1.c b/gcc/testsuite/gcc.target/s390/larl-1.c
new file mode 100644
index 0000000..5ef2ef6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/larl-1.c
@@ -0,0 +1,32 @@
+/* Check if load-address-relative instructions are created */
+
+/* { dg-do compile { target { s390*-*-* } } } */
+/* { dg-options "-O2 -march=z10 -mzarch -fno-section-anchors" } */
+
+/* An explicitely misaligned symbol. This symbol is NOT aligned as
+ mandated by our ABI. However, the back-end needs to handle that in
+ order to make things like __attribute__((packed)) work. The symbol
+ address is expected to be loaded from literal pool. */
+/* { dg-final { scan-assembler "lgrl\t%r2," { target { lp64 } } } } */
+/* { dg-final { scan-assembler "lrl\t%r2," { target { ! lp64 } } } } */
+extern char align1 __attribute__((aligned(1)));
+
+/* { dg-final { scan-assembler "larl\t%r2,align2" } } */
+extern char align2 __attribute__((aligned(2)));
+
+/* { dg-final { scan-assembler "larl\t%r2,align4" } } */
+extern char align4 __attribute__((aligned(4)));
+
+/* An external char symbol without explicit alignment has a DECL_ALIGN
+ of just 8. In contrast to local definitions DATA_ABI_ALIGNMENT is
+ NOT applied to DECL_ALIGN in that case. Make sure the backend
+ still assumes this symbol to be aligned according to ABI
+ requirements. */
+/* { dg-final { scan-assembler "larl\t%r2,align_default" } } */
+extern char align_default;
+
+char * foo1 () { return &align1; }
+char * foo2 () { return &align2; }
+char * foo3 () { return &align4; }
+char * foo4 () { return &align_default; }
+
diff --git a/gcc/testsuite/gdc.dg/pr110359.d b/gcc/testsuite/gdc.dg/pr110359.d
new file mode 100644
index 0000000..bf69201
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr110359.d
@@ -0,0 +1,22 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110359
+// { dg-do compile }
+// { dg-options "-fdump-tree-original" }
+double pow(in double x, in ulong p)
+{
+ import gcc.builtins : __builtin_expect;
+ if (__builtin_expect(p == 0, false))
+ return 1;
+ if (__builtin_expect(p == 1, false))
+ return x;
+
+ double s = x;
+ double v = 1;
+ for (ulong i = p; i > 1; i >>= 1)
+ {
+ v = (i & 0x1) ? s * v : v;
+ s = s * s;
+ }
+ return v * s;
+}
+// { dg-final { scan-tree-dump "if \\(__builtin_expect \\(p == 0, 0\\) != 0\\)" "original" } }
+// { dg-final { scan-tree-dump "if \\(__builtin_expect \\(p == 1, 0\\) != 0\\)" "original" } }
diff --git a/gcc/testsuite/gdc.test/compilable/shared.d b/gcc/testsuite/gdc.test/compilable/shared.d
index 695083a..647910e 100644
--- a/gcc/testsuite/gdc.test/compilable/shared.d
+++ b/gcc/testsuite/gdc.test/compilable/shared.d
@@ -11,34 +11,48 @@ ref shared(int) f(return shared ref int y)
}
// https://issues.dlang.org/show_bug.cgi?id=20908
+struct S
+{
+ int i = 2;
+}
+
+union U
+{
+ int i = 1;
+ bool b;
+}
+
void test20908()
{
- // shared locals (or struct members) should be able to be initialised:
- shared int x;
+ // shared locals (or struct members) should be able to be initialised:
+ shared int x;
- ref shared(int) fun()
- {
- static shared(int) val;
+ ref shared(int) fun()
+ {
+ static shared(int) val;
- // return by reference
- return val;
- }
+ // return by reference
+ return val;
+ }
- ref shared(int) fun2()
- {
- static shared(int)* val;
+ ref shared(int) fun2()
+ {
+ static shared(int)* val;
- // transfer pointer to reference
- return *val;
- }
+ // transfer pointer to reference
+ return *val;
+ }
- ref shared(int) fun3()
- {
- static shared(int)*** val;
+ ref shared(int) fun3()
+ {
+ static shared(int)*** val;
+
+ // Multiple indirections
+ return ***val;
+ }
- // Multiple indirections
- return ***val;
- }
+ shared S s;
+ shared U u;
}
// Simple tests for `DotVarExp`
@@ -130,3 +144,15 @@ void main()
{
auto b = new shared Class();
}
+
+// https://issues.dlang.org/show_bug.cgi?id=23790
+bool cas(shared bool*, bool, bool) { return true; }
+
+struct Argh
+{
+ bool locked;
+ void lock() shared
+ {
+ while(!cas(&locked, false, true)) {}
+ }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test22739.d b/gcc/testsuite/gdc.test/compilable/test22739.d
new file mode 100644
index 0000000..6aeb5d6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test22739.d
@@ -0,0 +1,10 @@
+// https://issues.dlang.org/show_bug.cgi?id=22739
+
+extern(C++) auto f(T)()
+{
+ return T.init;
+}
+void main()
+{
+ f!int;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test23799.d b/gcc/testsuite/gdc.test/compilable/test23799.d
new file mode 100644
index 0000000..0073516
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test23799.d
@@ -0,0 +1,37 @@
+// https://issues.dlang.org/show_bug.cgi?id=23799
+
+// REQUIRED_ARGS: -betterC
+
+struct Data
+{
+ Data[] range;
+ string test;
+}
+
+Data[] foo()
+{
+ Data[] ret;
+ if (__ctfe)
+ {
+ Data tmp;
+ tmp.range ~= Data.init;
+ ret ~= tmp;
+ }
+ return ret;
+}
+
+void func(Data dat)()
+{
+}
+
+void bar(Data dat)()
+{
+ if (dat.test.length)
+ func!(dat.range[0])();
+}
+
+extern (C) void main()
+{
+ static immutable data = foo();
+ bar!(data[0])();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug9631.d b/gcc/testsuite/gdc.test/fail_compilation/bug9631.d
index f456454..c980d76 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/bug9631.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/bug9631.d
@@ -4,7 +4,7 @@ TEST_OUTPUT:
fail_compilation/bug9631.d(20): Error: cannot implicitly convert expression `F()` of type `bug9631.T1!().F` to `bug9631.T2!().F`
---
*/
-
+// DISABLED: win32
template T1()
{
struct F { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/cerrors.d b/gcc/testsuite/gdc.test/fail_compilation/cerrors.d
index 3d69d41..db306c1 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/cerrors.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/cerrors.d
@@ -1,10 +1,12 @@
/* REQUIRED_ARGS: -wi
TEST_OUTPUT:
---
-fail_compilation/cerrors.d(11): Error: C preprocessor directive `#if` is not supported, use `version` or `static if`
-fail_compilation/cerrors.d(11): Error: declaration expected, not `#`
-fail_compilation/cerrors.d(15): Warning: C preprocessor directive `#endif` is not supported
-fail_compilation/cerrors.d(15): Error: declaration expected, not `#`
+fail_compilation/cerrors.d(13): Error: C preprocessor directive `#if` is not supported, use `version` or `static if`
+fail_compilation/cerrors.d(13): Error: declaration expected, not `#`
+fail_compilation/cerrors.d(17): Error: C preprocessor directive `#endif` is not supported
+fail_compilation/cerrors.d(17): Error: declaration expected, not `#`
+fail_compilation/cerrors.d(21): Error: token string requires valid D tokens, not `#if`
+fail_compilation/cerrors.d(22): Deprecation: token string requires valid D tokens, not `#include`
---
*/
@@ -13,3 +15,9 @@ fail_compilation/cerrors.d(15): Error: declaration expected, not `#`
void test(wchar_t u);
#endif
+
+// https://issues.dlang.org/show_bug.cgi?id=23792
+enum s1 = q{
+#if 1
+#include <test>
+};
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17646.d b/gcc/testsuite/gdc.test/fail_compilation/fail17646.d
index 39e7cb9..2074b47 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail17646.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17646.d
@@ -4,7 +4,7 @@ EXTRA_FILES: imports/fail17646.d
TEST_OUTPUT:
---
fail_compilation/imports/fail17646.d(10): Error: found `}` instead of statement
-fail_compilation/fail17646.d(11): Error: function `fail17646.runTests!"".runTests` has no `return` statement, but is expected to return a value of type `int`
+fail_compilation/fail17646.d(15): Error: template instance `allTestData!Modules` template `allTestData` is not defined
fail_compilation/fail17646.d(18): Error: template instance `fail17646.runTests!""` error instantiating
---
*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19948.d b/gcc/testsuite/gdc.test/fail_compilation/fail19948.d
index 6122e41..e8a9e77 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail19948.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail19948.d
@@ -7,7 +7,7 @@ fail_compilation/fail19948.d(15): Error: function `fail19948.func(const(X))` is
fail_compilation/fail19948.d(15): cannot pass argument `X()` of type `fail19948.main.X` to parameter `const(fail19948.X)`
---
*/
-
+// DISABLED: win32
struct X {}
void main()
{
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22857.d b/gcc/testsuite/gdc.test/fail_compilation/fail22857.d
new file mode 100644
index 0000000..061eb62
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail22857.d
@@ -0,0 +1,18 @@
+// https://issues.dlang.org/show_bug.cgi?id=22857
+// EXTRA_FILES: imports/import22857.d
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/import22857.d(4): Error: (expression) expected following `static if`
+fail_compilation/imports/import22857.d(4): Error: declaration expected, not `}`
+fail_compilation/fail22857.d(17): Error: template instance `unaryFun!()` template `unaryFun` is not defined
+---
+*/
+
+void isPrettyPropertyName()
+{
+ import imports.import22857;
+
+ unaryFun!();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail23816.d b/gcc/testsuite/gdc.test/fail_compilation/fail23816.d
new file mode 100644
index 0000000..574a712
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail23816.d
@@ -0,0 +1,16 @@
+// https://issues.dlang.org/show_bug.cgi?id=23816
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail23816.d(14): Error: opcode expected, not `NOP`
+---
+*/
+
+void main()
+{
+ asm
+ {
+ NOP;
+ }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/import22857.d b/gcc/testsuite/gdc.test/fail_compilation/imports/import22857.d
new file mode 100644
index 0000000..280c2eb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/import22857.d
@@ -0,0 +1,4 @@
+template unaryFun()
+{
+ static if
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/shared.d b/gcc/testsuite/gdc.test/fail_compilation/shared.d
index afdea64..8b94a79 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/shared.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/shared.d
@@ -259,3 +259,22 @@ void test_casting_safe() @safe
auto x1 = cast(int*)s;
auto x2 = cast(const(shared(int*)))s;
}
+
+#line 3100
+
+// https://issues.dlang.org/show_bug.cgi?id=23783
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/shared.d(3114): Error: direct access to shared `x` is not allowed, see `core.atomic`
+fail_compilation/shared.d(3115): Error: direct access to shared `x` is not allowed, see `core.atomic`
+---
+*/
+
+void test23783()
+{
+ shared int x = 3;
+ assert(x == 3);
+ bool b = x == 3;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21164.d b/gcc/testsuite/gdc.test/fail_compilation/test21164.d
index f42c4bc..a120024 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/test21164.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/test21164.d
@@ -3,7 +3,8 @@ TEST_OUTPUT:
---
fail_compilation/imports/test21164d.d(3): Error: (expression) expected following `static if`
fail_compilation/imports/test21164d.d(3): Error: found `}` instead of statement
-fail_compilation/test21164.d(11): Error: template instance `test21164a.D!(R!(O(), 1))` error instantiating
+fail_compilation/imports/test21164a.d(5): Error: undefined identifier `I`
+fail_compilation/test21164.d(12): Error: template instance `test21164a.D!(R!(O(), 1))` error instantiating
---
*/
import imports.test21164a;
diff --git a/gcc/testsuite/gdc.test/runnable/complex3.d b/gcc/testsuite/gdc.test/runnable/complex3.d
new file mode 100644
index 0000000..7167b0b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/complex3.d
@@ -0,0 +1,31 @@
+// https://issues.dlang.org/show_bug.cgi?id=23778
+
+
+enum __c_long_double : double;
+
+alias __c_long_double c_long_double;
+
+struct _Complex
+{
+ c_long_double re;
+ c_long_double im;
+}
+
+version (all) // bug to test
+{
+ enum __c_complex_real : _Complex;
+ alias c_complex_real = __c_complex_real;
+}
+else // works
+ enum c_complex_real : _Complex;
+
+c_complex_real toNative2(real re, real im)
+{
+ return c_complex_real(re, im);
+}
+
+void main()
+{
+ c_complex_real n = toNative2(123, 456);
+ assert(123 == n.re && 456 == n.im);
+}
diff --git a/gcc/testsuite/gfortran.dg/value_9.f90 b/gcc/testsuite/gfortran.dg/value_9.f90
new file mode 100644
index 0000000..f649064
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/value_9.f90
@@ -0,0 +1,78 @@
+! { dg-do run }
+! PR fortran/110360 - ABI for scalar character(len=1),value dummy argument
+
+program p
+ implicit none
+ character, allocatable :: ca
+ character, pointer :: cp
+ character(len=:), allocatable :: cd
+ character (kind=4), allocatable :: ca4
+ character (kind=4), pointer :: cp4
+ character(len=:,kind=4), allocatable :: cd4
+ integer :: a = 65
+ allocate (ca, cp, ca4, cp4)
+
+ ! Check len=1 actual argument cases first
+ ca = "a"; cp = "b"; cd = "c"
+ ca4 = 4_"d"; cp4 = 4_"e"; cd4 = 4_"f"
+ call val ("B","B")
+ call val ("A",char(65))
+ call val ("A",char(a))
+ call val ("A",mychar(65))
+ call val ("A",mychar(a))
+ call val4 (4_"C",4_"C")
+ call val4 (4_"A",char(65,kind=4))
+ call val4 (4_"A",char(a, kind=4))
+ call val (ca,ca)
+ call val (cp,cp)
+ call val (cd,cd)
+ call val4 (ca4,ca4)
+ call val4 (cp4,cp4)
+ call val4 (cd4,cd4)
+ call sub ("S")
+ call sub4 (4_"T")
+
+ ! Check that always the first character of the string is finally used
+ call val ( "U++", "U--")
+ call val4 (4_"V**",4_"V//")
+ call sub ( "WTY")
+ call sub4 (4_"ZXV")
+ cd = "gkl"; cd4 = 4_"hmn"
+ call val (cd,cd)
+ call val4 (cd4,cd4)
+ call sub (cd)
+ call sub4 (cd4)
+ deallocate (ca, cp, ca4, cp4, cd, cd4)
+contains
+ subroutine val (x, c)
+ character(kind=1), intent(in) :: x ! control: pass by reference
+ character(kind=1), value :: c
+ print *, "by value(kind=1): ", c
+ if (c /= x) stop 1
+ c = "*"
+ if (c /= "*") stop 2
+ end
+
+ subroutine val4 (x, c)
+ character(kind=4), intent(in) :: x ! control: pass by reference
+ character(kind=4), value :: c
+ print *, "by value(kind=4): ", c
+ if (c /= x) stop 3
+ c = 4_"#"
+ if (c /= 4_"#") stop 4
+ end
+
+ subroutine sub (s)
+ character(*), intent(in) :: s
+ call val (s, s)
+ end
+ subroutine sub4 (s)
+ character(kind=4,len=*), intent(in) :: s
+ call val4 (s, s)
+ end
+
+ character function mychar (i)
+ integer, intent(in) :: i
+ mychar = char (i)
+ end
+end
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 01c8c02..28529f5 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -364,6 +364,11 @@ proc gcc-dg-prune { system text } {
# Always remember to clear it in .exp file after executed all tests.
global dg_runtest_extra_prunes
+ # Call into multiline.exp to handle any multiline output directives.
+ # This is done before the check for blank lines so that multiline
+ # output directives can have blank lines within them.
+ set text [handle-multiline-outputs $text]
+
# Complain about blank lines in the output (PR other/69006)
global allow_blank_lines
if { !$allow_blank_lines } {
diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp
index 73621a0..4c25bb7 100644
--- a/gcc/testsuite/lib/multiline.exp
+++ b/gcc/testsuite/lib/multiline.exp
@@ -139,7 +139,7 @@ proc dg-end-multiline-output { args } {
verbose "within dg-end-multiline-output: multiline_expected_outputs: $multiline_expected_outputs" 3
}
-# Hook to be called by prune.exp's prune_gcc_output to
+# Hook to be called by gcc-dg.exp's gcc-dg-prune to
# look for the expected multiline outputs, pruning them,
# reporting PASS for those that are found, and FAIL for
# those that weren't found.
@@ -149,6 +149,11 @@ proc dg-end-multiline-output { args } {
proc handle-multiline-outputs { text } {
global multiline_expected_outputs
global testname_with_flags
+
+ # If dg-enable-nn-line-numbers was provided, then obscure source-margin
+ # line numbers by converting them to "NN" form.
+ set text [maybe-handle-nn-line-numbers $text]
+
set index 0
foreach entry $multiline_expected_outputs {
verbose " entry: $entry" 3
diff --git a/gcc/testsuite/lib/prune.exp b/gcc/testsuite/lib/prune.exp
index cfe427c..8d37b24 100644
--- a/gcc/testsuite/lib/prune.exp
+++ b/gcc/testsuite/lib/prune.exp
@@ -108,13 +108,6 @@ proc prune_gcc_output { text } {
# Many tests that use visibility will still pass on platforms that don't support it.
regsub -all "(^|\n)\[^\n\]*lto1: warning: visibility attribute not supported in this configuration; ignored\[^\n\]*" $text "" text
- # If dg-enable-nn-line-numbers was provided, then obscure source-margin
- # line numbers by converting them to "NN" form.
- set text [maybe-handle-nn-line-numbers $text]
-
- # Call into multiline.exp to handle any multiline output directives.
- set text [handle-multiline-outputs $text]
-
#send_user "After:$text\n"
return $text
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index d79ad4b..c04db2b 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -10785,7 +10785,35 @@ proc check_effective_target_c++23_only { } {
return 0
}
proc check_effective_target_c++23 { } {
- return [check_effective_target_c++23_only]
+ if [check_effective_target_c++23_only] {
+ return 1
+ }
+ return [check_effective_target_c++26]
+}
+
+proc check_effective_target_c++23_down { } {
+ if ![check_effective_target_c++] {
+ return 0
+ }
+ return [expr ![check_effective_target_c++26] ]
+}
+
+proc check_effective_target_c++26_only { } {
+ global cxx_default
+ if ![check_effective_target_c++] {
+ return 0
+ }
+ if [check-flags { { } { } { -std=c++26 -std=gnu++26 -std=c++2c -std=gnu++2c } }] {
+ return 1
+ }
+ if { $cxx_default == "c++26" && [check-flags { { } { } { } { -std=* } }] } {
+ return 1
+ }
+ return 0
+}
+
+proc check_effective_target_c++26 { } {
+ return [check_effective_target_c++26_only]
}
# Check for C++ Concepts support, i.e. -fconcepts flag.
diff --git a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h
index 189af80..62556f9 100644
--- a/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h
+++ b/gcc/testsuite/objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h
@@ -29,6 +29,9 @@
#ifndef __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE
#define __NSObjCRuntime_h_GNUSTEP_BASE_INCLUDE
+/* Allow the elaborated enum use in _GS_NAMED_ENUM. */
+#pragma GCC system_header
+
#ifdef __cplusplus
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1