https://gcc.gnu.org/g:a60e825a1e0b59f58d2e88897a5ab8ca66e808a8
commit r17-1473-ga60e825a1e0b59f58d2e88897a5ab8ca66e808a8 Author: Iain Sandoe <[email protected]> Date: Sun May 31 19:47:26 2026 +0100 testsuite, c, x86, Darwin: Adjust func body scan tests for Darwin ABI/asm. In these cases, we need to add a second regex to match Darwin/Mach-O or to amend the use of symbols to include USER_LABEL_PREFIX. gcc/testsuite/ChangeLog: * gcc.target/i386/builtin-memmove-13.c: Add support for Mach-O. * gcc.target/i386/cf_check-11.c: Likewise. * gcc.target/i386/memcpy-pr120683-1.c: Likewise. * gcc.target/i386/memcpy-strategy-13.c: Likewise. * gcc.target/i386/memset-pr120683-10.c: Likewise. * gcc.target/i386/memset-pr120683-20.c: Likewise. * gcc.target/i386/memset-pr120683-21.c: Likewise. * gcc.target/i386/memset-strategy-27.c: Likewise. * gcc.target/i386/opt-comi-1.c: Likewise. * gcc.target/i386/pr111657-1.c: Likewise. * gcc.target/i386/pr122343-1a.c: Likewise. * gcc.target/i386/pr122343-1b.c: Likewise. * gcc.target/i386/pr122343-2a.c: Likewise. * gcc.target/i386/pr122343-2b.c: Likewise. * gcc.target/i386/pr122343-3.c: Likewise. * gcc.target/i386/pr122343-4a.c: Likewise. * gcc.target/i386/pr122343-4b.c: Likewise. * gcc.target/i386/pr122343-5a.c: Likewise. * gcc.target/i386/pr122343-5b.c: Likewise. * gcc.target/i386/pr122343-6a.c: Likewise. * gcc.target/i386/pr122343-6b.c: Likewise. * gcc.target/i386/pr122343-7.c: Likewise. * gcc.target/i386/pr122675-1.c: Likewise. * gcc.target/i386/pr125351.c: Likewise. * gcc.target/i386/pr125355-2.c: Likewise. * gcc.target/i386/pr125355.c: Likewise. * gcc.target/i386/pr92080-17.c: Likewise. * gcc.target/i386/prefetchi-1.c: Likewise. * gcc.target/i386/prefetchi-1b.c: Likewise. Signed-off-by: Iain Sandoe <[email protected]> Diff: --- gcc/testsuite/gcc.target/i386/builtin-memmove-13.c | 13 ++++++++- gcc/testsuite/gcc.target/i386/cf_check-11.c | 2 +- gcc/testsuite/gcc.target/i386/memcpy-pr120683-1.c | 32 ++++++++++++++++++++-- gcc/testsuite/gcc.target/i386/memcpy-strategy-13.c | 4 +-- gcc/testsuite/gcc.target/i386/memset-pr120683-10.c | 18 ++++++++++-- gcc/testsuite/gcc.target/i386/memset-pr120683-20.c | 26 ++++++++++++++++-- gcc/testsuite/gcc.target/i386/memset-pr120683-21.c | 26 ++++++++++++++++-- gcc/testsuite/gcc.target/i386/memset-strategy-27.c | 4 +-- gcc/testsuite/gcc.target/i386/opt-comi-1.c | 1 + gcc/testsuite/gcc.target/i386/pr111657-1.c | 24 ++++++++++++++-- gcc/testsuite/gcc.target/i386/pr122343-1a.c | 13 ++++++++- gcc/testsuite/gcc.target/i386/pr122343-1b.c | 14 +++++++++- gcc/testsuite/gcc.target/i386/pr122343-2a.c | 16 +++++++++-- gcc/testsuite/gcc.target/i386/pr122343-2b.c | 16 +++++++++-- gcc/testsuite/gcc.target/i386/pr122343-3.c | 13 +++++++-- gcc/testsuite/gcc.target/i386/pr122343-4a.c | 18 +++++++++++- gcc/testsuite/gcc.target/i386/pr122343-4b.c | 21 ++++++++++++-- gcc/testsuite/gcc.target/i386/pr122343-5a.c | 13 +++++++-- gcc/testsuite/gcc.target/i386/pr122343-5b.c | 16 +++++++++-- gcc/testsuite/gcc.target/i386/pr122343-6a.c | 21 ++++++++++++-- gcc/testsuite/gcc.target/i386/pr122343-6b.c | 23 ++++++++++++++-- gcc/testsuite/gcc.target/i386/pr122343-7.c | 16 +++++++++-- gcc/testsuite/gcc.target/i386/pr122675-1.c | 2 +- gcc/testsuite/gcc.target/i386/pr125351.c | 1 + gcc/testsuite/gcc.target/i386/pr125355-2.c | 4 +-- gcc/testsuite/gcc.target/i386/pr125355.c | 2 +- gcc/testsuite/gcc.target/i386/pr92080-17.c | 16 +++++++++-- gcc/testsuite/gcc.target/i386/prefetchi-1.c | 4 +-- gcc/testsuite/gcc.target/i386/prefetchi-1b.c | 4 +-- 29 files changed, 336 insertions(+), 47 deletions(-) diff --git a/gcc/testsuite/gcc.target/i386/builtin-memmove-13.c b/gcc/testsuite/gcc.target/i386/builtin-memmove-13.c index d25ebe74e116..4d11cd718fc4 100644 --- a/gcc/testsuite/gcc.target/i386/builtin-memmove-13.c +++ b/gcc/testsuite/gcc.target/i386/builtin-memmove-13.c @@ -1,7 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mno-avx -msse2 -mtune=generic -fno-pie" } */ /* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target { lp64 } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { lp64 && { ! *-*-darwin* } } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { lp64 && *-*-darwin* } } {^\t?\.} } } */ /* **foo: @@ -14,6 +15,16 @@ ** ret ** .cfi_endproc **... +*# + +*Dfoo: +*D movl 3\+_a\(%rip\), %eax +*D movl %eax, _a\(%rip\) +*D movzbl 7\+_a\(%rip\), %eax +*D movb %al, 4\+_a\(%rip\) +*D ret +*D... +*E */ char a[8] = "12345678"; diff --git a/gcc/testsuite/gcc.target/i386/cf_check-11.c b/gcc/testsuite/gcc.target/i386/cf_check-11.c index 9ed65ab0ad5d..7457eeb9484b 100644 --- a/gcc/testsuite/gcc.target/i386/cf_check-11.c +++ b/gcc/testsuite/gcc.target/i386/cf_check-11.c @@ -21,4 +21,4 @@ foo (void) { } -/* { dg-final { scan-assembler ".weak\[ \t\]_?foo" } } */ +/* { dg-final { scan-assembler ".weak(|_definition)\[ \t\]_?foo" } } */ diff --git a/gcc/testsuite/gcc.target/i386/memcpy-pr120683-1.c b/gcc/testsuite/gcc.target/i386/memcpy-pr120683-1.c index 753238e35fce..12d56c055ce4 100644 --- a/gcc/testsuite/gcc.target/i386/memcpy-pr120683-1.c +++ b/gcc/testsuite/gcc.target/i386/memcpy-pr120683-1.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mno-sse -mmemcpy-strategy=unrolled_loop:256:noalign,libcall:-1:noalign" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target lp64 } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { lp64 && { ! *-*-darwin* } } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { lp64 && *-*-darwin* } } {^\t?\.} } } */ /* **foo: @@ -31,6 +31,34 @@ ** jb .L[0-9]+ ** ret **... +*# + +*Dfoo: +*D movq 221\(%rsi\), %rax +*D xorl %edx, %edx +*D movq %rax, 221\(%rdi\) +*D movq 229\(%rsi\), %rax +*D movq %rax, 229\(%rdi\) +*D movq 237\(%rsi\), %rax +*D movq %rax, 237\(%rdi\) +*D movq 245\(%rsi\), %rax +*D movq %rax, 245\(%rdi\) +*D.L[0-9]+: +*D movl %edx, %eax +*D addl \$32, %edx +*D movq \(%rsi,%rax\), %r10 +*D cmpl \$224, %edx +*D movq 8\(%rsi,%rax\), %r9 +*D movq 16\(%rsi,%rax\), %r8 +*D movq 24\(%rsi,%rax\), %rcx +*D movq %r10, \(%rdi,%rax\) +*D movq %r9, 8\(%rdi,%rax\) +*D movq %r8, 16\(%rdi,%rax\) +*D movq %rcx, 24\(%rdi,%rax\) +*D jb .L[0-9]+ +*D ret +*D... +*E */ void diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-13.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-13.c index 109bd675a51b..773c919f18bf 100644 --- a/gcc/testsuite/gcc.target/i386/memcpy-strategy-13.c +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-13.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mtune=generic -mno-avx" } */ -/* { dg-final { scan-assembler "jmp\tmemcpy" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "call\tmemcpy" { target ia32 } } } */ +/* { dg-final { scan-assembler "jmp\t_?memcpy" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\t_?memcpy" { target ia32 } } } */ /* { dg-final { scan-assembler-not "rep movsb" } } */ void diff --git a/gcc/testsuite/gcc.target/i386/memset-pr120683-10.c b/gcc/testsuite/gcc.target/i386/memset-pr120683-10.c index 6d3d9e750e92..a450dbbe3364 100644 --- a/gcc/testsuite/gcc.target/i386/memset-pr120683-10.c +++ b/gcc/testsuite/gcc.target/i386/memset-pr120683-10.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mno-sse -mmemset-strategy=unrolled_loop:256:noalign,libcall:-1:noalign" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target lp64 } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { lp64 && { ! *-*-darwin* } } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { lp64 && *-*-darwin* } } {^\t?\.} } } */ /* **foo: @@ -17,6 +17,20 @@ ** movq \$0, 53\(%rdi\) ** ret **... +*# + +*Dfoo: +*D movq \$0, 29\(%rdi\) +*D movq \$0, 37\(%rdi\) +*D movq \$0, 45\(%rdi\) +*D movq \$0, 53\(%rdi\) +*D movq \$0, \(%rdi\) +*D movq \$0, 8\(%rdi\) +*D movq \$0, 16\(%rdi\) +*D movq \$0, 24\(%rdi\) +*D ret +*D... +*E */ void diff --git a/gcc/testsuite/gcc.target/i386/memset-pr120683-20.c b/gcc/testsuite/gcc.target/i386/memset-pr120683-20.c index 273e84c358e9..da72c62d0c89 100644 --- a/gcc/testsuite/gcc.target/i386/memset-pr120683-20.c +++ b/gcc/testsuite/gcc.target/i386/memset-pr120683-20.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -march=x86-64 -mmemset-strategy=vector_loop:256:noalign,libcall:-1:noalign -fno-pie" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target lp64 } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { lp64 && { ! *-*-darwin* } } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { lp64 && *-*-darwin* } } {^\t?\.} } } */ /* **foo: @@ -25,6 +25,28 @@ ** movd %xmm0, dest\+175\(%rip\) ** ret **... +*# + +*Dfoo: +*D movd %edi, %xmm0 +*D punpcklbw %xmm0, %xmm0 +*D punpcklwd %xmm0, %xmm0 +*D pshufd \$0, %xmm0, %xmm0 +*D movaps %xmm0, 160\+_dest\(%rip\) +*D movaps %xmm0, _dest\(%rip\) +*D movaps %xmm0, 16\+_dest\(%rip\) +*D movaps %xmm0, 32\+_dest\(%rip\) +*D movaps %xmm0, 48\+_dest\(%rip\) +*D movaps %xmm0, 64\+_dest\(%rip\) +*D movaps %xmm0, 80\+_dest\(%rip\) +*D movaps %xmm0, 96\+_dest\(%rip\) +*D movaps %xmm0, 112\+_dest\(%rip\) +*D movaps %xmm0, 128\+_dest\(%rip\) +*D movaps %xmm0, 144\+_dest\(%rip\) +*D movd %xmm0, 175\+_dest\(%rip\) +*D ret +*D... +*E */ char dest[179]; diff --git a/gcc/testsuite/gcc.target/i386/memset-pr120683-21.c b/gcc/testsuite/gcc.target/i386/memset-pr120683-21.c index 3e473267fd66..2cc30d55c124 100644 --- a/gcc/testsuite/gcc.target/i386/memset-pr120683-21.c +++ b/gcc/testsuite/gcc.target/i386/memset-pr120683-21.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -march=x86-64 -mmemset-strategy=vector_loop:256:noalign,libcall:-1:noalign -fno-pie" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target lp64 } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { lp64 && { ! *-*-darwin* } } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { lp64 && *-*-darwin* } } {^\t?\.} } } */ /* **foo: @@ -25,6 +25,28 @@ ** movaps %xmm0, dest\+160\(%rip\) ** ret **... +*# + +*Dfoo: +*D movd %edi, %xmm0 +*D movb %dil, 176\+_dest\(%rip\) +*D punpcklbw %xmm0, %xmm0 +*D punpcklwd %xmm0, %xmm0 +*D pshufd \$0, %xmm0, %xmm0 +*D movaps %xmm0, _dest\(%rip\) +*D movaps %xmm0, 16\+_dest\(%rip\) +*D movaps %xmm0, 32\+_dest\(%rip\) +*D movaps %xmm0, 48\+_dest\(%rip\) +*D movaps %xmm0, 64\+_dest\(%rip\) +*D movaps %xmm0, 80\+_dest\(%rip\) +*D movaps %xmm0, 96\+_dest\(%rip\) +*D movaps %xmm0, 112\+_dest\(%rip\) +*D movaps %xmm0, 128\+_dest\(%rip\) +*D movaps %xmm0, 144\+_dest\(%rip\) +*D movaps %xmm0, 160\+_dest\(%rip\) +*D ret +*D... +*E */ char dest[177]; diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-27.c b/gcc/testsuite/gcc.target/i386/memset-strategy-27.c index 685d6e5a5c21..57f25211bd27 100644 --- a/gcc/testsuite/gcc.target/i386/memset-strategy-27.c +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-27.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mtune=generic -mno-avx" } */ -/* { dg-final { scan-assembler "jmp\tmemset" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "call\tmemset" { target ia32 } } } */ +/* { dg-final { scan-assembler "jmp\t_?memset" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\t_?memset" { target ia32 } } } */ /* { dg-final { scan-assembler-not "rep stosb" } } */ void diff --git a/gcc/testsuite/gcc.target/i386/opt-comi-1.c b/gcc/testsuite/gcc.target/i386/opt-comi-1.c index fc7b8632004e..a2c5219d98df 100644 --- a/gcc/testsuite/gcc.target/i386/opt-comi-1.c +++ b/gcc/testsuite/gcc.target/i386/opt-comi-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mfpmath=sse -msse2" } */ +/* { dg-additional-options "-fno-unwind-tables -fno-asynchronous-unwind-tables" { target *-*-darwin* } } */ /* { dg-final { scan-assembler-times "comiss" 9 } } */ /* { dg-final { scan-assembler-times "set" 9 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr111657-1.c b/gcc/testsuite/gcc.target/i386/pr111657-1.c index 6e8516a30835..b499695f4263 100644 --- a/gcc/testsuite/gcc.target/i386/pr111657-1.c +++ b/gcc/testsuite/gcc.target/i386/pr111657-1.c @@ -1,7 +1,7 @@ /* { dg-do assemble } */ /* { dg-options "-O2 -mno-sse -mtune=generic -save-temps -fno-pie" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target lp64 } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { lp64 && { ! *-*-darwin* } } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { lp64 && *-*-darwin* } } {^\t?\.} } } */ /* **bar: @@ -20,6 +20,26 @@ ** cmpl \$224, %eax ** jb .L[0-9]+ **... +*# + +* Darwin caches the address of m in rax. +*Dbar: +*D... +*DL[0-9]+: +*D movl %edx, %ecx +*D addl \$32, %edx +*D movq %gs:\(%rax,%rcx\), %r10 +*D movq %gs:8\(%rax,%rcx\), %r9 +*D movq %gs:16\(%rax,%rcx\), %r8 +*D movq %gs:24\(%rax,%rcx\), %rsi +*D movq %r10, \(%rdi,%rcx\) +*D movq %r9, 8\(%rdi,%rcx\) +*D movq %r8, 16\(%rdi,%rcx\) +*D movq %rsi, 24\(%rdi,%rcx\) +*D cmpl \$224, %edx +*D jb L[0-9]+ +*D... +*E */ typedef unsigned long uword __attribute__ ((mode (word))); diff --git a/gcc/testsuite/gcc.target/i386/pr122343-1a.c b/gcc/testsuite/gcc.target/i386/pr122343-1a.c index 7076d8811747..12efa1b6848a 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-1a.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-1a.c @@ -2,7 +2,8 @@ /* { dg-options "-O2 -fomit-frame-pointer" } */ /* { dg-additional-options "-mregparm=1" { target ia32 } } */ /* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { *-*-darwin* && lp64 } } {^\t?\.} } } */ /* **foo: @@ -13,6 +14,16 @@ ** ret ** .cfi_endproc **... +*# + +* Darwin indirects the extern +*Dfoo: +*D movq _bar@GOTPCREL\(%rip\), %rdx +*D imull \$123, %edi, %eax +*D addl \(%rdx\), %eax +*D ret +*D... +*E */ extern volatile int bar; diff --git a/gcc/testsuite/gcc.target/i386/pr122343-1b.c b/gcc/testsuite/gcc.target/i386/pr122343-1b.c index 989d3b23a78f..a687ce7bf419 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-1b.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-1b.c @@ -2,7 +2,8 @@ /* { dg-options "-O2 -fomit-frame-pointer -fno-fuse-ops-with-volatile-access" } */ /* { dg-additional-options "-mregparm=1" { target ia32 } } */ /* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { *-*-darwin* && lp64 } } {^\t?\.} } } */ /* **foo: @@ -14,6 +15,17 @@ ** ret ** .cfi_endproc **... +*# + +* Darwin indirects the extern +*Dfoo: +*D movq _bar@GOTPCREL\(%rip\), %rax +*D movl \(%rax\), %edx +*D imull \$123, %edi, %eax +*D addl %edx, %eax +*D ret +*D... +*E */ #include "pr122343-1a.c" diff --git a/gcc/testsuite/gcc.target/i386/pr122343-2a.c b/gcc/testsuite/gcc.target/i386/pr122343-2a.c index f7ee02149ce6..6683b8e4a399 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-2a.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-2a.c @@ -1,7 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fomit-frame-pointer" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ +/* { dg-add-options check_function_bodies } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target *-*-darwin* } {^\t?\.} } } */ /* **foo: @@ -12,6 +13,17 @@ ** ret ** .cfi_endproc **... +*# + +* Darwin indirects accesses to externs. +*Dfoo: +*D movq _bar1@GOTPCREL\(%rip\), %rax +*D movq _bar2@GOTPCREL\(%rip\), %rdx +*D movl \(%rax\), %eax +*D addl \(%rdx\), %eax +*D ret +*D... +*E */ extern volatile int bar1, bar2; diff --git a/gcc/testsuite/gcc.target/i386/pr122343-2b.c b/gcc/testsuite/gcc.target/i386/pr122343-2b.c index d4a1151a5862..2472f50c8fe6 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-2b.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-2b.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fomit-frame-pointer -fno-fuse-ops-with-volatile-access" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target *-*-darwin* } {^\t?\.} } } */ /* **foo: @@ -13,6 +13,18 @@ ** ret ** .cfi_endproc **... +*# +* +* Darwin indirects accesses to externs. +*Dfoo: +*D movq _bar1@GOTPCREL\(%rip\), %rax +*D movq _bar2@GOTPCREL\(%rip\), %rdx +*D movl \(%rax\), %eax +*D movl \(%rdx\), %edx +*D addl %edx, %eax +*D ret +*D... +*E */ #include "pr122343-2a.c" diff --git a/gcc/testsuite/gcc.target/i386/pr122343-3.c b/gcc/testsuite/gcc.target/i386/pr122343-3.c index 335f777d2a9a..7ff957825eb5 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-3.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-3.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fomit-frame-pointer" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { *-*-darwin* && lp64 } } {^\t?\.} } } */ /* **foo: @@ -11,6 +11,15 @@ ** ret ** .cfi_endproc **... +*# + +* Darwin indirects the extern. +*Dfoo: +*D movq _bar@GOTPCREL\(%rip\), %rax +*D addl \$123, \(%rax\) +*D ret +*D... +*E */ extern volatile int bar; diff --git a/gcc/testsuite/gcc.target/i386/pr122343-4a.c b/gcc/testsuite/gcc.target/i386/pr122343-4a.c index 3ae07a27cf1c..2426742b6d2d 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-4a.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-4a.c @@ -1,7 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fomit-frame-pointer" } */ /* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { *-*-darwin* && lp64 } } {^\t?\.} } } */ /* **foo: @@ -17,6 +18,21 @@ ** ret ** .cfi_endproc **... +*# + +* Darwin indirects the extern. +*Dfoo: +*D movq _bar@GOTPCREL\(%rip\), %rdx +*D movl \(%rdx\), %eax +*D movl \(%rdx\), %eax +*D... +*D barrier +*D... +*D addl \(%rdx\), %eax +*D subl \(%rdx\), %eax +*D ret +*D... +*E */ extern volatile int bar; diff --git a/gcc/testsuite/gcc.target/i386/pr122343-4b.c b/gcc/testsuite/gcc.target/i386/pr122343-4b.c index 31a990eb3630..45f75b3e484a 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-4b.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-4b.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fomit-frame-pointer -fno-fuse-ops-with-volatile-access" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { *-*-darwin* && lp64 } } {^\t?\.} } } */ /* **foo: @@ -19,6 +19,23 @@ ** ret ** .cfi_endproc **... +*# + +* Darwin indirects extern accesses +*Dfoo: +*D movq _bar@GOTPCREL\(%rip\), %rdx +*D movl \(%rdx\), %eax +*D movl \(%rdx\), %eax +*D... +*D barrier +*D... +*D movl \(%rdx\), %ecx +*D movl \(%rdx\), %edx +*D addl %ecx, %eax +*D subl %edx, %eax +*D ret +*D... +*E */ #include "pr122343-4a.c" diff --git a/gcc/testsuite/gcc.target/i386/pr122343-5a.c b/gcc/testsuite/gcc.target/i386/pr122343-5a.c index 3d133b671577..b093ff05d48b 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-5a.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-5a.c @@ -1,8 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fomit-frame-pointer" } */ /* { dg-additional-options "-mregparm=1" { target ia32 } } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { *-*-darwin* && lp64 } } {^\t?\.} } } */ /* **foo: @@ -13,6 +13,15 @@ ** ret ** .cfi_endproc **... +*# + +* Darwin indirects extern accesses +*Dfoo: +*D movq _bar@GOTPCREL\(%rip\), %rax +*D imull \$123, %edi, %edi +*D addl %edi, \(%rax\) +*D ret +*E */ extern volatile int bar; diff --git a/gcc/testsuite/gcc.target/i386/pr122343-5b.c b/gcc/testsuite/gcc.target/i386/pr122343-5b.c index 5f64496d6f45..16e8f05eaa3b 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-5b.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-5b.c @@ -1,8 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fomit-frame-pointer -fno-fuse-ops-with-volatile-access" } */ /* { dg-additional-options "-mregparm=1" { target ia32 } } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { *-*-darwin* && lp64 } } {^\t?\.} } } */ /* **foo: @@ -15,6 +15,18 @@ ** ret ** .cfi_endproc **... +*# + +* Darwin indirects extern accesses +*Dfoo: +*D movq _bar@GOTPCREL\(%rip\), %rax +*D imull \$123, %edi, %edi +*D movl \(%rax\), %edx +*D addl %edx, %edi +*D movl %edi, \(%rax\) +*D ret +*D... +*E */ #include "pr122343-5a.c" diff --git a/gcc/testsuite/gcc.target/i386/pr122343-6a.c b/gcc/testsuite/gcc.target/i386/pr122343-6a.c index 940182644c7e..cdc4e5d2a462 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-6a.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-6a.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fomit-frame-pointer" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target { *-*-* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { *-*-darwin* && lp64 } } {^\t?\.} } } */ /* **foo: @@ -20,6 +20,23 @@ ** ret ** .cfi_endproc **... +*# +* Darwin indirects extern accesses +*Dfoo: +*D movq _bar@GOTPCREL\(%rip\), %rax +*D movl \(%rax\), %edx +*D movl \(%rax\), %edx +*D imull \$123, %edx, %ecx +*D movl %ecx, \(%rax\) +*D... +*D barrier +*D... +*D movl \(%rax\), %ecx +*D addl %ecx, %edx +*D subl %edx, \(%rax\) +*D ret +*D... +*E */ extern volatile int bar; diff --git a/gcc/testsuite/gcc.target/i386/pr122343-6b.c b/gcc/testsuite/gcc.target/i386/pr122343-6b.c index f741f5ca98c7..dc9adc14a451 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-6b.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-6b.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fomit-frame-pointer -fno-fuse-ops-with-volatile-access" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { *-*-darwin* && lp64 } } {^\t?\.} } } */ /* **foo: @@ -22,6 +22,25 @@ ** ret ** .cfi_endproc **... +*# +* Darwin indirects extern accesses +*Dfoo: +*D movq _bar@GOTPCREL\(%rip\), %rax +*D movl \(%rax\), %edx +*D movl \(%rax\), %edx +*D imull \$123, %edx, %ecx +*D movl %ecx, \(%rax\) +*D... +*D barrier +*D... +*D movl \(%rax\), %esi +*D movl \(%rax\), %ecx +*D addl %esi, %edx +*D subl %edx, %ecx +*D movl %ecx, \(%rax\) +*D ret +*D... +*E */ #include "pr122343-6a.c" diff --git a/gcc/testsuite/gcc.target/i386/pr122343-7.c b/gcc/testsuite/gcc.target/i386/pr122343-7.c index 0e4edd1e5e71..97cee196c036 100644 --- a/gcc/testsuite/gcc.target/i386/pr122343-7.c +++ b/gcc/testsuite/gcc.target/i386/pr122343-7.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fomit-frame-pointer" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target *-*-* } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { ! *-*-darwin* } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { *-*-darwin* && lp64 } } {^\t?\.} } } */ /* **test: @@ -15,6 +15,18 @@ ** ret ** .cfi_endproc **... +*# + +*Dtest: +*D movq _u8@GOTPCREL\(%rip\), %rax +*D movzbl \(%rax\), %edx +*D addb %dl, \(%rax\) +*D movzbl \(%rax\), %edx +*D subb \(%rax\), %dl +*D movb %dl, \(%rax\) +*D ret +*D... +*E */ extern volatile unsigned char u8; diff --git a/gcc/testsuite/gcc.target/i386/pr122675-1.c b/gcc/testsuite/gcc.target/i386/pr122675-1.c index 9239a3208556..d51a5f96b896 100644 --- a/gcc/testsuite/gcc.target/i386/pr122675-1.c +++ b/gcc/testsuite/gcc.target/i386/pr122675-1.c @@ -12,7 +12,7 @@ ** je .L[0-9]* ** subq \$[0-9]*, %rsp ** .cfi_def_cfa_offset [0-9]* -** call f1 +** call _?f1 ** addq \$[0-9]*, %rsp ** .cfi_def_cfa_offset [0-9]* ** ret diff --git a/gcc/testsuite/gcc.target/i386/pr125351.c b/gcc/testsuite/gcc.target/i386/pr125351.c index f21adcae44a3..95081b864f26 100644 --- a/gcc/testsuite/gcc.target/i386/pr125351.c +++ b/gcc/testsuite/gcc.target/i386/pr125351.c @@ -1,3 +1,4 @@ /* { dg-do compile } */ /* { dg-options "-mptwrite -masm=intel" } */ +/* { dg-skip-if "no intel asm" *-*-darwin* "" "" } */ void foo() { __builtin_ia32_ptwrite32(0); } diff --git a/gcc/testsuite/gcc.target/i386/pr125355-2.c b/gcc/testsuite/gcc.target/i386/pr125355-2.c index 2c0c396d8967..719c93c69a7b 100644 --- a/gcc/testsuite/gcc.target/i386/pr125355-2.c +++ b/gcc/testsuite/gcc.target/i386/pr125355-2.c @@ -6,8 +6,8 @@ /* **foo.cold: **... -** call memmove -** call abort +** call _?memmove +** call _?abort ** .cfi_endproc **... */ diff --git a/gcc/testsuite/gcc.target/i386/pr125355.c b/gcc/testsuite/gcc.target/i386/pr125355.c index 8e56b5f5507b..7509852be03f 100644 --- a/gcc/testsuite/gcc.target/i386/pr125355.c +++ b/gcc/testsuite/gcc.target/i386/pr125355.c @@ -7,7 +7,7 @@ **foo: **.LFB0: ** .cfi_startproc -** jmp memmove +** jmp _?memmove ** .cfi_endproc **... */ diff --git a/gcc/testsuite/gcc.target/i386/pr92080-17.c b/gcc/testsuite/gcc.target/i386/pr92080-17.c index f3d6b6917546..8c1c4d0a1c6e 100644 --- a/gcc/testsuite/gcc.target/i386/pr92080-17.c +++ b/gcc/testsuite/gcc.target/i386/pr92080-17.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -march=x86-64-v3" } */ -/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ -/* { dg-final { check-function-bodies "**" "" "" { target { ! ia32 } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "**" "*#" "" { target { { ! ia32 } && { ! *-*-darwin* } } } {^\t?\.} } } */ +/* { dg-final { check-function-bodies "*D" "*E" "" { target { lp64 && *-*-darwin* } } {^\t?\.} } } */ /* **foo: @@ -12,6 +12,18 @@ ** vmovdqu %xmm0, cost2\(%rip\) ** ret **... +*# + +*Dfoo: +*D movq _cost@GOTPCREL\(%rip\), %rax +*D vpbroadcastw \(%rax\), %xmm0 +*D movq _cost1@GOTPCREL\(%rip\), %rax +*D vmovq %xmm0, \(%rax\) +*D movq _cost2@GOTPCREL\(%rip\), %rax +*D vmovdqu %xmm0, \(%rax\) +*D ret +*D... +*E */ extern struct { diff --git a/gcc/testsuite/gcc.target/i386/prefetchi-1.c b/gcc/testsuite/gcc.target/i386/prefetchi-1.c index 03dfdc55e86c..e63f25530e14 100644 --- a/gcc/testsuite/gcc.target/i386/prefetchi-1.c +++ b/gcc/testsuite/gcc.target/i386/prefetchi-1.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-mprefetchi -O2" } */ -/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit0\[ \\t\]+bar\\(%rip\\)" 2 } } */ -/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit1\[ \\t\]+bar\\(%rip\\)" 2 } } */ +/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit0\[ \\t\]+_?bar\\(%rip\\)" 2 } } */ +/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit1\[ \\t\]+_?bar\\(%rip\\)" 2 } } */ #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/i386/prefetchi-1b.c b/gcc/testsuite/gcc.target/i386/prefetchi-1b.c index 93139554d3cd..832c0240bb22 100644 --- a/gcc/testsuite/gcc.target/i386/prefetchi-1b.c +++ b/gcc/testsuite/gcc.target/i386/prefetchi-1b.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-mprefetchi -O0" } */ -/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit0\[ \\t\]+bar\\(%rip\\)" 1 } } */ -/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit1\[ \\t\]+bar\\(%rip\\)" 1 } } */ +/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit0\[ \\t\]+_?bar\\(%rip\\)" 1 } } */ +/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit1\[ \\t\]+_?bar\\(%rip\\)" 1 } } */ #include <x86intrin.h>
