This is for testing the x86 mangling of FMV versioned function assembly names.
gcc/testsuite/ChangeLog: * g++.target/i386/mv-symbols1.C: New test. * g++.target/i386/mv-symbols2.C: New test. * g++.target/i386/mv-symbols3.C: New test. * g++.target/i386/mv-symbols4.C: New test. * g++.target/i386/mv-symbols5.C: New test. * g++.target/i386/mvc-symbols1.C: New test. * g++.target/i386/mvc-symbols2.C: New test. * g++.target/i386/mvc-symbols3.C: New test. * g++.target/i386/mvc-symbols4.C: New test. Co-authored-by: Alfie Richards <alfie.richa...@arm.com> --- gcc/testsuite/g++.target/i386/mv-symbols1.C | 68 ++++++++++++++++++++ gcc/testsuite/g++.target/i386/mv-symbols2.C | 56 ++++++++++++++++ gcc/testsuite/g++.target/i386/mv-symbols3.C | 44 +++++++++++++ gcc/testsuite/g++.target/i386/mv-symbols4.C | 50 ++++++++++++++ gcc/testsuite/g++.target/i386/mv-symbols5.C | 56 ++++++++++++++++ gcc/testsuite/g++.target/i386/mvc-symbols1.C | 44 +++++++++++++ gcc/testsuite/g++.target/i386/mvc-symbols2.C | 29 +++++++++ gcc/testsuite/g++.target/i386/mvc-symbols3.C | 35 ++++++++++ gcc/testsuite/g++.target/i386/mvc-symbols4.C | 23 +++++++ 9 files changed, 405 insertions(+) create mode 100644 gcc/testsuite/g++.target/i386/mv-symbols1.C create mode 100644 gcc/testsuite/g++.target/i386/mv-symbols2.C create mode 100644 gcc/testsuite/g++.target/i386/mv-symbols3.C create mode 100644 gcc/testsuite/g++.target/i386/mv-symbols4.C create mode 100644 gcc/testsuite/g++.target/i386/mv-symbols5.C create mode 100644 gcc/testsuite/g++.target/i386/mvc-symbols1.C create mode 100644 gcc/testsuite/g++.target/i386/mvc-symbols2.C create mode 100644 gcc/testsuite/g++.target/i386/mvc-symbols3.C create mode 100644 gcc/testsuite/g++.target/i386/mvc-symbols4.C
diff --git a/gcc/testsuite/g++.target/i386/mv-symbols1.C b/gcc/testsuite/g++.target/i386/mv-symbols1.C new file mode 100644 index 00000000000..1290299aea5 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mv-symbols1.C @@ -0,0 +1,68 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target("default"))) +int foo () +{ + return 1; +} + +__attribute__((target("arch=slm"))) +int foo () +{ + return 3; +} + +__attribute__((target("sse4.2"))) +int foo () +{ + return 5; +} + +__attribute__((target("sse4.2"))) +int foo (int) +{ + return 6; +} + +__attribute__((target("arch=slm"))) +int foo (int) +{ + return 4; +} + +__attribute__((target("default"))) +int foo (int) +{ + return 2; +} + +int bar() +{ + return foo (); +} + +int bar(int x) +{ + return foo (x); +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mvc-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\n_Z3foov:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.arch_slm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.sse4.2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tcall\t_Z7_Z3foovv\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z7_Z3foovv, @gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z7_Z3foovv,_Z3foov\.resolver\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n_Z3fooi:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch_slm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.sse4.2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tcall\t_Z7_Z3fooii\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z7_Z3fooii, @gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z7_Z3fooii,_Z3fooi\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/g++.target/i386/mv-symbols2.C b/gcc/testsuite/g++.target/i386/mv-symbols2.C new file mode 100644 index 00000000000..8b75565d78d --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mv-symbols2.C @@ -0,0 +1,56 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target("default"))) +int foo () +{ + return 1; +} + +__attribute__((target("arch=slm"))) +int foo () +{ + return 3; +} + +__attribute__((target("sse4.2"))) +int foo () +{ + return 5; +} + +__attribute__((target("sse4.2"))) +int foo (int) +{ + return 6; +} + +__attribute__((target("arch=slm"))) +int foo (int) +{ + return 4; +} + +__attribute__((target("default"))) +int foo (int) +{ + return 2; +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mvc-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\n_Z3foov:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.arch_slm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.sse4.2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z7_Z3foovv, @gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z7_Z3foovv,_Z3foov\.resolver\n" 0 } } */ + +/* { dg-final { scan-assembler-times "\n_Z3fooi:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch_slm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.sse4.2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z7_Z3fooii, @gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z7_Z3fooii,_Z3fooi\.resolver\n" 0 } } */ diff --git a/gcc/testsuite/g++.target/i386/mv-symbols3.C b/gcc/testsuite/g++.target/i386/mv-symbols3.C new file mode 100644 index 00000000000..a5cf3445a43 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mv-symbols3.C @@ -0,0 +1,44 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target("default"))) +int foo (); + +__attribute__((target("arch=slm"))) +int foo (); + +__attribute__((target("sse4.2"))) +int foo (); + +__attribute__((target("sse4.2"))) +int foo (int); + +__attribute__((target("arch=slm"))) +int foo (int); + +__attribute__((target("default"))) +int foo (int); + +int bar() +{ + return foo (); +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mvc-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\n_Z3foov:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.arch_slm:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.sse4.2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tcall\t_Z7_Z3foovv\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z7_Z3foovv, @gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z7_Z3foovv,_Z3foov\.resolver\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n_Z3fooi:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch_slm:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.sse4.2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z7_Z3fooii, @gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z7_Z3fooii,_Z3fooi\.resolver\n" 0 } } */ diff --git a/gcc/testsuite/g++.target/i386/mv-symbols4.C b/gcc/testsuite/g++.target/i386/mv-symbols4.C new file mode 100644 index 00000000000..bb10f126f67 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mv-symbols4.C @@ -0,0 +1,50 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target("default"))) +int foo () +{ + return 1; +} + +__attribute__((target("arch=slm"))) +int foo (); + +__attribute__((target("sse4.2"))) +int foo (); + +__attribute__((target("sse4.2"))) +int foo (int); + +__attribute__((target("arch=slm"))) +int foo (int); + +__attribute__((target("default"))) +int foo (int) +{ + return 2; +} + +int bar() +{ + return foo (); +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mvc-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\n_Z3foov:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.arch_slm:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.sse4.2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tcall\t_Z7_Z3foovv\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z7_Z3foovv, @gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z7_Z3foovv,_Z3foov\.resolver\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n_Z3fooi:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch_slm:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.sse4.2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z7_Z3fooii, @gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z7_Z3fooii,_Z3fooi\.resolver\n" 0 } } */ diff --git a/gcc/testsuite/g++.target/i386/mv-symbols5.C b/gcc/testsuite/g++.target/i386/mv-symbols5.C new file mode 100644 index 00000000000..d36e4c304c2 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mv-symbols5.C @@ -0,0 +1,56 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target("default"))) +int foo (); + +__attribute__((target("arch=slm"))) +int foo () +{ + return 3; +} + +__attribute__((target("sse4.2"))) +int foo () +{ + return 5; +} + +__attribute__((target("sse4.2"))) +int foo (int) +{ + return 6; +} + +__attribute__((target("arch=slm"))) +int foo (int) +{ + return 4; +} + +__attribute__((target("default"))) +int foo (int); + +int bar() +{ + return foo (); +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mvc-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\n_Z3foov:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.arch_slm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.sse4.2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tcall\t_Z7_Z3foovv\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z7_Z3foovv, @gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z7_Z3foovv,_Z3foov\.resolver\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n_Z3fooi:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch_slm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.sse4.2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z7_Z3fooii, @gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z7_Z3fooii,_Z3fooi\.resolver\n" 0 } } */ diff --git a/gcc/testsuite/g++.target/i386/mvc-symbols1.C b/gcc/testsuite/g++.target/i386/mvc-symbols1.C new file mode 100644 index 00000000000..ea8c434c353 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mvc-symbols1.C @@ -0,0 +1,44 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target_clones("default", "arch=slm", "sse4.2"))) +int foo () +{ + return 1; +} + +__attribute__((target_clones("sse4.2", "arch=slm", "default"))) +int foo (int) +{ + return 2; +} + +int bar() +{ + return foo (); +} + +int bar(int x) +{ + return foo (x); +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mvc-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\n_Z3foov\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.arch_slm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.sse4_2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n_Z3fooi.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch_slm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.sse4_2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/g++.target/i386/mvc-symbols2.C b/gcc/testsuite/g++.target/i386/mvc-symbols2.C new file mode 100644 index 00000000000..84b54a980b3 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mvc-symbols2.C @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target_clones("default", "arch=slm", "sse4.2"))) +int foo () +{ + return 1; +} + +__attribute__((target_clones("sse4.2", "arch=slm", "default"))) +int foo (int) +{ + return 2; +} + +/* { dg-final { scan-assembler-times "\n_Z3foov\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.arch_slm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.sse4_2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n_Z3fooi.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch_slm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.sse4_2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/g++.target/i386/mvc-symbols3.C b/gcc/testsuite/g++.target/i386/mvc-symbols3.C new file mode 100644 index 00000000000..33927071028 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mvc-symbols3.C @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target_clones("default", "arch=slm", "sse4.2"))) +int foo (); + +__attribute__((target_clones("sse4.2", "arch=slm", "default"))) +int foo (int); + +int bar() +{ + return foo (); +} + +int bar(int x) +{ + return foo (x); +} + +/* { dg-final { scan-assembler-times "\n_Z3foov\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.arch_slm:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.sse4_2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n_Z3fooi.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch_slm:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.sse4_2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/g++.target/i386/mvc-symbols4.C b/gcc/testsuite/g++.target/i386/mvc-symbols4.C new file mode 100644 index 00000000000..ed9bc8f3e16 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mvc-symbols4.C @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target_clones("default", "arch=slm", "sse4.2"))) +int foo (); + +__attribute__((target_clones("sse4.2", "arch=slm", "default"))) +int foo (int); + +/* { dg-final { scan-assembler-times "\n_Z3foov\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.arch_slm:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.sse4_2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 0 } } */ + +/* { dg-final { scan-assembler-times "\n_Z3fooi.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch_slm:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.sse4_2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 0 } } */