MBlaze select_cc lowering question.

Can someone explain how the condition code is passed from the MBlazeTargetLowering::LowerSELECT_CC to MBlazeTargetLowering::EmitCustomSelect custom inserter? In LowerSELECT_CC the condition code is never accessed (Op.GetOperand(4)) and I don't see how it ends up getting correctly passed to the MBlazeTargetLowering::EmitCustomSelect.

The Microblaze code is far from obvious in that regard and I can't claim to be
overly familiar with it, but here's my understanding of what's going on:
LowerSELECT_CC() is actually not used; notice that there are no
custom operation action set for it. Instead the condition codes
are picked in MBlazeInstrInfo.td with pattern matching using
"magic" numbers to pick the correct MBlazeCC enum.
E.g.
// SELECT_CC
def : Pat<(selectcc (i32 GPR:$L), (i32 0),
                    (i32 GPR:$T), (i32 GPR:$F), SETEQ),
          (Select_CC GPR:$T, GPR:$F, GPR:$L, 1)>;

where the '1' = MBlazeCC::EQ

Stefan