Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp | ||
---|---|---|
72 | As Table 1 described, revb.2h is available on LA32. | |
llvm/test/CodeGen/LoongArch/bswap.ll | ||
3 | The standard way is to use two dashes. llc --help | grep mtriple --mtriple=<string> - Override target triple for module And --verify-machineinstrs: llc --help-hidden | grep verify-machineinstrs --verify-machineinstrs - Verify generated machine code And --check-prefix: FileCheck --help | grep check-prefix --check-prefix=<string> - Prefix to use from check file (defaults to 'CHECK') | |
34–40 | How about: revb.2h $a0, $a0 rotri.w $a0, 16 |
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp | ||
---|---|---|
72 | I looked at the original document《龙芯架构 32 位精简版参考手册》 which doesn't contain this instruction, maybe it's because it's actually describing the LA32 Primary ISA? But apparently it described way more instructions than the tiny subset suitable for university courses. I'll change anyway. Thanks for the fact checking. | |
llvm/test/CodeGen/LoongArch/bswap.ll | ||
34–40 | As revb.2h can be used in this case, I'll change this. Thanks. |
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp | ||
---|---|---|
72 | Although it's really weird that REVB.W isn't being listed, even though it doesn't involve any operation wider than 32 bits... Maybe there are hardware implementation concerns but I'm not a HW designer so my intuition can fail me. Anyway rotri.w works. |
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp | ||
---|---|---|
72 |
My bad; there isn't REVB.W but only REVB.2W. LoongArch is not orthogonal... (many swear words omitted) |
Other parts LGTM.
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp | ||
---|---|---|
159 | Another approach: let Predicates = [IsLA32] in { def : Pat<(bswap GPR:$rj), (ROTRI_W (REVB_2H GPR:$rj), 16)>; } I'm not sure which approach is better. But this one uses less code. |
I submitted too early after realizing tblgen could be used for bswap.i32 on LA32, fixed anyway. Thanks for the suggestion.
As Table 1 described, revb.2h is available on LA32.
So for i16, we can use it.