Created attachment 171101 [details] Minimal reproducer: fp-valgrind-test.c Hello, I was investigating a debian bug, where the continuous integration failed because it receives a different value when running with valgrind. [1071656] I could track it down to a fcvtas instruction. => 0xaaaaaaaa4948 <ConvertToRational+104>: fcvtas w5, d8 (With $d8=322.5) With plain GDB: (gdb) print $w5 $2 = 323 With valgrind+GDB: (gdb) print $w5 $2 = 322 Attached is a minimal reproducer. [1071656] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1071656
Created attachment 171102 [details] 0001-arm64-Fix-fcvtas-instruction.patch I tried to look into it and I think the issue is the `fcvtas` gets stored in the intermediate representation with Irrm_NEAREST. When this gets translated back to the native instruction i guess it results in a `fcvtns`. Attached patch tries to preserve this difference by using Irrm_NEAREST_TIE_AWAY_0, at least the reproducer shows with it no longer a difference.
Looks good. One problem with the regtests is that a lot of the numeric tests just use random number generators. That means that they don't cover rounding with ties very well. This also needs doing for the vector version, as noted here case 3: ch = 'a'; irrm = Irrm_NEAREST; break; /* kludge? */ I'll see if I can also knock up a test that covers all 8 combinations of float/double and signed/unsigned scalar.
Pushed with a small change to use True and False rather than 1 and 0. I'll add a couple of tests as well. commit de4c79ffbcd2d5e89495cee8feadf77d5f3a6ef2 (HEAD -> master, origin/master, origin/HEAD) Author: Bernhard <C3><9C>belacker <bernhardu@mailbox.org> Date: Thu Jun 27 22:51:09 2024 +0200 arm64: Fix fcvtas instruction.