This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] A test for conditional binary ops.
ClosedPublic

Authored by mgudim on Jul 17 2023, 9:04 AM.

Details

Summary

Consider the following pattern:

%binop_ = binop %x, %y
%select_ = select %c, %binop_, %x

If there is an identity %identity operand for binop, it is possible to transform
the above code to:

%opearand = select %c, %y, %identity
%result = binop %x, %operand

This transformation is profitable when %identity is all zeroes or
ones.

This patch commits a test for such patterns.

This is a test for https://reviews.llvm.org/D155344

Diff Detail

Event Timeline

mgudim created this revision.Jul 17 2023, 9:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 9:04 AM
mgudim requested review of this revision.Jul 17 2023, 9:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 9:04 AM
mgudim edited the summary of this revision. (Show Details)Jul 17 2023, 9:06 AM

Can we add i32 versions of these tests?

mgudim updated this revision to Diff 541107.Jul 17 2023, 9:55 AM

added 32-bit versions
removed fadd and fsub because 0.0f is not an identity for these operations.

This revision is now accepted and ready to land.Jul 25 2023, 1:57 PM
This revision was landed with ongoing or failed builds.Jul 28 2023, 8:08 AM
This revision was automatically updated to reflect the committed changes.