Bug 58133 - GCC should emit arm assembly following the unified syntax
Summary: GCC should emit arm assembly following the unified syntax
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-12 01:19 UTC by Sven
Modified: 2015-11-10 11:54 UTC (History)
1 user (show)

See Also:
Host:
Target: arm
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-08-19 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven 2013-08-12 01:19:12 UTC
I'm not aware of any command line switch to make gcc generate unified syntax. The asm code that gcc generated in thumb mode follows the old devided syntax. All documentation by Atmel these days is about the unified syntax. Also, binutils has decided to disassemble to unified syntax by default.

A code example and how to reproduce the issue is given below.

Command:
arm-softfloat-eabi-gcc -mcpu=arm7tdmi -O2 -mthumb -S -o - foo.c

Contents of foo.c:
int main() { return 0; }

Generated Assembly (devided syntax):
main:
	mov	r0, #0
	bx	lr

Disassembly (unified syntax):
00000000 <main>:
   0:	2000      	movs	r0, #0
   2:	4770      	bx	lr

According to the documentation, mov r0,#0 is not a valid 16bit command.
The documentation however assumes the unified syntax.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489i/Cihcdbca.html


It might be argued that the transition from classic to unified syntax is to error-prone or too much work. For me, it causes some trouble. I will have to switch between unified syntax and devided syntax in inline assembly since gcc uses devided and clang uses unified syntax.
Comment 1 Sven 2013-08-12 21:34:19 UTC
It seems, that for targets like -mcpu=cortex-m4 the gcc does generate unified syntax. So is the unified syntax only used for newer targets that use the thumb2 instruction set whereas the divided syntax is used for older thumb1 targets?
Comment 2 Richard Earnshaw 2013-08-19 09:58:14 UTC
Unified syntax is currently only supported for ARM and Thumb2 stated (for the latter it's mandatory).  Thumb1, for historical reasons, still uses the old syntax.

This is a known issue.
Comment 3 Sven 2013-08-19 10:39:12 UTC
(In reply to Richard Earnshaw from comment #2)
> This is a known issue.

So what needs to be done? Where do I find the source/configuration/whatever of the code generator for thumb mode?
Comment 4 Ramana Radhakrishnan 2015-06-24 21:24:43 UTC
Thumb1 Fixed for 5.0 with Terry's work - see release notes 
https://gcc.gnu.org/gcc-5/changes.html


ARM state is a bit more involved.
Comment 5 Ramana Radhakrishnan 2015-06-24 21:25:43 UTC
Oh and Kyrylo fixed up vfp.md last year too. So it's only ARM state that remains. I have a few patches in flight that I'm testing.
Comment 6 Ramana Radhakrishnan 2015-11-10 11:54:05 UTC
Fixed in ARM state by https://gcc.gnu.org/ml/gcc-cvs/2015-11/msg00242.html


The compiler now emits assembler completely in unified syntax, inline assembler follows divided syntax for legacy reasons but can be moved up.