Continuing the theme of adding branchless lowerings for simple selects, this time handle the 0 arm case. This is very common for various umin idioms, etc..
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
9505 | Too much copy/paste. :) This should be isNullConstant |
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
9505 | Eek, how did I miss that? I swear I looked at the test diffs too! |
Address bug caught by @craig.topper. Due to copy paste mistake, second case was dead code. With fix, impact is even broader, including making many floating point conversion idioms branchless.
Is the branchless form better though? Branch+move can be fused but these forms can't and have more instructions to execute.
We need an mtune flag for CPUs that can fuse these like sifive-7-series. But we also need to implement a fusion guarantee too so that code motion doesn't sinks things into the basic block and break fusion. I assume rocket doesn't fuse these?
llvm/test/CodeGen/RISCV/double-convert.ll | ||
---|---|---|
97 | This is interesting. The seqz isn't necessary. I'll take a look at this. |
LGTM. I think this is a good starting point. I have a followup I'm going to try to fix the issue I noticed, but that shouldn't block this.
Too much copy/paste. :) This should be isNullConstant