Skip to content

Commit be94f37

Browse files
committed
address pr comments describing transformation
1 parent b90c08d commit be94f37

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/lib/Target/SPIRV/SPIRVPreLegalizerCombiner.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ namespace {
5050
#include "SPIRVGenPreLegalizeGICombiner.inc"
5151
#undef GET_GICOMBINER_TYPES
5252

53+
/// This match is part of a combine that
54+
/// rewrites length(X - Y) to distance(X, Y)
55+
/// (f32 (g_intrinsic length
56+
/// (g_fsub (vXf32 X) (vXf32 Y))))
57+
/// ->
58+
/// (f32 (g_intrinsic distance
59+
/// (vXf32 X) (vXf32 Y)))
60+
///
5361
bool matchLengthToDistance(MachineInstr &MI, MachineRegisterInfo &MRI) {
5462
if (MI.getOpcode() != TargetOpcode::G_INTRINSIC ||
5563
cast<GIntrinsic>(MI).getIntrinsicID() != Intrinsic::spv_length)

0 commit comments

Comments
 (0)