I agree. If we add these, we should probably also add:
* LF/SF for floating-point, swapping between flw/fsw and fld/fsd depending on
the presence of the D extension. These will be illegal without F or D.
* LP/SP for pointers, swapping between lw/sw and ld/sd depending on ilp32 vs
lp64.
I'm OK with these names or the longer names (LXREG, LFREG, LPTR), but I don't
think just "L" and "S" sane names.
As Jim has mentioned before, it'll take a while for these to filter through the
various releases. For example, binutils-2.30 is pretty stable so people
probably won't update for a bit. As such, I'm also OK doing nothing here:
portable assembly will still need the various macros for a long time, and I
don't think we'll deprecate support for old binutils in any of the projects I
maintain just for this.
There's also the issue where just having the instructions pseudos will
frequently be insufficient. For example, most of the time I end up writing
this is when I'm saving/restoring registers to some buffer, where I currently
do something like
S_REG x1, 0*SZREG(base)
S_REG x2, 1*SZREG(base)
...
L_REG x1, 0*SZREG(base)
L_REG x2, 1*SZREG(base)
This would eliminate the L_REG/S_REG macros, but wouldn't help any with the
offsets. The pseudos also don't help much for C code, where it's simpler to
just let the complier propagate type sizes -- for example, here's the Linux
code
#define __get_user(x, ptr) \
({ \
register long __gu_err = 0; \
const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \
__chk_user_ptr(__gu_ptr); \
switch (sizeof(*__gu_ptr)) { \
case 1: \
__get_user_asm("lb", (x), __gu_ptr, __gu_err); \
break; \
case 2: \
__get_user_asm("lh", (x), __gu_ptr, __gu_err); \
break; \
case 4: \
__get_user_asm("lw", (x), __gu_ptr, __gu_err); \
break; \
case 8: \
__get_user_8((x), __gu_ptr, __gu_err); \
break; \
default: \
BUILD_BUG(); \
} \
__gu_err; \
})
That said, I'm not opposed to doing something here as the cost (particularly of
something like 'lxreg') is pretty low. This is at a point where someone should
propose a concrete extension to the RISC-V assembly manual so we can go
implement it :).