[Libre-soc-isa] [Bug 996] add shaddsw or replace shadduw with shaddsw since i32 indexes are waay more common than u32
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Tue Apr 18 09:45:31 BST 2023
https://bugs.libre-soc.org/show_bug.cgi?id=996
--- Comment #14 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #12)
> hum hum should add+1 be included?
>
> (or, more like 1<<sm)
well, if we're doing that, just do:
RT = (RA << sh) + RB + imm
or similar...this is what x86 lea supports (except with up to full 32-bit
immediate instead of a tiny immediate)
maybe 3-bit imm?
immediate not shifted because then sh is log2(struct_size) and imm is field
offset for struct S[]
e.g.:
struct S {
uint8_t a;
uint16_t b;
}
uint16_t *f(struct S *p, int i) {
return &p[i].b;
}
asm:
f:
shaddiw r3, r3, r4, 3, 2 # r3 = r3 + (r4 << 3) + 2
blr
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Libre-SOC-ISA
mailing list