Page MenuHomePhabricator

[RISC-V] Do not crash when using -ftrapping-math
Needs ReviewPublic

Authored by kamleshbhalui on Jun 8 2020, 7:02 AM.



When using clang option -frapping-math, RISC-V backend crash.
This patch enable Lowering for strictp in riscv to get rid of crash.

Diff Detail

Event Timeline

kamleshbhalui created this revision.Jun 8 2020, 7:02 AM
luismarques added inline comments.Jun 8 2020, 7:34 AM

It's probably a good idea to use the hardfloat ABI, to cut down on the amount of GPR to FPR conversion instructions, etc.


Shouldn't this test also have an fcmps oeq case, showing the proper behavior in terms of NaN signaling, by using the correct RISC-V instruction for that? I haven't yet delved into the lowerSETCC implementation but it seems that having such tests here would clarify if this is correctly implemented.

kamleshbhalui marked an inline comment as done.Jun 8 2020, 8:28 AM
kamleshbhalui added inline comments.

thanks , will consider it in next diff update.

asb added a comment.Jun 9 2020, 12:58 AM

Disclaimer: I haven't swotted up on these constrained intrinsics to review the proposed lowering yet, but added a quick note on the setOperationAction calls. I agree with Luis the test cases would probably be easier to read if using the hard float ABI. I think you're lacking any test coverage for f32 as well.


Should the instances of MVT::i64 be XLenVT?

I also would have imagined it would make sense for these setOperationAction calls to be guarded on hasStdExtF/hasStdExtD appropriately. Is that not the case here?

enhanced and more testcases.

Jim added inline comments.Jun 15 2020, 10:34 PM

Don't delete blank line here.

kamleshbhalui marked an inline comment as done.Jun 16 2020, 4:45 AM
kamleshbhalui added inline comments.

ok, will fix it in next update

@asb and @luismarques do you suggest anything here ?

You will need to rebase past D80952, which made constrained fp a target opt-in - though in all honesty, with that patch, this patch is less of a priority as the compiler will not crash any more.

I still don't know how we (the reviewers) should work out whether the lowering of the constrained fp operators is "correct" or not, which is what's holding up this patch anyway.

rebased with the master.

kamleshbhalui marked 4 inline comments as done.Jul 30 2020, 2:29 AM
lenary resigned from this revision.Jan 14 2021, 10:00 AM
rkruppe removed a subscriber: rkruppe.Jan 14 2021, 10:19 AM