[PATCH] D19475: [mips] Clang generates unaligned offset for MSA instruction st.d
Matija Amidžić via llvm-commits
llvm-commits at lists.llvm.org
Fri May 13 01:40:05 PDT 2016
mamidzic added inline comments.
================
Comment at: lib/Target/Mips/MipsSEISelDAGToDAG.cpp:488-492
@@ +487,7 @@
+ unsigned OffsetDiff = OffsetToAlignment(CnstOff, Align);
+ // If offset is not aligned, call selectAddrDefault
+ if(OffsetDiff)
+ return selectAddrDefault(Addr, Base, Offset);
+ }
+ }
+
----------------
dsanders wrote:
> Thanks.
>
> > I have done the fall back on selectAddrDefault() when the offset is wrong, but I'm not sure what did you mean with the last sentence. Could you elaborate a bit?
>
> The current code checks for an offset that is a simm10 and is a multiple of the alignment but it should be checking for a simm10/simm11/simm12/simm13 (depending on the alignment) that is a multiple of the alignment. To put this another way, we need to check that the offset is a multiple of the alignment and that `Offset / Alignment` is a simm10.
>
> For example, the offsets have to follow these constraints:
> | Instruction | >= | <= | Multiple of |
> | lw.b | -1024 | 1023 | 1 |
> | lw.h | -2048 | 2046 | 2 |
> | lw.w | -4096 | 4092 | 4 |
> | lw.d | -8192 | 8184 | 8 |
> but the current implementation implements these rules:
> | Instruction | >= | <= | Multiple of |
> | lw.b | -1024 | 1023 | 1 |
> | lw.h | -1024 | 1022 | 2 |
> | lw.w | -1024 | 1020 | 4 |
> | lw.d | -1024 | 1016 | 8 |
If I'm not mistaken, simm10 range is from -512 to 511 so I assumed you meant:
| Instruction | >= | <= | Multiple of |
| lw.b | -512| 511 | 1 |
| lw.h | -1024 | 1022 | 2 |
| lw.w | -2048 | 2044 | 4 |
| lw.d | -4096 | 4088 | 8 |
http://reviews.llvm.org/D19475
More information about the llvm-commits
mailing list