Il 18/03/2014 16:01, Peter Maydell ha scritto:
By whether the backend or the frontend has trivial access to the value to be able to avoid doing bad things if it's out of range. If either do, they can do a translate-time check to avoid issues. If neither does then we need the host CPU architecture to be OK with the out of range value, or we need to insert an explicit mask op in the backend (which is likely to be a duplicate of an explicit mask op already inserted at the frontend to get the frontend-target mandated behaviour for out of range ops).
Isn't that exactly what SPARC does? But the optimizer should be able to remove a redundant AND (not sure it is able to optimize & 255 & 31 to a single instruction, but it certainly can remove the second AND in "& 31 & 255").
Paolo