]> git.ipfire.org Git - thirdparty/gcc.git/commit
i386: Add -masm=intel profiling support [PR113122]
authorJakub Jelinek <jakub@redhat.com>
Thu, 18 Jan 2024 09:21:12 +0000 (10:21 +0100)
committerJakub Jelinek <jakub@redhat.com>
Sat, 2 Mar 2024 00:37:23 +0000 (01:37 +0100)
commit8b2a4022af095d1e4fadc2489d4b9ea13966ec5c
treed6c00debee166b690bb1c6fff65bf8a54b499643
parent432708c306838fe1444da0df7d629a60468c0c73
i386: Add -masm=intel profiling support [PR113122]

x86_function_profiler emits assembly directly into file and only emits
AT&T syntax.  The following patch adjusts it to emit MASM syntax
if -masm=intel.
As it doesn't use asm_fprintf, I can't use {|} syntax for the dialects.

I've tested using
for i in -mcmodel=large "-mcmodel=large -fpic" "" -fpic "-m32 -fpic" "-m32"; do
./xgcc -B ./ -c -O2 -fprofile $i -masm=att pr113122.c -o pr113122.o1;
./xgcc -B ./ -c -O2 -fprofile $i -masm=intel pr113122.c -o pr113122.o2;
objdump -dr pr113122.o1 > /tmp/1; objdump -dr pr113122.o2 > /tmp/2;
diff -up /tmp/1 /tmp/2; done
that the emitted sequences are identical after assembly.

2024-01-18  Jakub Jelinek  <jakub@redhat.com>

PR target/113122
* config/i386/i386.cc (x86_function_profiler): Add -masm=intel
support.  Add missing space after , in emitted assembly in some
cases.  Formatting fixes.

* gcc.target/i386/pr113122-1.c: New test.
* gcc.target/i386/pr113122-2.c: New test.
* gcc.target/i386/pr113122-3.c: New test.
* gcc.target/i386/pr113122-4.c: New test.

(cherry picked from commit d4a2d91b46b2cf758b249a4545e34287e90da23b)
gcc/config/i386/i386.cc
gcc/testsuite/gcc.target/i386/pr113122-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr113122-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr113122-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr113122-4.c [new file with mode: 0644]