News for hackers. Stuff that matters.
Re:Fans of a 2013 Japanese soccer game tracked down a bizarr... by adwn on Tuesday September 07, 2021 @09:49AM (#28444820)
It seems the author gets a little bit confused by the FMA instructions:

> AArch64 nmadd equation is -(A * C) - B [...] Having an add instruction subtract is a curious decision from ARM [...] AArch64's nmsub equation is (A * C) - B, which isn't negated at all. Yet AArch64's msub is negated, for whatever reason, so we used that instead. We've learned not to question it.

Re-arrange those equations a bit, and you get:

    msub:   (b - ac)
    nmadd: -(b + ac)
    nmsub: -(b - ac)
And suddenly, it all makes sense :-)
Re:Fans of a 2013 Japanese soccer game tracked down a bizarr... by pm215 on Tuesday September 07, 2021 @11:53AM (#28446252)
In the spec, the pseudocode defines them as

   FMADD:   addend + ( op1 * op2)
   FMSUB:   addend + (-op1 * op2)
   FNMADD: -addend + (-op1 * op2)
   FNMSUB: -addend + ( op1 * op2)
which is to say that in all three cases the result is the output of a fused multiply-add; the difference is just whether (a) the addend and (b) op1 are negated before feeding them in.

IEEE 754-2008 only defines that you have to provide a fusedMultiplyAdd() operation, so it's up to the CPU architecture whether folding in the free negations is something they want to provide, and if so, where exactly the negation is done.

Re:Fans of a 2013 Japanese soccer game tracked down a bizarr... by masklinn on Tuesday September 07, 2021 @11:16AM (#28445888)
The negated variant make sense compared to the original, it's really the definition of msub which is strange, I would expect msub to subtract the last operand from the multiplication, not the other way around. The AMD64 mnemonics actually encode this order e.g. VFMADD213PDy is 2 * 1 + 3 (ba + c) while VFMADD132PDy is 1 * 3 + 2 (ac+b).

Though apparently the Dolphin folks disagree either way and interpret nmadd as (nm)add, rather than n(madd).

Re:Fans of a 2013 Japanese soccer game tracked down a bizarr... by pm215 on Tuesday September 07, 2021 @11:55AM (#28446265)
The Arm ARM says FNMADD is "Floating-point Negated fused Multiply-Add", so the position of the hyphens points strongly to "n(madd)" rather than "(nm)add".
Re:Fans of a 2013 Japanese soccer game tracked down a bizarr... by a1369209993 on Tuesday September 07, 2021 @05:36PM (#28450270)
> ARM says FNMADD is "Floating-point Negated fused Multiply-Add", so the position of the hyphens points

Never mind the hyphens, what do they think a "Negated fused Multiply" is?