Unnecessary UXTH after LDRH

Bug #1909184 reported by john on 2020-12-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
Undecided
Unassigned

Bug Description

When compiling the following code:

int dst;
void func(unsigned short volatile* src)
{
  dst = *src;
}

with "gcc -mcpu=cortex-m3 -O2" I get an unnecessary UXTH:

ldrh r3, [r0]
ldr r2, .L3
uxth r3, r3
str r3, [r2]
bx lr

The problem does not manifest itself if I omit "volatile" or replace "cortex-m3" with "cortex-m0".
I tested the latest release 10-2020-q4-major and the previous one.
See here: https://godbolt.org/z/K8Pjq7

john (jkovach) on 2020-12-24
description: updated

Ich bin bis 11.01. nicht im Haus und kann Ihre Nachricht daher leider nicht bearbeiten. In dringenden Fällen wenden Sie sich bitte an <email address hidden> bzw. für technische Fragen an <email address hidden>.

I am out of office until January 11th and won't be able to read your message. In urgent cases, please refer to <email address hidden> or for technical questions to <email address hidden>.

Mit freundlichen Grüßen / Best regards

Steffen Wolfer

--
Dipl.-Inform. Steffen Wolfer
Software Engineer Embedded Systems

WEISS ROBOTICS GmbH & Co. KG
Karl-Heinrich-Käferle-Str. 8
D-71640 Ludwigsburg, Germany

Phone: +49 7141 94702-22
Fax: +49 7141 94702-99
http://www.weiss-robotics.com

Sitz der Gesellschaft: Ludwigsburg
Registergericht Stuttgart, HRA725006

Pers. haftende Gesellschafterin:
Weiss Robotics Verwaltungs-GmbH, Sitz Ludwigsburg
Registergericht Stuttgart, HRB73310
Geschäftsführer: Dr. Karsten Weiß

Public bug reported:

When compiling the following code:

int dst;
void func(unsigned short volatile* src)
{
  dst = *src;
}

with "gcc -mcpu=cortex-m3 -O2" I get an unnecessary UXTH:

ldrh r3, [r0]
ldr r2, .L3
uxth r3, r3
str r3, [r2]
bx lr

The problem does not manifest itself if I omit "volatile" or replace "cortex-m3" with "cortex-m0".
I tested the latest release 10-2020-q4-major and the previous one.
See here: https://godbolt.org/z/K8Pjq7

** Affects: gcc-arm-embedded
     Importance: Undecided
         Status: New

** Description changed:

  When compiling the following code:

  int dst;
  void func(unsigned short volatile* src)
  {
- dst = *src;
+   dst = *src;
  }

  with "gcc -mcpu=cortex-m3 -O2" I get an unnecessary UXTH:

  ldrh r3, [r0]
  ldr r2, .L3
  uxth r3, r3
  str r3, [r2]
  bx lr

- The problem does not manifest itself if I omit "volatile" or replace "-mcpu" with "cortex-m0".
+ The problem does not manifest itself if I omit "volatile" or replace "cortex-m3" with "cortex-m0".
+ I tested the latest release 10-2020-q4-major and the previous one.
  See here: https://godbolt.org/z/K8Pjq7

--
You received this bug notification because you are subscribed to GNU Arm
Embedded Toolchain.
Matching subscriptions: Älles
https://bugs.launchpad.net/bugs/1909184

Title:
  Unnecessary UXTH after LDRH

Status in GNU Arm Embedded Toolchain:
  New

Bug description:
  When compiling the following code:

  int dst;
  void func(unsigned short volatile* src)
  {
    dst = *src;
  }

  with "gcc -mcpu=cortex-m3 -O2" I get an unnecessary UXTH:

  ldrh r3, [r0]
  ldr r2, .L3
  uxth r3, r3
  str r3, [r2]
  bx lr

  The problem does not manifest itself if I omit "volatile" or replace "cortex-m3" with "cortex-m0".
  I tested the latest release 10-2020-q4-major and the previous one.
  See here: https://godbolt.org/z/K8Pjq7

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc-arm-embedded/+bug/1909184/+subscriptions

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers