diff --git a/.github/workflows/virtual.yml b/.github/workflows/virtual.yml
index 104a75446..c5778f412 100644
--- a/.github/workflows/virtual.yml
+++ b/.github/workflows/virtual.yml
@@ -15,7 +15,7 @@ jobs:
fetch-depth: 0
- name: Run script
shell: bash
- run: ./scripts/test.sh
+ run: ./scripts/test.sh -d
ubuntu:
name: Ubuntu 20.04
@@ -26,7 +26,7 @@ jobs:
with:
fetch-depth: 0
- name: Run script
- run: ./scripts/test.sh
+ run: ./scripts/test.sh -d
macos:
name: macOS Big Sur 11
@@ -39,4 +39,4 @@ jobs:
- name: Set up environment
run: brew install coreutils
- name: Run script
- run: ./scripts/test.sh
+ run: ./scripts/test.sh -d
diff --git a/tests/codegen/executable/gcc/20000314-1.c b/tests/codegen/executable/gcc/20000314-1.c
new file mode 100644
index 000000000..26c13a7d6
--- /dev/null
+++ b/tests/codegen/executable/gcc/20000314-1.c
@@ -0,0 +1,11 @@
+struct {
+ char a[5];
+} *p;
+
+int main ()
+{
+ int i = -1;
+
+ if(p->a[-i])
+ return 1;
+}
diff --git a/tests/codegen/executable/gcc/20031214-1.c b/tests/codegen/executable/gcc/20031214-1.c
new file mode 100644
index 000000000..e52200c01
--- /dev/null
+++ b/tests/codegen/executable/gcc/20031214-1.c
@@ -0,0 +1,32 @@
+/* PR optimization/10312 */
+/* Originator: Peter van Hoof
*/
+
+/* Verify that the strength reduction pass doesn't find
+ illegitimate givs. */
+
+struct
+{
+ double a;
+ int n[2];
+} g = { 0., { 1, 2}};
+
+int k = 0;
+
+void
+b (int *j)
+{
+}
+
+int
+main ()
+{
+ int j;
+
+ for (j = 0; j < 2; j++)
+ k = (k > g.n[j]) ? k : g.n[j];
+
+ k++;
+ b (&j);
+
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/20040813-1.c b/tests/codegen/executable/gcc/20040813-1.c
new file mode 100644
index 000000000..9cf664dd7
--- /dev/null
+++ b/tests/codegen/executable/gcc/20040813-1.c
@@ -0,0 +1,14 @@
+/* Test lang in N_SO stab. */
+/* Contributed by Devang Patel */
+
+/* { dg-do compile { target stabs } } */
+/* { dg-options "-gstabs" } */
+
+int
+main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler ".stabs.*100,0,2" } } */
+
diff --git a/tests/codegen/executable/gcc/20090729_1.c b/tests/codegen/executable/gcc/20090729_1.c
new file mode 100644
index 000000000..0a5091ac2
--- /dev/null
+++ b/tests/codegen/executable/gcc/20090729_1.c
@@ -0,0 +1,4 @@
+double j;
+int i;
+int main () { return i; }
+
diff --git a/tests/codegen/executable/gcc/20090914-1_0.c b/tests/codegen/executable/gcc/20090914-1_0.c
new file mode 100644
index 000000000..ef9f7b351
--- /dev/null
+++ b/tests/codegen/executable/gcc/20090914-1_0.c
@@ -0,0 +1,13 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-flto -g -fvar-tracking-assignments}} } */
+/* { dg-suppress-ld-options "-g -fvar-tracking-assignments" } */
+
+void foo()
+{
+ int hex = 0x4;
+}
+
+int main()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/20100722-1_0.c b/tests/codegen/executable/gcc/20100722-1_0.c
new file mode 100644
index 000000000..275a03c25
--- /dev/null
+++ b/tests/codegen/executable/gcc/20100722-1_0.c
@@ -0,0 +1,6 @@
+/* { dg-lto-do run } */
+/* { dg-require-linker-plugin "" } */
+/* { dg-extra-ld-options "-fuse-linker-plugin" } */
+
+int main() { return 0; }
+
diff --git a/tests/codegen/executable/gcc/20101009-2_0.c b/tests/codegen/executable/gcc/20101009-2_0.c
new file mode 100644
index 000000000..249d0e079
--- /dev/null
+++ b/tests/codegen/executable/gcc/20101009-2_0.c
@@ -0,0 +1,3 @@
+/* { dg-lto-do link } */
+
+int main() { return 0; }
diff --git a/tests/codegen/executable/gcc/960218-1.c b/tests/codegen/executable/gcc/960218-1.c
new file mode 100644
index 000000000..46fbf7785
--- /dev/null
+++ b/tests/codegen/executable/gcc/960218-1.c
@@ -0,0 +1,2 @@
+#define X(x) x
+int main() { return X(0/* *//* */); }
diff --git a/tests/codegen/executable/gcc/bounds-3.c b/tests/codegen/executable/gcc/bounds-3.c
new file mode 100644
index 000000000..c9d896d19
--- /dev/null
+++ b/tests/codegen/executable/gcc/bounds-3.c
@@ -0,0 +1,23 @@
+/* PR sanitizer/70875 */
+/* { dg-do run } */
+/* { dg-options "-fsanitize=bounds -fno-sanitize-recover=bounds" } */
+/* { dg-shouldfail "ubsan" } */
+
+int
+foo (int n, int k)
+{
+ struct S
+ {
+ int i[n];
+ int value;
+ } s[2];
+ return s[k].value = 0;
+}
+
+int
+main ()
+{
+ return foo (2, 2);
+}
+
+/* { dg-output "index 2 out of bounds for type 'S \\\[2\\\]'" } */
diff --git a/tests/codegen/executable/gcc/call386.c b/tests/codegen/executable/gcc/call386.c
new file mode 100644
index 000000000..c82a3be34
--- /dev/null
+++ b/tests/codegen/executable/gcc/call386.c
@@ -0,0 +1,20 @@
+void foo () {}
+
+int main ()
+{
+ int i;
+ for (i = 100000; i >= 0; i--)
+ {
+ foo ();
+ foo ();
+ foo ();
+ foo ();
+ foo ();
+ foo ();
+ foo ();
+ foo ();
+ foo ();
+ foo ();
+ }
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/crossmodule-indir-call-topn-1a.c b/tests/codegen/executable/gcc/crossmodule-indir-call-topn-1a.c
new file mode 100644
index 000000000..a8c6e365f
--- /dev/null
+++ b/tests/codegen/executable/gcc/crossmodule-indir-call-topn-1a.c
@@ -0,0 +1,22 @@
+/* It seems there is no way to avoid the other source of mulitple
+ source testcase from being compiled independently. Just avoid
+ error. */
+#ifdef DOJOB
+int
+one (int a)
+{
+ return 1;
+}
+
+int
+two (int a)
+{
+ return 0;
+}
+#else
+int
+main()
+{
+ return 0;
+}
+#endif
diff --git a/tests/codegen/executable/gcc/darwin-20040809-2.c b/tests/codegen/executable/gcc/darwin-20040809-2.c
new file mode 100644
index 000000000..98d571276
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-20040809-2.c
@@ -0,0 +1,15 @@
+/* Test dead code strip support. */
+/* Contributed by Devang Patel */
+
+/* { dg-do compile { target { *-*-darwin* && stabs } } } */
+/* { dg-options "-gstabs+ -fno-eliminate-unused-debug-symbols" } */
+
+int
+main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler ".stabd.46,0,0" } } */
+/* { dg-final { scan-assembler ".stabd.78,0,0" } } */
+
diff --git a/tests/codegen/executable/gcc/darwin-ld-1.c b/tests/codegen/executable/gcc/darwin-ld-1.c
new file mode 100644
index 000000000..60761577e
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-ld-1.c
@@ -0,0 +1,11 @@
+/* Test Darwin linker option -all_load. */
+/* Developed by Devang Patel . */
+
+/* { dg-options "-all_load" } */
+/* { dg-do link { target *-*-darwin* } } */
+
+int main()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/darwin-ld-2.c b/tests/codegen/executable/gcc/darwin-ld-2.c
new file mode 100644
index 000000000..5de19524f
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-ld-2.c
@@ -0,0 +1,11 @@
+/* Test Darwin linker option -bind_at_load. */
+/* Developed by Devang Patel . */
+
+/* { dg-options "-bind_at_load" } */
+/* { dg-do link { target *-*-darwin* } } */
+
+int main()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/darwin-ld-20040809-1.c b/tests/codegen/executable/gcc/darwin-ld-20040809-1.c
new file mode 100644
index 000000000..c54a4aa0c
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-ld-20040809-1.c
@@ -0,0 +1,13 @@
+/* Test -dead_strip support. */
+/* Contributed by Devang Patel */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-dead_strip" } */
+
+
+int
+main ()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/darwin-ld-20040809-2.c b/tests/codegen/executable/gcc/darwin-ld-20040809-2.c
new file mode 100644
index 000000000..73d788db0
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-ld-20040809-2.c
@@ -0,0 +1,12 @@
+/* Test -no_dead_strip_inits_and_terms support. */
+/* Contributed by Devang Patel */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-no_dead_strip_inits_and_terms" } */
+
+int
+main ()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/darwin-ld-20040828-1.c b/tests/codegen/executable/gcc/darwin-ld-20040828-1.c
new file mode 100644
index 000000000..b90328be9
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-ld-20040828-1.c
@@ -0,0 +1,13 @@
+/* Test -segaddr. */
+/* Contributed by Devang Patel */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-segaddr __DATA 4000" } */
+
+
+int
+main ()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/darwin-ld-20040828-2.c b/tests/codegen/executable/gcc/darwin-ld-20040828-2.c
new file mode 100644
index 000000000..51f5ae830
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-ld-20040828-2.c
@@ -0,0 +1,13 @@
+/* Test -segs_read_only_addr. */
+/* Contributed by Devang Patel */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-segs_read_only_addr 4000 -dynamiclib" } */
+
+
+int
+main ()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/darwin-ld-20040828-3.c b/tests/codegen/executable/gcc/darwin-ld-20040828-3.c
new file mode 100644
index 000000000..ca8928bd8
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-ld-20040828-3.c
@@ -0,0 +1,13 @@
+/* Test -segs_read_write_addr. */
+/* Contributed by Devang Patel */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-segs_read_only_addr 4000 -segs_read_write_addr 8000 -dynamiclib" } */
+
+
+int
+main ()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/darwin-ld-3.c b/tests/codegen/executable/gcc/darwin-ld-3.c
new file mode 100644
index 000000000..e3efacaba
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-ld-3.c
@@ -0,0 +1,12 @@
+
+/* Test Darwin linker option -arch_errors_fatal. */
+/* Developed by Devang Patel . */
+
+/* { dg-options "-arch_errors_fatal" } */
+/* { dg-do link { target *-*-darwin* } } */
+
+int main()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/darwin-ld-4.c b/tests/codegen/executable/gcc/darwin-ld-4.c
new file mode 100644
index 000000000..5cac36ccf
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-ld-4.c
@@ -0,0 +1,11 @@
+/* Test Darwin linker option -bundle. */
+/* Developed by Devang Patel . */
+
+/* { dg-options "-bundle" } */
+/* { dg-do link { target *-*-darwin* } } */
+
+int main()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/darwin-ld-5.c b/tests/codegen/executable/gcc/darwin-ld-5.c
new file mode 100644
index 000000000..0540f92bc
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-ld-5.c
@@ -0,0 +1,11 @@
+/* Test Darwin linker option -dynamic. */
+/* Developed by Devang Patel . */
+
+/* { dg-options "-dynamic" } */
+/* { dg-do link { target *-*-darwin* } } */
+
+int main()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/darwin-version-1.c b/tests/codegen/executable/gcc/darwin-version-1.c
new file mode 100644
index 000000000..2ca34c6c0
--- /dev/null
+++ b/tests/codegen/executable/gcc/darwin-version-1.c
@@ -0,0 +1,16 @@
+/* Basic test of the -mmacosx-version-min option. */
+
+/* Darwin4 corresponds to MacOS 10.0. */
+/* { dg-options "-mmacosx-version-min=10.1" { target *-*-darwin[456789]* } } */
+/* Later Darwin linkers decline to link for less than Darwin8/MacOS 10.4.
+ However, we need to make the link for 10.6 because the relevant libgcc_s
+ shim files for 10.4 and 10.5 are also not installed in later SDKs. */
+/* { dg-options "-mmacosx-version-min=10.6" { target *-*-darwin1[01234567]* } } */
+/* From XCode 11.4 on 10.14/15 10.6 and 10.7 are also deprecated. */
+/* { dg-options "-mmacosx-version-min=10.8" { target *-*-darwin1[89]* } } */
+/* { dg-do link { target *-*-darwin* } } */
+
+int main()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/dev-specific-rmw.c b/tests/codegen/executable/gcc/dev-specific-rmw.c
new file mode 100644
index 000000000..0a8393e49
--- /dev/null
+++ b/tests/codegen/executable/gcc/dev-specific-rmw.c
@@ -0,0 +1,13 @@
+/* Verify that rmw instructions supported */
+/* { dg-do assemble } */
+
+int main()
+{
+ #ifdef __AVR_ISA_RMW__
+ __asm("xch Z, r12");
+ __asm("las Z, r12");
+ __asm("lac Z, r12");
+ __asm("lat Z, r12");
+ #endif
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/devnull-dump.c b/tests/codegen/executable/gcc/devnull-dump.c
new file mode 100644
index 000000000..378e0901c
--- /dev/null
+++ b/tests/codegen/executable/gcc/devnull-dump.c
@@ -0,0 +1,7 @@
+/* { dg-do assemble } */
+/* { dg-options "-fdump-ipa-clones -o /dev/null" } */
+
+int main()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/dg-bogus-exp-P.c b/tests/codegen/executable/gcc/dg-bogus-exp-P.c
new file mode 100644
index 000000000..003264a72
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-bogus-exp-P.c
@@ -0,0 +1,8 @@
+/* Test the tester; previously part of gcc.misc-tests/dg-9.c. */
+/* { dg-prms-id 42 } */
+/* { dg-options "-Wall" } */
+
+int main (int argc, char *argv[])
+{
+ return 0; /* { dg-bogus "foobar" "bogus fail test" } */
+}
diff --git a/tests/codegen/executable/gcc/dg-do-run-sf-exp-F.c b/tests/codegen/executable/gcc/dg-do-run-sf-exp-F.c
new file mode 100644
index 000000000..076c14c52
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-do-run-sf-exp-F.c
@@ -0,0 +1,8 @@
+/* { dg-do run } */
+/* { dg-shouldfail "required comment" } */
+
+int
+main ()
+{
+ return 0; /* We expect nonzero, so this fails. */
+}
diff --git a/tests/codegen/executable/gcc/dg-do-run-xrif-nocache-exp-XF.c b/tests/codegen/executable/gcc/dg-do-run-xrif-nocache-exp-XF.c
new file mode 100644
index 000000000..b3d17ee59
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-do-run-xrif-nocache-exp-XF.c
@@ -0,0 +1,9 @@
+/* { dg-do run } */
+/* { dg-options "-DDEFINED" } */
+/* { dg-xfail-run-if "comment" { def_nocache } } */
+
+int
+main ()
+{
+ return 1;
+}
diff --git a/tests/codegen/executable/gcc/dg-dot-run-sif-exp-P.c b/tests/codegen/executable/gcc/dg-dot-run-sif-exp-P.c
new file mode 100644
index 000000000..23893d3cb
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-dot-run-sif-exp-P.c
@@ -0,0 +1,8 @@
+/* { dg-do run { target { *-*-* && yes } } } */
+/* { dg-skip-if "comment" { no && yes } } */
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/dg-dot-run-sif-exp-U.c b/tests/codegen/executable/gcc/dg-dot-run-sif-exp-U.c
new file mode 100644
index 000000000..a7c1aa123
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-dot-run-sif-exp-U.c
@@ -0,0 +1,8 @@
+/* { dg-do run { target { *-*-* || no } } } */
+/* { dg-skip-if "comment" { *-*-* && yes } } */
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/dg-dot-run-xif-exp-P.c b/tests/codegen/executable/gcc/dg-dot-run-xif-exp-P.c
new file mode 100644
index 000000000..1c2da0957
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-dot-run-xif-exp-P.c
@@ -0,0 +1,8 @@
+/* { dg-do run { target { *-*-* && yes } } } */
+/* { dg-xfail-if "comment" { empty-*-* && yes } } */
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/dg-dot-run-xif-exp-XP.c b/tests/codegen/executable/gcc/dg-dot-run-xif-exp-XP.c
new file mode 100644
index 000000000..e508c698e
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-dot-run-xif-exp-XP.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target { *-*-* empty-*-* } } } */
+/* { dg-xfail-if "comment" { *-*-* && yes } } */
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/dg-dox-run-sf-exp-XF.c b/tests/codegen/executable/gcc/dg-dox-run-sf-exp-XF.c
new file mode 100644
index 000000000..e5eae7775
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-dox-run-sf-exp-XF.c
@@ -0,0 +1,8 @@
+/* { dg-do run { xfail *-*-* } } */
+/* { dg-shouldfail "required comment" } */
+
+int
+main ()
+{
+ return 0; /* We want nonzero but expect to fail; XFAIL. */
+}
diff --git a/tests/codegen/executable/gcc/dg-excess-errors-exp-XP.c b/tests/codegen/executable/gcc/dg-excess-errors-exp-XP.c
new file mode 100644
index 000000000..4aecca3ba
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-excess-errors-exp-XP.c
@@ -0,0 +1,9 @@
+/* Test the tester. */
+/* { dg-prms-id 42 } */
+/* { dg-options "-Wall" } */
+/* { dg-do compile } */
+/* { dg-excess-errors "excess errors" } */
+
+/* No messages, so unexpected pass. */
+
+int main () { return 0; }
diff --git a/tests/codegen/executable/gcc/dg-nocache-sif-exp-P.c b/tests/codegen/executable/gcc/dg-nocache-sif-exp-P.c
new file mode 100644
index 000000000..c44532b02
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-nocache-sif-exp-P.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-DNOT_THE_RIGHT_DEFINE" } */
+/* { dg-skip-if "comment" { def_nocache } } */
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/dg-nocache-sif-exp-U.c b/tests/codegen/executable/gcc/dg-nocache-sif-exp-U.c
new file mode 100644
index 000000000..ab1a0acab
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-nocache-sif-exp-U.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-DDEFINED" } */
+/* { dg-skip-if "comment" { def_nocache } } */
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/dg-nocache-xif-exp-P.c b/tests/codegen/executable/gcc/dg-nocache-xif-exp-P.c
new file mode 100644
index 000000000..6481958c9
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-nocache-xif-exp-P.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-DNOT_THE_RIGHT_DEFINE" } */
+/* { dg-xfail-if "comment" { def_nocache } } */
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/dg-nocache-xif-exp-XP.c b/tests/codegen/executable/gcc/dg-nocache-xif-exp-XP.c
new file mode 100644
index 000000000..853a78547
--- /dev/null
+++ b/tests/codegen/executable/gcc/dg-nocache-xif-exp-XP.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-DDEFINED" } */
+/* { dg-xfail-if "comment" { def_nocache } } */
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/dir-only-9.c b/tests/codegen/executable/gcc/dir-only-9.c
new file mode 100644
index 000000000..d11cd97cb
--- /dev/null
+++ b/tests/codegen/executable/gcc/dir-only-9.c
@@ -0,0 +1,13 @@
+/* PR preprocessor/103130 */
+/* { dg-do preprocess } */
+/* { dg-options -fdirectives-only } */
+
+/*\
+ * this is a comment
+\*/
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/divbyzero.c b/tests/codegen/executable/gcc/divbyzero.c
new file mode 100644
index 000000000..607aa12d5
--- /dev/null
+++ b/tests/codegen/executable/gcc/divbyzero.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2001 Free Software Foundation, Inc. */
+
+/* { dg-do compile } */
+
+/* Source: Neil Booth, Oct 22 2001. PR 150 - warn about division by
+ zero. */
+
+#define ZERO (4 - 6 + 2)
+
+int main (int argc, char *argv[])
+{
+ int w = argc % ZERO; /* { dg-warning "division by zero" } */
+ int x = argc / 0; /* { dg-warning "division by zero" } */
+ int y = argc / ZERO; /* { dg-warning "division by zero" } */
+
+ double z = 0.0 / 0.0 ; /* { dg-bogus "division by zero" } */
+ w = (ZERO ? y / ZERO : x); /* { dg-bogus "division by zero" } */
+ x = (ZERO ? argc % ZERO: x); /* { dg-bogus "division by zero" } */
+
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/gcc-have-sync-compare-and-swap.c b/tests/codegen/executable/gcc/gcc-have-sync-compare-and-swap.c
new file mode 100644
index 000000000..5affeba19
--- /dev/null
+++ b/tests/codegen/executable/gcc/gcc-have-sync-compare-and-swap.c
@@ -0,0 +1,62 @@
+/* { dg-do link } */
+/* MIPS only supports these built-in functions for non-MIPS16 mode, and
+ -mflip-mips16 will change the mode of some functions to be different
+ from the command-line setting. */
+/* { dg-skip-if "" { mips*-*-* } { "-mflip-mips16" } { "" } } */
+
+void f1()
+{
+#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
+ typedef int __attribute__ ((__mode__ (__QI__))) qi_int_type;
+ qi_int_type qi_int;
+ __sync_bool_compare_and_swap (&qi_int, (qi_int_type)0, (qi_int_type)1);
+#endif
+}
+
+void f2()
+{
+#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
+ typedef int __attribute__ ((__mode__ (__HI__))) hi_int_type;
+ hi_int_type hi_int;
+ __sync_bool_compare_and_swap (&hi_int, (hi_int_type)0, (hi_int_type)1);
+#endif
+}
+
+void f4()
+{
+#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+ typedef int __attribute__ ((__mode__ (__SI__))) si_int_type;
+ si_int_type si_int;
+ __sync_bool_compare_and_swap (&si_int, (si_int_type)0, (si_int_type)1);
+#endif
+}
+
+void f8()
+{
+#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
+ typedef int __attribute__ ((__mode__ (__DI__))) di_int_type;
+ di_int_type di_int;
+ __sync_bool_compare_and_swap (&di_int, (di_int_type)0, (di_int_type)1);
+#endif
+}
+
+/* aligned (16): On S/390 16 byte compare and swap operations are only
+ available if the memory operand resides on a 16 byte boundary. */
+void f16()
+{
+#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
+ typedef int __attribute__ ((__mode__ (__TI__), aligned (16))) ti_int_type;
+ ti_int_type ti_int;
+ __sync_bool_compare_and_swap (&ti_int, (ti_int_type)0, (ti_int_type)1);
+#endif
+}
+
+int main()
+{
+ f1();
+ f2();
+ f4();
+ f8();
+ f16();
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/gcov-1.c b/tests/codegen/executable/gcc/gcov-1.c
new file mode 100644
index 000000000..99a02790d
--- /dev/null
+++ b/tests/codegen/executable/gcc/gcov-1.c
@@ -0,0 +1,20 @@
+/* Test Gcov basics. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage" } */
+/* { dg-do run { target native } } */
+
+void noop ()
+{
+}
+
+int main ()
+{
+ int i;
+
+ for (i = 0; i < 10; i++) /* count(11) */
+ noop (); /* count(10) */
+
+ return 0; /* count(1) */
+}
+
+/* { dg-final { run-gcov gcov-1.c } } */
diff --git a/tests/codegen/executable/gcc/gcov-1a.c b/tests/codegen/executable/gcc/gcov-1a.c
new file mode 100644
index 000000000..2b9fabce6
--- /dev/null
+++ b/tests/codegen/executable/gcc/gcov-1a.c
@@ -0,0 +1,20 @@
+/* Test Gcov basics. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage -fprofile-abs-path" } */
+/* { dg-do run { target native } } */
+
+void noop ()
+{
+}
+
+int main ()
+{
+ int i;
+
+ for (i = 0; i < 10; i++) /* count(11) */
+ noop (); /* count(10) */
+
+ return 0; /* count(1) */
+}
+
+/* { dg-final { run-gcov gcov-1a.c } } */
diff --git a/tests/codegen/executable/gcc/gcov-2.c b/tests/codegen/executable/gcc/gcov-2.c
new file mode 100644
index 000000000..aa3e4b74e
--- /dev/null
+++ b/tests/codegen/executable/gcc/gcov-2.c
@@ -0,0 +1,22 @@
+/* Test Gcov basics. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage -g" } */
+/* { dg-do run { target native } } */
+
+void noop ()
+{
+}
+
+int main ()
+{
+ int i;
+
+ for (i = 0; i < 10; i++) /* count(11) */
+ noop (); /* count(10) */
+
+ return 0; /* count(1) */
+}
+
+int a_variable = 0;
+
+/* { dg-final { run-gcov gcov-2.c } } */
diff --git a/tests/codegen/executable/gcc/gcov-5b.c b/tests/codegen/executable/gcc/gcov-5b.c
new file mode 100644
index 000000000..cbd395871
--- /dev/null
+++ b/tests/codegen/executable/gcc/gcov-5b.c
@@ -0,0 +1,34 @@
+/* Check that branch percentages are calculated in variables
+ that are large enough to hold the count. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage" } */
+/* { dg-do run { target native } } */
+
+#define LIMIT1 7000
+#define LIMIT2 7000
+
+int count;
+
+void incr_count ()
+{
+ count++;
+}
+
+void doit (int i, int j)
+{
+ if (i > j)
+ incr_count ();
+}
+
+int main ()
+{
+ int i, j;
+
+ for (i = 0; i < LIMIT1; i++)
+ for (j = 0; j < LIMIT2; j++)
+ doit (i, j);
+
+ return 0;
+}
+
+/* { dg-final { run-gcov branches { -b gcov-5b.c } } } */
diff --git a/tests/codegen/executable/gcc/gcov-pr85217.c b/tests/codegen/executable/gcc/gcov-pr85217.c
new file mode 100644
index 000000000..86a3c4b5a
--- /dev/null
+++ b/tests/codegen/executable/gcc/gcov-pr85217.c
@@ -0,0 +1,20 @@
+/* { dg-options "-fprofile-arcs -ftest-coverage" } */
+/* { dg-do run { target native } } */
+
+int a=0;
+
+int main() {
+ for (;; a++) {
+ int c[1];
+ if (a) {
+ break;
+ a;
+ continue; /* count(1) */
+ }
+ continue; /* count(1) */
+ }
+
+ return 0;
+}
+
+/* { dg-final { run-gcov gcov-pr85217.c } } */
diff --git a/tests/codegen/executable/gcc/ggcplug-test-1.c b/tests/codegen/executable/gcc/ggcplug-test-1.c
new file mode 100644
index 000000000..74e68bb82
--- /dev/null
+++ b/tests/codegen/executable/gcc/ggcplug-test-1.c
@@ -0,0 +1,12 @@
+/* Test the ggcplug plugin. */
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int main()
+{
+ int i=0, j=0;
+ for (i= 0; i<1000; i++)
+ if (i%8 == 0)
+ j++;
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/inc.c b/tests/codegen/executable/gcc/inc.c
new file mode 100644
index 000000000..98121d2d2
--- /dev/null
+++ b/tests/codegen/executable/gcc/inc.c
@@ -0,0 +1,21 @@
+/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+void
+foo(int *a)
+{
+ (*a)++;
+}
+
+int
+main ()
+{
+ int a = 0;
+ foo (&a);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "ASAN_" 4 "asan0" } } */
+/* { dg-final { scan-tree-dump "ASAN_CHECK \\(.*, 4\\);" "asan0" } } */
+/* { dg-final { scan-tree-dump "ASAN_CHECK \\(.*, 8\\);" "asan0" } } */
diff --git a/tests/codegen/executable/gcc/live-patching-2.c b/tests/codegen/executable/gcc/live-patching-2.c
new file mode 100644
index 000000000..0dde4e9e0
--- /dev/null
+++ b/tests/codegen/executable/gcc/live-patching-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-O2 -flive-patching -flto" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-message "sorry, unimplemented: live patching is not supported with LTO" "-flive-patching and -flto together" { target *-*-* } 0 } */
diff --git a/tests/codegen/executable/gcc/live-patching-3.c b/tests/codegen/executable/gcc/live-patching-3.c
new file mode 100644
index 000000000..b86f3c6e0
--- /dev/null
+++ b/tests/codegen/executable/gcc/live-patching-3.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -flive-patching -fwhole-program" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-message "'-fwhole-program' is incompatible with '-flive-patching=inline-only-static|inline-clone’" "" {target "*-*-*"} 0 } */
diff --git a/tests/codegen/executable/gcc/loadpre2.c b/tests/codegen/executable/gcc/loadpre2.c
new file mode 100644
index 000000000..5257815cc
--- /dev/null
+++ b/tests/codegen/executable/gcc/loadpre2.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-loop-im -fdump-tree-pre-stats" } */
+int main(int *a, int argc)
+{
+ int i;
+ int e;
+
+ /* Should be able to hoist this out of the loop. */
+ for (i = 0; i < argc; i++)
+ {
+ e = *a;
+ }
+ return e;
+}
+
+/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */
diff --git a/tests/codegen/executable/gcc/loadpre4.c b/tests/codegen/executable/gcc/loadpre4.c
new file mode 100644
index 000000000..6eaf69018
--- /dev/null
+++ b/tests/codegen/executable/gcc/loadpre4.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-pre-stats -fno-tree-loop-im" } */
+int main(int *a, int argc)
+{
+ int i;
+ int e;
+
+ for (i = 0; i < argc; i++)
+ {
+ e = *a;
+ *a = 9;
+ }
+ return e;
+}
+
+/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" } } */
diff --git a/tests/codegen/executable/gcc/loop-4.c b/tests/codegen/executable/gcc/loop-4.c
new file mode 100644
index 000000000..c83fd1c0f
--- /dev/null
+++ b/tests/codegen/executable/gcc/loop-4.c
@@ -0,0 +1,25 @@
+/* PR optimization/11841 */
+/* Originator: Andrey Panov */
+/* Reduced testcase by Volker Reichelt */
+
+/* Verify that the (old) loop unroller doesn't wrongly mark a pseudo
+ referenced in a note as local. */
+
+/* { dg-do run } */
+/* { dg-options "-O2 -funroll-loops" } */
+
+int *a;
+
+int main()
+{
+ double d[6];
+ int i, j;
+
+ for (i=0; i<4; ++i)
+ for (j=0; j<3; ++j)
+ d[i+j] = 0;
+
+ a = &i;
+
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/mac-eol-at-eof.c b/tests/codegen/executable/gcc/mac-eol-at-eof.c
new file mode 100644
index 000000000..f0afa260c
--- /dev/null
+++ b/tests/codegen/executable/gcc/mac-eol-at-eof.c
@@ -0,0 +1,3 @@
+/* Test no newline at eof warning when Mac line ending is used*/
+/* { dg-do compile } */
+int main() { return 0; }
diff --git a/tests/codegen/executable/gcc/mcount_pic.c b/tests/codegen/executable/gcc/mcount_pic.c
new file mode 100644
index 000000000..5546933d1
--- /dev/null
+++ b/tests/codegen/executable/gcc/mcount_pic.c
@@ -0,0 +1,15 @@
+/* PR target/63534 */
+/* Check correct mcount generation. */
+/* { dg-do run } */
+/* { dg-require-effective-target fpic } */
+/* { dg-require-effective-target ia32 } */
+/* { dg-options "-O2 -fpic -pg -save-temps" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mcount" } } */
+/* { dg-final { scan-assembler "get_pc_thunk" } } */
+/* { dg-final { cleanup-profile-file } } */
diff --git a/tests/codegen/executable/gcc/mcpu-6.c b/tests/codegen/executable/gcc/mcpu-6.c
new file mode 100644
index 000000000..96faa0165
--- /dev/null
+++ b/tests/codegen/executable/gcc/mcpu-6.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* Verify -mtune has higher priority than -mcpu for pipeline model . */
+/* { dg-options "-mcpu=sifive-u74 -mtune=rocket -fdump-rtl-sched2-details -march=rv32i -mabi=ilp32" } */
+/* { dg-final { scan-rtl-dump "simple_return\[ \]+:alu" "sched2" } } */
+
+int main()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/mcpu-7.c b/tests/codegen/executable/gcc/mcpu-7.c
new file mode 100644
index 000000000..6832323e5
--- /dev/null
+++ b/tests/codegen/executable/gcc/mcpu-7.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* Verify -mtune has higher priority than -mcpu for pipeline model . */
+/* { dg-options "-mcpu=sifive-s21 -mtune=sifive-u74 -fdump-rtl-sched2-details -march=rv32i -mabi=ilp32" } */
+/* { dg-final { scan-rtl-dump "simple_return\[ \]+:sifive_7_B" "sched2" } } */
+
+int main()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/merge_block.c b/tests/codegen/executable/gcc/merge_block.c
new file mode 100644
index 000000000..e8a8873f1
--- /dev/null
+++ b/tests/codegen/executable/gcc/merge_block.c
@@ -0,0 +1,21 @@
+
+/* { dg-options "-O2 -fno-ipa-pure-const -fdump-tree-optimized-blocks-details -fno-early-inlining -fno-ipa-modref" } */
+int a[8];
+int t()
+{
+ int i;
+ for (i = 0; i < 3; i++)
+ if (a[i])
+ break;
+ return i;
+}
+int
+main ()
+{
+ int i;
+ /* The loop will be optimized away after ipa-inline. */
+ for (i = 0; i < 1000000; i++)
+ t ();
+ return 0;
+}
+/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
diff --git a/tests/codegen/executable/gcc/native_cpu_0.c b/tests/codegen/executable/gcc/native_cpu_0.c
new file mode 100644
index 000000000..f155f51ba
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_0.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_0" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+crypto\+crc\+dotprod} } } */
+
+/* Test a normal looking procinfo. */
diff --git a/tests/codegen/executable/gcc/native_cpu_1.c b/tests/codegen/executable/gcc/native_cpu_1.c
new file mode 100644
index 000000000..2cf0e8999
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_1" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+nosimd} } } */
+
+/* Test one where fp is on by default so turn off simd. */
diff --git a/tests/codegen/executable/gcc/native_cpu_10.c b/tests/codegen/executable/gcc/native_cpu_10.c
new file mode 100644
index 000000000..6a753965c
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_10.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_10" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+nofp\+nosimd} } } */
+
+/* Test one with no entry in feature list. */
diff --git a/tests/codegen/executable/gcc/native_cpu_11.c b/tests/codegen/executable/gcc/native_cpu_11.c
new file mode 100644
index 000000000..96b9ca434
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_11.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_11" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+sb} } } */
+
+/* Test one with a feature name that overlaps with another one. */
diff --git a/tests/codegen/executable/gcc/native_cpu_12.c b/tests/codegen/executable/gcc/native_cpu_12.c
new file mode 100644
index 000000000..c3b44adbf
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_12.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_12" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+ssbs} } } */
+
+/* Test one where the longer feature overlaps with a shorter one. */
diff --git a/tests/codegen/executable/gcc/native_cpu_13.c b/tests/codegen/executable/gcc/native_cpu_13.c
new file mode 100644
index 000000000..b7b3a8e13
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_13.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_13" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+crypto\+crc\+dotprod} } } */
+
+/* Test one with mixed order of feature bits. */
diff --git a/tests/codegen/executable/gcc/native_cpu_14.c b/tests/codegen/executable/gcc/native_cpu_14.c
new file mode 100644
index 000000000..781ab1ebb
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_14.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_14" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+dotprod} } } */
+
+/* Test one where valid feature bits are at a boundary > buffer size. */
diff --git a/tests/codegen/executable/gcc/native_cpu_15.c b/tests/codegen/executable/gcc/native_cpu_15.c
new file mode 100644
index 000000000..c9205d95b
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_15.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_15" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+sve2-sm4} } } */
+
+/* Test one where the bounary of buffer size would cut off and leave
+ a valid feature in the first full buffer. e.g. this will cut off at
+ sve leaving 2-sm4 to yet be read. Check that this doesn't enable
+ +sve by mistake. */
diff --git a/tests/codegen/executable/gcc/native_cpu_16.c b/tests/codegen/executable/gcc/native_cpu_16.c
new file mode 100644
index 000000000..a424e7c56
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_16.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_16" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+crypto\+crc\+dotprod\+sve2} } } */
+
+/* Test a normal looking procinfo. */
diff --git a/tests/codegen/executable/gcc/native_cpu_17.c b/tests/codegen/executable/gcc/native_cpu_17.c
new file mode 100644
index 000000000..c269c5fef
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_17.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_17" } */
+/* { dg-additional-options "-march=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+crypto\+crc\+dotprod\+sve2} } } */
+
+/* Test a normal looking procinfo. */
diff --git a/tests/codegen/executable/gcc/native_cpu_2.c b/tests/codegen/executable/gcc/native_cpu_2.c
new file mode 100644
index 000000000..aad71f434
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_2.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_2" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+nofp\+nosimd} } } */
+
+/* Test one where asimd is provided byt no fp. */
diff --git a/tests/codegen/executable/gcc/native_cpu_3.c b/tests/codegen/executable/gcc/native_cpu_3.c
new file mode 100644
index 000000000..50685c297
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_3.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_3" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a} } } */
+
+/* Test where asimd and fp are the only ones provided, these are default
+ and so shouldn't emit anything. */
diff --git a/tests/codegen/executable/gcc/native_cpu_4.c b/tests/codegen/executable/gcc/native_cpu_4.c
new file mode 100644
index 000000000..91ae80975
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_4.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_4" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+crypto} } } */
+
+/* Test one where all crypto bits are given so crypto should be enabled. */
diff --git a/tests/codegen/executable/gcc/native_cpu_5.c b/tests/codegen/executable/gcc/native_cpu_5.c
new file mode 100644
index 000000000..84139e58e
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_5.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_5" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+fp16} } } */
+
+/* Test one where fp16 is available and so should be emitted. */
diff --git a/tests/codegen/executable/gcc/native_cpu_6.c b/tests/codegen/executable/gcc/native_cpu_6.c
new file mode 100644
index 000000000..da72052e6
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_6.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_6" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+crypto\+fp16} } } */
+
+/* Test one where the feature bits for crypto and fp16 are given in
+ same order as declared in options file. */
diff --git a/tests/codegen/executable/gcc/native_cpu_7.c b/tests/codegen/executable/gcc/native_cpu_7.c
new file mode 100644
index 000000000..96ad4c14d
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_7.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_7" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+crypto\+fp16} } } */
+
+/* Test one where the crypto and fp16 options are specified in different
+ order from what is in the options file. */
diff --git a/tests/codegen/executable/gcc/native_cpu_8.c b/tests/codegen/executable/gcc/native_cpu_8.c
new file mode 100644
index 000000000..7a5a2144a
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_8.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_8" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+sve} } } */
+
+/* Test one where sve is enabled. */
diff --git a/tests/codegen/executable/gcc/native_cpu_9.c b/tests/codegen/executable/gcc/native_cpu_9.c
new file mode 100644
index 000000000..528b5d029
--- /dev/null
+++ b/tests/codegen/executable/gcc/native_cpu_9.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_9" } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8-a\+sve2-sm4} } } */
+
+/* Test one here a feature that is a prefix of another is enabled.
+ In this case sve is a prefix to svesm4, but sve2-sm4 should be
+ enabled. */
diff --git a/tests/codegen/executable/gcc/nobp-no-dwarf2-cfi.c b/tests/codegen/executable/gcc/nobp-no-dwarf2-cfi.c
new file mode 100644
index 000000000..75e32a1c7
--- /dev/null
+++ b/tests/codegen/executable/gcc/nobp-no-dwarf2-cfi.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z900 --save-temps -mfunction-return-reg=thunk -mindirect-branch-table -fno-dwarf2-cfi-asm" } */
+
+/* Make sure that we do not emit .cfi directives when -fno-dwarf2-cfi-asm is being used. */
+
+int
+main ()
+{
+ return 0;
+}
+
+/* 1 x main
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 1 } } */
+/* { dg-final { scan-assembler "ex\t" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/tests/codegen/executable/gcc/options_set_1.c b/tests/codegen/executable/gcc/options_set_1.c
new file mode 100644
index 000000000..40d9a05c9
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc} 1 } } */
+
+/* Check to see if crc is output by default. */
diff --git a/tests/codegen/executable/gcc/options_set_10.c b/tests/codegen/executable/gcc/options_set_10.c
new file mode 100644
index 000000000..1fc8aa86f
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_10.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */
+/* { dg-additional-options "-mcpu=native" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not {\.arch .+\+profile.*} } } */
+
+ /* Check that an empty feature string is not detected during mcpu=native. */
diff --git a/tests/codegen/executable/gcc/options_set_11.c b/tests/codegen/executable/gcc/options_set_11.c
new file mode 100644
index 000000000..d083bfdbd
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_11.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+fp" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc} } } */
+
+ /* FP is default on, no need to pass on to assembler. */
diff --git a/tests/codegen/executable/gcc/options_set_12.c b/tests/codegen/executable/gcc/options_set_12.c
new file mode 100644
index 000000000..58a09fda2
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_12.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+fp16" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16} } } */
+
+ /* fp16 not default, should be emitted. */
diff --git a/tests/codegen/executable/gcc/options_set_13.c b/tests/codegen/executable/gcc/options_set_13.c
new file mode 100644
index 000000000..2a517ecb5
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_13.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+fp16+fp" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16} } } */
+
+ /* FP is part of FP16, don't emit it. */
diff --git a/tests/codegen/executable/gcc/options_set_14.c b/tests/codegen/executable/gcc/options_set_14.c
new file mode 100644
index 000000000..c192bf6cb
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_14.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+fp16fml" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16fml} } } */
+
+ /* fmp16fml is smallest option to emit. */
diff --git a/tests/codegen/executable/gcc/options_set_15.c b/tests/codegen/executable/gcc/options_set_15.c
new file mode 100644
index 000000000..32ec3ea46
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_15.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+fp16fml+fp" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16fml*} } } */
+
+ /* fp included in fp16fml, only emit latter. */
diff --git a/tests/codegen/executable/gcc/options_set_16.c b/tests/codegen/executable/gcc/options_set_16.c
new file mode 100644
index 000000000..b45c01a91
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_16.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+fp16fml+fp16+fp" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16fml} } } */
+
+ /* fp16fml is smallest options to emit. */
diff --git a/tests/codegen/executable/gcc/options_set_17.c b/tests/codegen/executable/gcc/options_set_17.c
new file mode 100644
index 000000000..c490e1f47
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_17.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+dotprod" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+dotprod} } } */
+
+ /* dotprod needs to be emitted pre armv8.4. */
diff --git a/tests/codegen/executable/gcc/options_set_18.c b/tests/codegen/executable/gcc/options_set_18.c
new file mode 100644
index 000000000..61587dbbd
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_18.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.4-a+dotprod" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc} } } */
+
+ /* dotprod is default in armv8.4-a, don't emit. */
diff --git a/tests/codegen/executable/gcc/options_set_19.c b/tests/codegen/executable/gcc/options_set_19.c
new file mode 100644
index 000000000..72b581261
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_19.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.4-a+fp" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc} } } */
+
+ /* fp default, don't emit. */
diff --git a/tests/codegen/executable/gcc/options_set_2.c b/tests/codegen/executable/gcc/options_set_2.c
new file mode 100644
index 000000000..3476febce
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_2.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+crypto" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crypto\+crc} 1 } } */
+
+/* Check to see if crc and crypto are maintained if crypto specified. */
diff --git a/tests/codegen/executable/gcc/options_set_20.c b/tests/codegen/executable/gcc/options_set_20.c
new file mode 100644
index 000000000..b383e0ace
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_20.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.4-a+fp16" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16} } } */
+
+ /* fp16 smallest set to emit. */
diff --git a/tests/codegen/executable/gcc/options_set_21.c b/tests/codegen/executable/gcc/options_set_21.c
new file mode 100644
index 000000000..19fcd6fda
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_21.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.4-a+fp16+fp" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16} } } */
+
+ /* fp16 smallest set to emit. */
diff --git a/tests/codegen/executable/gcc/options_set_22.c b/tests/codegen/executable/gcc/options_set_22.c
new file mode 100644
index 000000000..77ae4089f
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_22.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.4-a+fp16fml" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16} } } */
+
+ /* fp16 smallest set to emit. */
diff --git a/tests/codegen/executable/gcc/options_set_23.c b/tests/codegen/executable/gcc/options_set_23.c
new file mode 100644
index 000000000..dee637c5d
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_23.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.4-a+fp16fml+fp" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16} } } */
+
+ /* fp16 smallest set to emit. */
diff --git a/tests/codegen/executable/gcc/options_set_24.c b/tests/codegen/executable/gcc/options_set_24.c
new file mode 100644
index 000000000..54b0e3d4a
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_24.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.4-a+fp16fml+fp16" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16} } } */
+
+ /* fp16 smallest set to emit. */
diff --git a/tests/codegen/executable/gcc/options_set_25.c b/tests/codegen/executable/gcc/options_set_25.c
new file mode 100644
index 000000000..a3b2d63c0
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_25.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.4-a+fp16fml+fp+fp16" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16} } } */
+
+ /* fp16 smallest set to emit. */
diff --git a/tests/codegen/executable/gcc/options_set_26.c b/tests/codegen/executable/gcc/options_set_26.c
new file mode 100644
index 000000000..b383e0ace
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_26.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.4-a+fp16" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16} } } */
+
+ /* fp16 smallest set to emit. */
diff --git a/tests/codegen/executable/gcc/options_set_3.c b/tests/codegen/executable/gcc/options_set_3.c
new file mode 100644
index 000000000..4558339f1
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_3.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+aes+sha2+crypto" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crypto\+crc} 1 } } */
+
+/* Check if smallest set is maintained when outputting. */
diff --git a/tests/codegen/executable/gcc/options_set_4.c b/tests/codegen/executable/gcc/options_set_4.c
new file mode 100644
index 000000000..15514bfe9
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_4.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+aes+sha2" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crypto\+crc} 1 } } */
+
+/* Check if individual bits that make up a grouping is specified that only the
+ grouping is kept. */
\ No newline at end of file
diff --git a/tests/codegen/executable/gcc/options_set_5.c b/tests/codegen/executable/gcc/options_set_5.c
new file mode 100644
index 000000000..b4c090119
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_5.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+aes+sha2+nosha2" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+aes} 1 } } */
+
+/* Check if turning off feature bits works correctly and grouping is no
+ longer valid. */
diff --git a/tests/codegen/executable/gcc/options_set_6.c b/tests/codegen/executable/gcc/options_set_6.c
new file mode 100644
index 000000000..90a055928
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_6.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+crypto+nosha2" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crypto\+crc} 1 } } */
+
+/* Group as a whole was requested to be turned on, crypto itself is a bit and so
+ just turning off one feature can't turn it off. */
diff --git a/tests/codegen/executable/gcc/options_set_7.c b/tests/codegen/executable/gcc/options_set_7.c
new file mode 100644
index 000000000..71a2c8a19
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_7.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.4-a+dotprod" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\.arch armv8\.4\-a} 1 } } */
+
+/* Checking if enabling default features drops the superfluous bits. */
diff --git a/tests/codegen/executable/gcc/options_set_8.c b/tests/codegen/executable/gcc/options_set_8.c
new file mode 100644
index 000000000..83be1bd7a
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_8.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.4-a+nodotprod" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\.arch armv8\.4\-a} 1 } } */
+
+/* Checking if trying to turn off default features propagates the commandline
+ option. */
diff --git a/tests/codegen/executable/gcc/options_set_9.c b/tests/codegen/executable/gcc/options_set_9.c
new file mode 100644
index 000000000..e3c7cdc54
--- /dev/null
+++ b/tests/codegen/executable/gcc/options_set_9.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8-a+simd+fp" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\.arch armv8\-a} 1 } } */
+
+ /* Check that grouping of bits that don't form a synthetic group don't turn
+ on the parent. e.g. rdma turns on simd+fp, but simd+fp does not turn on
+ rdma since rdma is it's own group. crypto however turns on aes and sha2
+ and turning on sha2 and eas should turn on crypto!. */
diff --git a/tests/codegen/executable/gcc/pr100646-1.c b/tests/codegen/executable/gcc/pr100646-1.c
new file mode 100644
index 000000000..8f2caf40c
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr100646-1.c
@@ -0,0 +1,5 @@
+/* PR preprocessor/100646 */
+/* { dg-do compile } */
+/* { dg-options "-fdirectives-only -save-temps -std=c17" } */
+int main () { return 0; }
+// Not newline terminated
\ No newline at end of file
diff --git a/tests/codegen/executable/gcc/pr100646-2.c b/tests/codegen/executable/gcc/pr100646-2.c
new file mode 100644
index 000000000..a1deba106
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr100646-2.c
@@ -0,0 +1,6 @@
+/* PR preprocessor/100646 */
+/* { dg-do compile } */
+/* { dg-options "-fdirectives-only -save-temps -std=c17" } */
+int main () { return 0; }
+/* { dg-warning "backslash-newline at end of file" "" { target *-*-* } .+1 } */
+// Not newline terminated\
\ No newline at end of file
diff --git a/tests/codegen/executable/gcc/pr100934.c b/tests/codegen/executable/gcc/pr100934.c
new file mode 100644
index 000000000..43b788498
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr100934.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+
+int a, b, c, d, e;
+int main()
+{
+ int f = 0, g = 0;
+ for (; f < 2; f++)
+ {
+ int h, i;
+ for (h = 0; h < 2; h++)
+ {
+ b = e = g ? a % g : 0;
+ c = d;
+ for (i = 0; i < 1; i++)
+ g = 0;
+ for (; g < 2; g++)
+ ;
+ }
+ }
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr101797.c b/tests/codegen/executable/gcc/pr101797.c
new file mode 100644
index 000000000..d5cc34e54
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr101797.c
@@ -0,0 +1,15 @@
+/* PR target/101797 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a;
+int main() {
+ int b, c, d, e = 0;
+ if (a) {
+ c += a;
+ e = ~(a % c);
+ e || c || (b & d);
+ }
+ a = e;
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr104448.c b/tests/codegen/executable/gcc/pr104448.c
new file mode 100644
index 000000000..b10345afc
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr104448.c
@@ -0,0 +1,9 @@
+/* PR target/104448 */
+/* { dg-do compile { target { *-*-linux* && lp64 } } } */
+/* { dg-options "-mavx5124vnniw -mno-xsave -mabi=ms" } */
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr18628.c b/tests/codegen/executable/gcc/pr18628.c
new file mode 100644
index 000000000..d365075b7
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr18628.c
@@ -0,0 +1,31 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+/* PR middle-end/18628 exposed a problem in which cse folded a load
+ from a jump table into the label that was the target of the branch.
+ Unfortunately, the indirect jump was moved to a different basic
+ block, and the LABEL_REF copied to the register wasn't enough to
+ keep the cfg from optimizing the otherwise-unused label away. So
+ we ended up with a dangling reference to the label. */
+
+int i;
+
+int main()
+{
+ for (;;)
+ {
+ switch (i)
+ {
+ case 0:
+ case 1:
+ return 1;
+
+ case 2:
+ case 3:
+ return 0;
+
+ case 5:
+ --i;
+ }
+ }
+}
diff --git a/tests/codegen/executable/gcc/pr30551-2.c b/tests/codegen/executable/gcc/pr30551-2.c
new file mode 100644
index 000000000..163a3ce4d
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr30551-2.c
@@ -0,0 +1,8 @@
+/* PR 30551 -Wmain is not enabled by default. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void main(char a) {} /* { dg-bogus "first argument of .main. should be .int." "int" } */
+/* { dg-bogus ".main. takes only zero or two arguments" "zero or two" { target *-*-* } .-1 } */
+/* { dg-bogus "return type of .main. is not .int." "return type" { target *-*-* } .-2 } */
+
diff --git a/tests/codegen/executable/gcc/pr30551-3.c b/tests/codegen/executable/gcc/pr30551-3.c
new file mode 100644
index 000000000..9151b1e3a
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr30551-3.c
@@ -0,0 +1,6 @@
+/* PR 30551 -Wmain is enabled by -pedantic-errors. */
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors" } */
+void main(char a) {} /* { dg-error "first argument of .main. should be .int." "int" } */
+/* { dg-error ".main. takes only zero or two arguments" "zero or two" { target *-*-* } .-1 } */
+/* { dg-error "return type of .main. is not .int." "return type" { target *-*-* } .-2 } */
diff --git a/tests/codegen/executable/gcc/pr30551-4.c b/tests/codegen/executable/gcc/pr30551-4.c
new file mode 100644
index 000000000..6105beeee
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr30551-4.c
@@ -0,0 +1,8 @@
+/* PR 30551 -Wmain is enabled by -pedantic-errors and can be disabled. */
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors -Wno-main" } */
+
+void main(char a) {} /* { dg-bogus "first argument of .main. should be .int." "int" } */
+/* { dg-bogus ".main. takes only zero or two arguments" "zero or two" { target *-*-* } .-1 } */
+/* { dg-bogus "return type of .main. is not .int." "return type" { target *-*-* } .-2 } */
+
diff --git a/tests/codegen/executable/gcc/pr30551-5.c b/tests/codegen/executable/gcc/pr30551-5.c
new file mode 100644
index 000000000..30fa871af
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr30551-5.c
@@ -0,0 +1,7 @@
+/* PR 30551 -Wmain is enabled by -pedantic and can be disabled. */
+/* { dg-do compile } */
+/* { dg-options "-pedantic -Wno-main" } */
+
+void main(char a) {} /* { dg-bogus "first argument of .main. should be .int." "int" } */
+/* { dg-bogus ".main. takes only zero or two arguments" "zero or two" { target *-*-* } .-1 } */
+/* { dg-bogus "return type of .main. is not .int." "return type" { target *-*-* } .-2 } */
diff --git a/tests/codegen/executable/gcc/pr30551-6.c b/tests/codegen/executable/gcc/pr30551-6.c
new file mode 100644
index 000000000..fa6bf0c6a
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr30551-6.c
@@ -0,0 +1,6 @@
+/* PR 30551 -Wmain is enabled by -pedantic. */
+/* { dg-do compile } */
+/* { dg-options "-pedantic" } */
+void main(char a) {} /* { dg-warning "first argument of .main. should be .int." "int" } */
+/* { dg-warning ".main. takes only zero or two arguments" "zero or two" { target *-*-* } .-1 } */
+/* { dg-warning "return type of .main. is not .int." "return type" { target *-*-* } .-2 } */
diff --git a/tests/codegen/executable/gcc/pr30551.c b/tests/codegen/executable/gcc/pr30551.c
new file mode 100644
index 000000000..c7b108e85
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr30551.c
@@ -0,0 +1,6 @@
+/* PR 30551 -Wmain is enabled by -Wall. */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+void main(char a) {} /* { dg-warning "first argument of .main. should be .int." "int" } */
+/* { dg-warning ".main. takes only zero or two arguments" "zero or two" { target *-*-* } .-1 } */
+/* { dg-warning "return type of .main. is not .int." "return type" { target *-*-* } .-2 } */
diff --git a/tests/codegen/executable/gcc/pr43084.c b/tests/codegen/executable/gcc/pr43084.c
new file mode 100644
index 000000000..dc75982f4
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr43084.c
@@ -0,0 +1,16 @@
+/* PR debug/43084 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fwhole-program -fcompare-debug" } */
+
+struct S
+{
+ int a;
+};
+
+int
+main ()
+{
+ struct S s;
+ struct S *p = &s;
+ return p->a;
+}
diff --git a/tests/codegen/executable/gcc/pr52803.c b/tests/codegen/executable/gcc/pr52803.c
new file mode 100644
index 000000000..6774b0c6d
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr52803.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-move-loop-invariants" } */
+
+int main () { return 0; }
diff --git a/tests/codegen/executable/gcc/pr61220.c b/tests/codegen/executable/gcc/pr61220.c
new file mode 100644
index 000000000..d45d1c3c9
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr61220.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+int a, c, d, e, f, g, h, i, j, k;
+
+struct S0
+{
+ int f0;
+ int f1;
+ int f2;
+};
+
+struct S1
+{
+ int f0;
+ int f1;
+ struct S0 f2;
+} b;
+
+void
+fn1 (struct S1 p)
+{
+ for (; k; k++)
+ h = j ? a : a - 1;
+ d &= i;
+}
+
+int
+main ()
+{
+ int l[5] = { 0 };
+ fn1 (b);
+ for (c = 0; c < 3; c++)
+ for (g = 0; g < 3; g++)
+ l[c * 2] = e = l[c];
+ if (f)
+ fn1 (b);
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr61383-1.c b/tests/codegen/executable/gcc/pr61383-1.c
new file mode 100644
index 000000000..d9a0a0b39
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr61383-1.c
@@ -0,0 +1,35 @@
+/* { dg-do run } */
+
+int a, b = 1, c, d, e, f, g;
+
+int
+fn1 ()
+{
+ int h;
+ for (;;)
+ {
+ g = b;
+ g = g ? 0 : 1 % g;
+ e = a + 1;
+ for (; d < 1; d = e)
+ {
+ if (f == 0)
+ h = 0;
+ else
+ h = 1 % f;
+ if (f < 1)
+ c = 0;
+ else if (h)
+ break;
+ }
+ if (b)
+ return 0;
+ }
+}
+
+int
+main ()
+{
+ fn1 ();
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr65780-1.c b/tests/codegen/executable/gcc/pr65780-1.c
new file mode 100644
index 000000000..5e3226e54
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr65780-1.c
@@ -0,0 +1,12 @@
+/* PR target/65780 */
+/* { dg-do link { target *-*-linux* *-*-gnu* *-*-uclinux* } } */
+/* { dg-options "-O2" } */
+
+int optopt;
+
+int
+main ()
+{
+ optopt = 4;
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr65780-2.c b/tests/codegen/executable/gcc/pr65780-2.c
new file mode 100644
index 000000000..932cbe1c4
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr65780-2.c
@@ -0,0 +1,13 @@
+/* PR target/65780 */
+/* { dg-do link { target *-*-linux* *-*-gnu* *-*-uclinux* } } */
+/* { dg-require-effective-target pie } */
+/* { dg-options "-O2 -fpie" } */
+
+int optopt;
+
+int
+main ()
+{
+ optopt = 4;
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr68060-1.c b/tests/codegen/executable/gcc/pr68060-1.c
new file mode 100644
index 000000000..8830d8786
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr68060-1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+int a, b, c;
+
+int
+main ()
+{
+ for (; c; c++)
+ for (a = 0; a < 4; a++)
+ {
+ c &= 5;
+ for (b = 0; b < 2; b++)
+ c |= 1;
+ }
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr71958.c b/tests/codegen/executable/gcc/pr71958.c
new file mode 100644
index 000000000..81102fc8e
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr71958.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target maybe_x32 } */
+/* { dg-options "-mx32 -mabi=ms" } */
+/* { dg-error "'-mabi=ms' not supported with X32 ABI" "" { target *-*-* } 0 } */
+
+void main ()
+{
+}
diff --git a/tests/codegen/executable/gcc/pr73450.c b/tests/codegen/executable/gcc/pr73450.c
new file mode 100644
index 000000000..7dd44dbba
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr73450.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+int a;
+char b;
+int main() {
+ char c = 0;
+ for (; c != 3; c = c + 7) {
+ a = b & a;
+ if (a)
+ break;
+ }
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr80969-1.c b/tests/codegen/executable/gcc/pr80969-1.c
new file mode 100644
index 000000000..e0520b45c
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr80969-1.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target { ! x32 } } } */
+/* { dg-options "-Ofast -mabi=ms -mavx512f" } */
+/* { dg-require-effective-target avx512f } */
+
+int a[56];
+int b;
+int main (int argc, char *argv[]) {
+ int c;
+ for (; b; b++) {
+ c = b;
+ if (b & 1)
+ c = 2;
+ a[b] = c;
+ }
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr81766.c b/tests/codegen/executable/gcc/pr81766.c
new file mode 100644
index 000000000..b5aa34645
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr81766.c
@@ -0,0 +1,9 @@
+/* PR target/81766 */
+/* { dg-do compile { target { pie && lp64 } } } */
+/* { dg-options "-O2 -fpie -mcmodel=large" } */
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr82145.c b/tests/codegen/executable/gcc/pr82145.c
new file mode 100644
index 000000000..99945dadc
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr82145.c
@@ -0,0 +1,12 @@
+/* PR target/82145 */
+/* { dg-do compile { target { pie && lp64 } } } */
+/* { dg-options "-O2 -fpie -mcmodel=large -march=haswell" } */
+
+int l;
+
+int
+main ()
+{
+ l++;
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr82788.c b/tests/codegen/executable/gcc/pr82788.c
new file mode 100644
index 000000000..41c442f61
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr82788.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-probe-interval=10 --param stack-clash-protection-guard-size=12" } */
+/* { dg-require-effective-target supports_stack_clash_protection } */
+/* { dg-skip-if "AArch64 does not support this interval." { aarch64*-*-* } } */
+int main() { int a[1442]; return 0;}
diff --git a/tests/codegen/executable/gcc/pr84829.c b/tests/codegen/executable/gcc/pr84829.c
new file mode 100644
index 000000000..a63a49b13
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr84829.c
@@ -0,0 +1,7 @@
+/* { dg-do link } */
+/* { dg-options "-mieee-fp" } */
+
+int main()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr86134.c b/tests/codegen/executable/gcc/pr86134.c
new file mode 100644
index 000000000..3fd21a323
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr86134.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall -Werror -Wno-error=main -Wno-foobar" } */
+
+void main() {} /* { dg-warning "return type" } */
+
+/* { dg-message "unrecognized command-line option" "" { target *-*-* } 0 } */
diff --git a/tests/codegen/executable/gcc/pr88077_1.c b/tests/codegen/executable/gcc/pr88077_1.c
new file mode 100644
index 000000000..43d783f2c
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr88077_1.c
@@ -0,0 +1,8 @@
+/* { dg-options {-fcommon} } */
+
+char HeaderStr[1];
+
+int main()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr90671.c b/tests/codegen/executable/gcc/pr90671.c
new file mode 100644
index 000000000..5a99b9d9a
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr90671.c
@@ -0,0 +1,16 @@
+/* PR tree-optimization/90671 */
+/* { dg-do compile } */
+/* { dg-additional-options "-w -g" } */
+
+int a;
+
+int
+main ()
+{
+ int b, c;
+ for (c = 0; c < 2; c++)
+ while (a)
+ if (b)
+ break;
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr93452-1.c b/tests/codegen/executable/gcc/pr93452-1.c
new file mode 100644
index 000000000..f0986e492
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr93452-1.c
@@ -0,0 +1,10 @@
+/* { dg-do preprocess } */
+/* { dg-additional-options "-fdirectives-only" } */
+
+int main ()
+{
+ return 0;
+}
+
+/* A regexp that doesn't match itself! */
+/* { dg-final { scan-file-not pr93452-1.i {_[_]has_include} } } */
diff --git a/tests/codegen/executable/gcc/pr94392.c b/tests/codegen/executable/gcc/pr94392.c
new file mode 100644
index 000000000..373f18ce9
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr94392.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-skip-if "finite loops" { *-*-* } { "-ffinite-loops" } } */
+/* { dg-skip-if "LTO optimizes the test" { *-*-* } { "-flto" } } */
+/* { dg-additional-options "-fdump-tree-optimized" } */
+
+int a, b;
+
+int
+main()
+{
+ while (1)
+ {
+ /* Try really hard. */
+ if (a != b)
+ return 1;
+ }
+ return 0;
+}
+
+/* ISO C does not guarantee forward progress like C++ does so we
+ cannot assume the loop is finite and optimize it to return 1. */
+/* { dg-final { scan-tree-dump "if" "optimized" } } */
diff --git a/tests/codegen/executable/gcc/pr97327.c b/tests/codegen/executable/gcc/pr97327.c
new file mode 100644
index 000000000..d19bde592
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr97327.c
@@ -0,0 +1,8 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=hard" } { "" } } */
+/* { dg-additional-options "-mcpu=cortex-m55 -mthumb -mfloat-abi=soft -mfpu=auto -Werror" } */
+
+int main ()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr98222.c b/tests/codegen/executable/gcc/pr98222.c
new file mode 100644
index 000000000..92e857c20
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr98222.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+int a, b, *c;
+
+int f (int j, int k) {
+ b = k / j;
+ if (a)
+ f(0, 0);
+ *c = f(b & a, 0);
+ return 0;
+}
+
+int main() {
+ if (a)
+ while (1)
+ f(0, 0);
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/pr98943.c b/tests/codegen/executable/gcc/pr98943.c
new file mode 100644
index 000000000..53d8838f2
--- /dev/null
+++ b/tests/codegen/executable/gcc/pr98943.c
@@ -0,0 +1,10 @@
+// { dg-do compile }
+// PR 98943, compiler feature tests can get confused by not linking
+// { dg-options "NOTAFILE" }
+
+int main ()
+{
+ return 0;
+}
+
+// { dg-regexp {[^\n:]*: warning: NOTAFILE: linker input file unused because linking not done\n[^\n:]*: error: NOTAFILE: linker input file not found: [^\n]*\n} }
diff --git a/tests/codegen/executable/gcc/profile-generate-3.c b/tests/codegen/executable/gcc/profile-generate-3.c
new file mode 100644
index 000000000..212ddee33
--- /dev/null
+++ b/tests/codegen/executable/gcc/profile-generate-3.c
@@ -0,0 +1,10 @@
+/* { dg-do link } */
+/* { dg-require-profiling "-fprofile-generate" } */
+/* { dg-options "-fprofile-generate=." } */
+
+int
+main ()
+{
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/profile-info-section.c b/tests/codegen/executable/gcc/profile-info-section.c
new file mode 100644
index 000000000..8f31f3b2c
--- /dev/null
+++ b/tests/codegen/executable/gcc/profile-info-section.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-skip-if "profile-info-section" { powerpc-ibm-aix* } } */
+/* { dg-options "-fprofile-arcs -fprofile-info-section -fdump-tree-optimized" } */
+
+int foo()
+{
+ return 0;
+}
+
+int bar()
+{
+ return 1;
+}
+
+int main ()
+{
+ return foo ();
+}
+
+/* { dg-final { scan-tree-dump-not "__gcov_init" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "__gcov_exit" "optimized" } } */
+/* { dg-final { scan-assembler "\.gcov_info" } } */
diff --git a/tests/codegen/executable/gcc/profile-update-warning.c b/tests/codegen/executable/gcc/profile-update-warning.c
new file mode 100644
index 000000000..63074e383
--- /dev/null
+++ b/tests/codegen/executable/gcc/profile-update-warning.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+/* { dg-options "-fprofile-update=atomic -fprofile-generate -march=i386" } */
+
+int main(int argc, char *argv[])
+{
+ return 0;
+} /* { dg-warning "target does not support atomic profile update, single mode is selected" } */
diff --git a/tests/codegen/executable/gcc/reassoc-10.c b/tests/codegen/executable/gcc/reassoc-10.c
new file mode 100644
index 000000000..70794d251
--- /dev/null
+++ b/tests/codegen/executable/gcc/reassoc-10.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+int main(int a, int b, int c, int d)
+{
+ /* Should become just a & b & c & d */
+ int e = (a & b) & (c & d);
+ int f = (c & a) & (b & d);
+ return e & f;
+}
+/* { dg-final { scan-tree-dump-times "\\\& " 3 "optimized"} } */
diff --git a/tests/codegen/executable/gcc/reassoc-11.c b/tests/codegen/executable/gcc/reassoc-11.c
new file mode 100644
index 000000000..171dcc77e
--- /dev/null
+++ b/tests/codegen/executable/gcc/reassoc-11.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-reassoc1" } */
+int main(int a, int b, int c, int d)
+{
+ /* All the xor's cancel each other out, leaving 0 */
+ int e = (a ^ b) ^ (c ^ d);
+ int f = (c ^ a) ^ (b ^ d);
+ return e ^ f;
+}
+/* { dg-final { scan-tree-dump-times "= 0" 1 "reassoc1"} } */
diff --git a/tests/codegen/executable/gcc/reassoc-3.c b/tests/codegen/executable/gcc/reassoc-3.c
new file mode 100644
index 000000000..178e6a448
--- /dev/null
+++ b/tests/codegen/executable/gcc/reassoc-3.c
@@ -0,0 +1,7 @@
+/* { dg-options "" } */
+int main(int a, int b, int c, int d)
+{
+ int e = (a & ~b) & (~c & d);
+ int f = (~c & a) & (b & ~d);
+ return (e & f);
+}
diff --git a/tests/codegen/executable/gcc/reassoc-6.c b/tests/codegen/executable/gcc/reassoc-6.c
new file mode 100644
index 000000000..c31427686
--- /dev/null
+++ b/tests/codegen/executable/gcc/reassoc-6.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-reassoc1" } */
+int main(int a, int b, int c, int d)
+{
+ /* Should be transformed into a + c + 8 */
+ int e = a + 3;
+ int f = c + 5;
+ int g = e + f;
+ return g;
+}
+
+/* We cannot re-associate the additions due to undefined signed overflow. */
+
+/* { dg-final { scan-tree-dump-times "\\\+ 8" 1 "reassoc1" { xfail *-*-* } } } */
diff --git a/tests/codegen/executable/gcc/reassoc-8.c b/tests/codegen/executable/gcc/reassoc-8.c
new file mode 100644
index 000000000..3164b1a52
--- /dev/null
+++ b/tests/codegen/executable/gcc/reassoc-8.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-reassoc1" } */
+
+int main(int a, int b, int c, int d, int e, int f, int g, int h)
+{
+ /* e & ~e -> 0 */
+ int i = (a & 9) & (c & d);
+ int j = (~e & d) & (~c & e);
+ e = i & j;
+ return e;
+}
+/* { dg-final { scan-tree-dump-times "= 0" 1 "reassoc1"} } */
diff --git a/tests/codegen/executable/gcc/reassoc-9.c b/tests/codegen/executable/gcc/reassoc-9.c
new file mode 100644
index 000000000..bb9d971f9
--- /dev/null
+++ b/tests/codegen/executable/gcc/reassoc-9.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-reassoc1" } */
+
+int main(int a, int b, int c, int d, int e, int f, int g, int h)
+{
+ /* Should be transformed into e = 20 */
+ int i = (a + 9) + (c + 8);
+ int j = (-c + 1) + (-a + 2);
+
+ e = i + j;
+ return e;
+}
+
+/* We can always re-associate to a final constant but the current
+ implementation does not allow easy roll-back without IL changes. */
+
+/* { dg-final { scan-tree-dump-times "= 20" 1 "reassoc1" { xfail *-*-* } } } */
diff --git a/tests/codegen/executable/gcc/resolutions_0.c b/tests/codegen/executable/gcc/resolutions_0.c
new file mode 100644
index 000000000..5274c8c07
--- /dev/null
+++ b/tests/codegen/executable/gcc/resolutions_0.c
@@ -0,0 +1,12 @@
+/* { dg-require-linker-plugin "" } */
+/* { dg-extra-ld-options "-fuse-linker-plugin -O1" } */
+
+void
+link_error()
+{
+}
+int
+main()
+{
+ return 0;
+}
diff --git a/tests/codegen/executable/gcc/sccp-1.c b/tests/codegen/executable/gcc/sccp-1.c
new file mode 100644
index 000000000..73c10797a
--- /dev/null
+++ b/tests/codegen/executable/gcc/sccp-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int main(int argc, char* argv[])
+{
+ int i, a = 0;
+ for (i=0; i < 10; i++)
+ a += i + 0xff00ff;
+ return a;
+}
+
+/* There should be no loop left. */
+
+/* { dg-final { scan-tree-dump-times "goto" 0 "optimized" } } */
diff --git a/tests/codegen/executable/gcc/sibcall-1.c b/tests/codegen/executable/gcc/sibcall-1.c
new file mode 100644
index 000000000..8134f0cfe
--- /dev/null
+++ b/tests/codegen/executable/gcc/sibcall-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* Just create some dummy call that should trigger sibcall, no
+ stack logic. */
+int calc (int a, int b, int c) {
+ if (c <= 0) return a;
+ return calc (a * b, b, --c);
+}
+
+int main() {
+ return calc (4, 3, 4);
+}
+
+/* Ensure sibcalls do not need to manipulate the stack. */
+/* { dg-final { scan-assembler-not "r1," } } */
+/* Ensure sibcall maintains the body of the function. */
+/* { dg-final { scan-assembler "l.mul" } } */
diff --git a/tests/codegen/executable/gcc/ssa-fre-4.c b/tests/codegen/executable/gcc/ssa-fre-4.c
new file mode 100644
index 000000000..d09af7819
--- /dev/null
+++ b/tests/codegen/executable/gcc/ssa-fre-4.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+/* { dg-additional-options "-fdump-tree-fre1" } */
+
+int x;
+int main()
+{
+ x = 0;
+ if (x)
+ {
+ for (int i = 0; i < 10; ++i)
+ x = i;
+ }
+ return x;
+}
+
+/* { dg-final { scan-tree-dump "return 0;" "fre1" } } */
diff --git a/tests/codegen/executable/gcc/stack-corruption.c b/tests/codegen/executable/gcc/stack-corruption.c
new file mode 100644
index 000000000..cc44c6280
--- /dev/null
+++ b/tests/codegen/executable/gcc/stack-corruption.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { ! { arm_thumb1_ok || arm_thumb2_ok } } } */
+/* { dg-options "-O -mthumb -fno-omit-frame-pointer" } */
+
+int main() {
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "\tadd\tr7, sp, #8\n" } } */
diff --git a/tests/codegen/executable/gcc/struct-complex-1_main.c b/tests/codegen/executable/gcc/struct-complex-1_main.c
new file mode 100644
index 000000000..92e886acf
--- /dev/null
+++ b/tests/codegen/executable/gcc/struct-complex-1_main.c
@@ -0,0 +1,21 @@
+/* { dg-options "-O" } */
+
+#ifdef __x86_64__
+/* Test function argument passing. PR target/15302. */
+
+extern void struct_complex_1_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_complex_1_x ();
+ exit (0);
+}
+#else
+int
+main ()
+{
+ return 0;
+}
+#endif
diff --git a/tests/codegen/executable/gcc/struct-complex-2_main.c b/tests/codegen/executable/gcc/struct-complex-2_main.c
new file mode 100644
index 000000000..74eae6242
--- /dev/null
+++ b/tests/codegen/executable/gcc/struct-complex-2_main.c
@@ -0,0 +1,21 @@
+/* { dg-options "-O" } */
+
+#ifdef __x86_64__
+/* Test function argument passing. PR target/39678. */
+
+extern void struct_complex_2_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_complex_2_x ();
+ exit (0);
+}
+#else
+int
+main ()
+{
+ return 0;
+}
+#endif
diff --git a/tests/codegen/executable/gcc/symbol-range-tiny.c b/tests/codegen/executable/gcc/symbol-range-tiny.c
new file mode 100644
index 000000000..fc6a4f3ec
--- /dev/null
+++ b/tests/codegen/executable/gcc/symbol-range-tiny.c
@@ -0,0 +1,12 @@
+/* { dg-do link } */
+/* { dg-options "-O3 -save-temps -mcmodel=tiny" } */
+
+char fixed_regs[0x00080000];
+
+int
+main ()
+{
+ return fixed_regs[0x000ff000];
+}
+
+/* { dg-final { scan-assembler-not "adr\tx\[0-9\]+, fixed_regs\\\+" } } */
diff --git a/tests/codegen/executable/gcc/update-loopch.c b/tests/codegen/executable/gcc/update-loopch.c
new file mode 100644
index 000000000..a30b895bb
--- /dev/null
+++ b/tests/codegen/executable/gcc/update-loopch.c
@@ -0,0 +1,21 @@
+/* { dg-options "-O2 -fdump-ipa-profile-blocks-details -fdump-tree-switchlower1-blocks-details" } */
+int max = 33333;
+int a[8];
+int
+main ()
+{
+ int i;
+ for (i = 0; i < max; i++)
+ {
+ a[i % 8]++;
+ }
+ return 0;
+}
+/* Loop header copying will peel away the initial conditional, so the loop body
+ is once reached directly from entry point of function, rest via loopback
+ edge. */
+/* autofdo cannot do that precise counts */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "loop depth 1, count 33334" "profile"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump "loop depth 1, count 33333" "switchlower1"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump-not "loop depth 1, count 33332" "switchlower1"} } */
+/* { dg-final-use { scan-tree-dump-not "Invalid sum" "switchlower1"} } */
diff --git a/tests/codegen/executable/gcc/val-prof-1.c b/tests/codegen/executable/gcc/val-prof-1.c
new file mode 100644
index 000000000..8495c4caf
--- /dev/null
+++ b/tests/codegen/executable/gcc/val-prof-1.c
@@ -0,0 +1,22 @@
+/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized" } */
+int a[1000];
+int b = 256;
+int c = 257;
+int
+main ()
+{
+ int i;
+ int n;
+ for (i = 0; i < 1000; i++)
+ {
+ if (i % 17)
+ n = c;
+ else n = b;
+ a[i] /= n;
+ }
+ return 0;
+}
+/* autofdo does not do value profiling so far */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Transformation done: div.mod by constant 257" "profile"} } */
+/* { dg-final-use-not-autofdo { scan-tree-dump "if \\(n_\[0-9\]* != 257\\)" "optimized"} } */
+/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
diff --git a/tests/codegen/executable/gcc/val-prof-5.c b/tests/codegen/executable/gcc/val-prof-5.c
new file mode 100644
index 000000000..982bcb134
--- /dev/null
+++ b/tests/codegen/executable/gcc/val-prof-5.c
@@ -0,0 +1,17 @@
+/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile-optimized" } */
+int a[1000];
+int b=997;
+int
+main()
+{
+ int i;
+ for (i = 0; i < 1000; i++)
+ if (a[i] != 1)
+ a[i]/=b;
+ else
+ a[i]/=b;
+ return 0;
+}
+/* autofdo does not do value profiling so far */
+/* { dg-final-use-not-autofdo { scan-ipa-dump "Transformation done: div.mod by constant 997" "profile" } } */
+/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
diff --git a/tests/codegen/executable/gcc/vect-noalign.c b/tests/codegen/executable/gcc/vect-noalign.c
new file mode 100644
index 000000000..d507175cc
--- /dev/null
+++ b/tests/codegen/executable/gcc/vect-noalign.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-require-effective-target arm_neon_hw } */
+/* { dg-options "-O2 -fno-common -ftree-vectorize -mno-unaligned-access" } */
+/* { dg-add-options arm_neon } */
+
+
+/* Test for-mno-unaligned-access and -ftree-vectorize and results bus error. */
+#define N 128
+
+char ia[N];
+char ib[N+1];
+
+int main() {
+ int i;
+ for(i = 0; i < N; ++i) {
+ ia[i] = ib[i + 1];
+ }
+
+ return 0;
+}
+
diff --git a/tests/codegen/executable/gcc/zero-length-array.c b/tests/codegen/executable/gcc/zero-length-array.c
new file mode 100644
index 000000000..33f34d98a
--- /dev/null
+++ b/tests/codegen/executable/gcc/zero-length-array.c
@@ -0,0 +1,21 @@
+/* PR debug/86985 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+struct {
+ int foo;
+ int bar[0];
+} zla; /* Zero length array. */
+
+struct {
+ int foo;
+ int bar[];
+} fam; /* Flexible array member. */
+
+int
+main ()
+{
+ /* { dg-final { gdb-test . "type:zla" "struct { int foo; int bar[0]; }" } } */
+ /* { dg-final { gdb-test . "type:fam" "struct { int foo; int bar[]; }" } } */
+ return 0;
+}