2020-12-24 06:28:55 |
john |
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 "-mcpu" with "cortex-m0".
See here: https://godbolt.org/z/K8Pjq7 |
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 |
|