Page MenuHomePhabricator

[RISCV] Add more cmov isel patterns to handle seteq/ne with a small non-zero immediate.

Authored by craig.topper on Jan 21 2021, 1:44 PM.



Similar to our free standing setcc patterns, we can use ADDI to
subtract the immediate from the other operand. Then the cmov
can check if the result is zero or non-zero.

Diff Detail

Event Timeline

craig.topper created this revision.Jan 21 2021, 1:44 PM
craig.topper requested review of this revision.Jan 21 2021, 1:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 21 2021, 1:44 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
mundaym accepted this revision.Jan 22 2021, 2:42 AM



Out of curiosity do you think it would make sense at some point to have a pass that just removes ADDI x, 0 (and XOR x, 0 etc.) after instruction selection? Then we could presumably delete the two patterns above.

This revision is now accepted and ready to land.Jan 22 2021, 2:42 AM