This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Custom lowering of llvm.is.fpclass
ClosedPublic

Authored by liaolucy on Apr 24 2023, 7:16 AM.

Details

Summary

This patch supports FCLASS.S, FCLASS.H and FCLASS.D.

Diff Detail

Event Timeline

liaolucy created this revision.Apr 24 2023, 7:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2023, 7:16 AM
liaolucy requested review of this revision.Apr 24 2023, 7:16 AM
arsenm added a subscriber: arsenm.Apr 24 2023, 7:22 AM
arsenm added inline comments.
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
4222–4241

Converting the mask values should probably be a separate utility function

llvm/test/CodeGen/RISCV/float-intrinsics.ll
1229

Needs much more expensive test coverage. Can just copy another target's maybe

Can you add double and half to this patch? Doesn't seem like it would require very much additional code.

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
4216

Please put this in a separate function. We need to stop putting so much code into this switch.

llvm/lib/Target/RISCV/RISCVInstrInfo.h
278

Can you reverse the order here so we start with the least significant bit first.

llvm/lib/Target/RISCV/RISCVInstrInfoF.td
33

Don't use f32 here, you're going to need to change it for double and half. Just use SDTCisFP<1>

liaolucy updated this revision to Diff 516688.Apr 25 2023, 12:42 AM
liaolucy marked 5 inline comments as done.
  1. Add more expensive test
  2. Add FCLASS.H, FCLASS.D
  3. New LowerIS_FPCLASS function
liaolucy edited the summary of this revision. (Show Details)Apr 25 2023, 12:44 AM
craig.topper added inline comments.Apr 25 2023, 11:52 AM
llvm/lib/Target/RISCV/RISCVInstrInfo.h
269

Use static constexpr

liaolucy updated this revision to Diff 516999.Apr 25 2023, 5:42 PM

Use static constexpr

craig.topper added inline comments.Apr 25 2023, 6:00 PM
llvm/lib/Target/RISCV/RISCVInstrInfo.h
269

I think you lost the unsigned?

liaolucy updated this revision to Diff 517009.Apr 25 2023, 6:21 PM

Sorry, re-added unsigned

craig.topper added inline comments.Apr 25 2023, 6:35 PM
llvm/test/CodeGen/RISCV/float-intrinsics.ll
1546

clasee?

liaolucy updated this revision to Diff 517014.Apr 25 2023, 6:46 PM
liaolucy marked an inline comment as done.

isnotfinite_fpclasee -> isnotfinite_fpclass

craig.topper added inline comments.Apr 25 2023, 6:50 PM
llvm/test/CodeGen/RISCV/float-intrinsics.ll
1546

I don't think you fixed all the tests?

liaolucy updated this revision to Diff 517017.Apr 25 2023, 6:51 PM

isnotfinite_fpclasee -> isnotfinite_fpclass
Re-update, I don't know why I didn't modify it correctly just now

This revision is now accepted and ready to land.Apr 25 2023, 6:56 PM
This revision was landed with ongoing or failed builds.Apr 25 2023, 7:17 PM
This revision was automatically updated to reflect the committed changes.
arsenm added inline comments.Apr 26 2023, 8:55 AM
llvm/test/CodeGen/RISCV/float-intrinsics.ll
1580

No vector tests

liaolucy added inline comments.Apr 27 2023, 12:38 AM
llvm/test/CodeGen/RISCV/float-intrinsics.ll
1580

Thanks. This patch does not involve vectors, I will write another patch for vector support.