[Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code

2022-12-07 Thread zhangyuan21 at xiaomi dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

--- Comment #1 from zyfeier  ---
Created attachment 54045
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54045&action=edit
preprocessed file

[Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code

2022-12-07 Thread zhangyuan21 at xiaomi dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

--- Comment #2 from zyfeier  ---
C code:

int weak_function up_alarm_tick_start(clock_t ticks)
{
  int ret = -EAGAIN;

  if (g_oneshot_lower != NULL)
{
  clock_t now = 0;
  clock_t delta;

  ONESHOT_TICK_CURRENT(g_oneshot_lower, &now);
  delta = ticks - now;
  if ((sclock_t)delta < 0)
{
  delta = 0;
}

  ret = ONESHOT_TICK_START(g_oneshot_lower, oneshot_callback,
   NULL, delta);
}

  return ret;
}

Part of assembly code:
38020444 :
380204b8:   e592ldr r0, [r2]
380204bc:   e5932000ldr r2, [r3]
380204c0:   e154cmp r4, r0
380204c4:   e5931004ldr r1, [r3, #4]
380204c8:   21a04000movcs   r4, r0
380204cc:   e0940002addsr0, r4, r2
380204d0:   e2a11000adc r1, r1, #0
380204d4:   eb0038dabl  3802e844 

3802e844 :
3802e844:   e92d49f0push{r4, r5, r6, r7, r8, fp, lr}
3802e848:   e30e66f8movwr6, #59128  ; 0xe6f8
3802e84c:   e343689cmovtr6, #14492  ; 0x389c
3802e850:   e28db018add fp, sp, #24
3802e854:   e24dd024sub sp, sp, #36 ; 0x24
3802e858:   e5965000ldr r5, [r6]
3802e85c:   e59f31c0ldr r3, [pc, #448]  ; 3802ea24

3802e860:   e355cmp r5, #0
3802e864:   e5933000ldr r3, [r3]
3802e868:   e50b3020str r3, [fp, #-32]  ; 0xffe0
3802e86c:   e3a03000mov r3, #0
3802e870:   0a5ebeq 3802e9f0 
3802e874:   f2c00010vmov.i32d16, #0 ; 0x
3802e878:   e1a07000mov r7, r0
3802e87c:   e1a5mov r0, r5
3802e880:   e1a04001mov r4, r1
3802e884:   ed4b0b0dvstrd16, [fp, #-52] ; 0xffcc
3802e888:   eb004c98bl  38041af0 <__asan_load4_noabort>
3802e88c:   e5958000ldr r8, [r5]
3802e890:   e288001cadd r0, r8, #28
3802e894:   eb004c95bl  38041af0 <__asan_load4_noabort>
3802e898:   e598301cldr r3, [r8, #28]
3802e89c:   e353cmp r3, #0
3802e8a0:   0a21beq 3802e92c 
3802e8a4:   e24b1034sub r1, fp, #52 ; 0x34
3802e8a8:   e1a5mov r0, r5
3802e8ac:   e12fff33blx r3

Problem:
At 0x3802e874 d16 was cleared, but the calling function does not save this
register.

[Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code

2022-12-07 Thread zhangyuan21 at xiaomi dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

--- Comment #3 from zyfeier  ---
Created attachment 54046
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54046&action=edit
preprocessed file for calling function

[Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code

2022-12-08 Thread zhangyuan21 at xiaomi dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

--- Comment #4 from zyfeier  ---
Compile Information:

CC:  timers/arch_alarm.c
arm-none-eabi-gcc -c -Wstrict-prototypes -nostdlib -pipe "-O3"
-fno-strict-aliasing -fno-omit-frame-pointer -fno-optimize-sibling-calls
-fstack-protector-all -fsanitize=kernel-address -fno-common -Wall -Wshadow
-Wundef -ffunction-sections -fdata-sections -g -mcpu=cortex-a7 -mfloat-abi=hard
-mfpu=neon-vfpv4 -mlittle-endian-I. -isystem
/home/code/k03_dev/nuttx/include -D__NuttX__ -D__KERNEL__ -Wno-cpp -I
/home/code/k03_dev/nuttx/drivers/bch -I /home/code/k03_dev/nuttx/drivers/crypto
-I /home/code/nuttx/drivers/motor -I /home/code/nuttx/drivers/i2c -I
/home/code/nuttx/drivers/input -I /home/code/nuttx/drivers/ioexpander -I
/home/code/nuttx/drivers/lcd -I /home/code/nuttx/drivers/loop -I
/home/code/nuttx/drivers/mmcsd -I /home/code/nuttx/drivers/rptun -I
/home/code/nuttx/openamp/open-amp/lib -I /home/code/nuttx/drivers/sensors -I
/home/code/nuttx/drivers/usbhost -I /home/code/nuttx/drivers/video  
timers/arch_alarm.c -o  arch_alarm.o

[Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code

2022-12-08 Thread zhangyuan21 at xiaomi dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

--- Comment #5 from zyfeier  ---
Compile Information:

CC:  timers/arch_alarm.c
arm-none-eabi-gcc -c -Wstrict-prototypes -nostdlib -pipe "-O3"
-fno-strict-aliasing -fno-omit-frame-pointer -fno-optimize-sibling-calls
-fstack-protector-all -fsanitize=kernel-address -fno-common -Wall -Wshadow
-Wundef -ffunction-sections -fdata-sections -g -mcpu=cortex-a7 -mfloat-abi=hard
-mfpu=neon-vfpv4 -mlittle-endian-I. -isystem /home/code/nuttx/include
-D__NuttX__ -D__KERNEL__ -Wno-cpp -I /home/code/nuttx/drivers/bch -I
/home/code/nuttx/drivers/crypto -I /home/code/nuttx/drivers/motor -I
/home/code/nuttx/drivers/i2c -I /home/code/nuttx/drivers/input -I
/home/code/nuttx/drivers/ioexpander -I /home/code/nuttx/drivers/lcd -I
/home/code/nuttx/drivers/loop -I /home/code/nuttx/drivers/mmcsd -I
/home/code/nuttx/drivers/rptun -I /home/code/nuttx/openamp/open-amp/lib -I
/home/code/nuttx/drivers/sensors -I /home/code/nuttx/drivers/usbhost -I
/home/code/nuttx/drivers/video   timers/arch_alarm.c -o  arch_alarm.o

[Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code

2022-12-08 Thread rearnsha at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

Richard Earnshaw  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|UNCONFIRMED |RESOLVED

--- Comment #6 from Richard Earnshaw  ---
d16 is a call-clobbered register in the ABI. There is no need for the compiler
to save it before use.