]> 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>
Thu, 18 Jan 2024 09:21:12 +0000 (10:21 +0100)
commitd4a2d91b46b2cf758b249a4545e34287e90da23b
treea2f6609a3a7dab55abeed7cebae2bcd76afdf567
parentb4cb9c9606b421a1d95e9bdff7ec3e409a3e9a3b
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.
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]