herd / herdtools7

The Herd toolsuite to deal with .cat memory models (version 7.xx)
Other
215 stars 54 forks source link

[herd] SVE Vector ADD instruction does not operate element-wise #860

Closed maranget closed 2 months ago

maranget commented 3 months ago

In herd, the ADD instruction does not operate element wise. Consider:

AArch64 V26
{
uint64_t t[2] = {0xffffffffffffffff,0x0};
uint64_t u[2] = {0x1,0x0};
0:X0=t; 0:X1=u;
}
  P0                   ;
 PTRUE P0.D,VL2        ;
 LD1D {Z0.D},P0/Z,[X0] ;
 LD1D {Z1.D},P0/Z,[X1] ;
 ADD Z0.D,Z0.D,Z1.D    ;
 ST1D {Z0.D},P0,[X0]   ;
locations [t;]

Running the test on herd we see that the addition is performed globally on 128bit valiues:

% herd7 -variant sve V26.litmus
Test V26 Required
States 1
t={0x0,0x1};
...

However running on hardware (more exactly on qemu), additions are performed element-wise:

Test V26 Required
Histogram (1 states)
40    :>t={0x0,0x0};
...
murzinv commented 3 months ago

Thanks for report @maranget , I'll have a look.

murzinv commented 2 months ago

Fixed in #864

maranget commented 2 months ago

Issue solved, thanks @murzinv.