After D149063.
This patch adds support for both scalable and fixed-length vector.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vfclass.ll | ||
---|---|---|
12 | The result of vfclass can only have single bit set according to the scalar documentation "Note that exactly one bit in rd will be set. FCLASS.S does not set the floating-point exception flags." So it can never equal 768. |
llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td | ||
---|---|---|
2031 | Indent this 2 more spaces so it lines up with (vti.Vector on the previous line. |
Update try to address comments.
Use AND and SETNE.
Update test case.
If the changes are correct, then it seems that this patch is not needed:
testcase:
declare <2 x i1> @llvm.is.fpclass.v2f32(<2 x float>, i32) define <2 x i1> @isnan_v2f32(<2 x float> %x) nounwind { %1 = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %x, i32 3) ; nan ret <2 x i1> %1 }
Without this patch:
vsetivli zero, 2, e32, mf2, ta, ma vmfne.vv v8, v8, v8 vmor.mm v0, v8, v8
with the patch, we get:
vsetivli zero, 2, e32, mf2, ta, ma vfclass.v v8, v8 li a0, 768 vand.vx v8, v8, a0 vmsne.vi v0, v8, 0 ret
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
4389 | I did not find the scalable llvm.is.fpclass. |
The default expansion does know to create single instructions for some cases, but will probably generate worse code for mixing classes together. You should add more testing of different combinations of bits. Maybe we want to use fclass for some cases and default expansion for others.
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
4389 | I don't think the syntax in the LangRef is an exhaustive list. Have you tried it? |
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
4412 | This MVT::Other result looks unnecessary. Removed in 1fea6bd8777a800af8f67e5d67afe25a713a8926 |
Isn't VT an FP type here?