Repository: llvm/llvm-project
File: llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp (C++)

Code before:
  bool selectWaveReduceMax(Register ResVReg, SPIRVTypeInst ResType,
                           MachineInstr &I, bool IsUnsigned) const;

  bool selectWaveReduceMin(Register ResVReg, SPIRVTypeInst ResType,
                           MachineInstr &I, bool IsUnsigned) const;

  bool selectWaveReduceSum(Register ResVReg, SPIRVTypeInst ResType,
                           MachineInstr &I) const;

  template <typename PickOpcodeFn>
  bool selectWaveExclusiveScan(Register ResVReg, SPIRVTypeInst ResType,
                               MachineInstr &I, bool IsUnsigned,
                               PickOpcodeFn &&PickOpcode) const;

  bool selectWaveExclusiveScanSum(Register ResVReg, SPIRVTypeInst ResType,
                                  MachineInstr &I) const;

  bool selectWaveExclusiveScanProduct(Register ResVReg, SPIRVTypeInst ResType,
                                      MachineInstr &I) const;

  bool selectConst(Register ResVReg, SPIRVTypeInst ResType,
                   MachineInstr &I) const;

  bool selectSelect(Register ResVReg, SPIRVTypeInst ResType,
                    MachineInstr &I) const;
  bool selectExtendBool(Register ResVReg, SPIRVTypeInst ResType,
                        MachineInstr &I, bool IsSigned) const;
  bool selectIToF(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                  bool IsSigned, unsigned Opcode) const;
  bool selectExt(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                 bool IsSigned) const;

  bool selectTrunc(Register ResVReg, SPIRVTypeInst ResType,
                   MachineInstr &I) const;

  bool selectSUCmp(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                   bool IsSigned) const;

  bool selectIntToBool(Register IntReg, Register ResVReg, MachineInstr &I,
                       SPIRVTypeInst intTy, SPIRVTypeInst boolTy) const;

  bool selectOpUndef(Register ResVReg, SPIRVTypeInst ResType,
                     MachineInstr &I) const;
  bool selectFreeze(Register ResVReg, SPIRVTypeInst ResType,
                    MachineInstr &I) const;
  bool selectIntrinsic(Register ResVReg, SPIRVTypeInst ResType,
                       MachineInstr &I) const;
  bool selectExtractVal(Register ResVReg, SPIRVTypeInst ResType,
                        MachineInstr &I) const;
  bool selectInsertVal(Register ResVReg, SPIRVTypeInst ResType,
                       MachineInstr &I) const;

Review comment (bug):
If we are going to do a better name this is wrong OpSelectSISCond and OpSelectVIVCond are integer selects
```suggestion
  bool  selecBoolToIntSelect(Register ResVReg, SPIRVTypeInst ResType,
```

Code after:
  bool selectWaveReduceMax(Register ResVReg, SPIRVTypeInst ResType,
                           MachineInstr &I, bool IsUnsigned) const;

  bool selectWaveReduceMin(Register ResVReg, SPIRVTypeInst ResType,
                           MachineInstr &I, bool IsUnsigned) const;

  bool selectWaveReduceSum(Register ResVReg, SPIRVTypeInst ResType,
                           MachineInstr &I) const;

  template <typename PickOpcodeFn>
  bool selectWaveExclusiveScan(Register ResVReg, SPIRVTypeInst ResType,
                               MachineInstr &I, bool IsUnsigned,
                               PickOpcodeFn &&PickOpcode) const;

  bool selectWaveExclusiveScanSum(Register ResVReg, SPIRVTypeInst ResType,
                                  MachineInstr &I) const;

  bool selectWaveExclusiveScanProduct(Register ResVReg, SPIRVTypeInst ResType,
                                      MachineInstr &I) const;

  bool selectConst(Register ResVReg, SPIRVTypeInst ResType,
                   MachineInstr &I) const;

  bool selectSelect(Register ResVReg, SPIRVTypeInst ResType,
                    MachineInstr &I) const;
  bool selectBoolToInt(Register ResVReg, SPIRVTypeInst ResType,
                       Register BooleanVReg, MachineInstr &InsertAt,
                       bool IsSigned) const;
  bool selectIToF(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                  bool IsSigned, unsigned Opcode) const;
  bool selectExt(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                 bool IsSigned) const;

  bool selectTrunc(Register ResVReg, SPIRVTypeInst ResType,
                   MachineInstr &I) const;

  bool selectSUCmp(Register ResVReg, SPIRVTypeInst ResType, MachineInstr &I,
                   bool IsSigned) const;

  bool selectIntToBool(Register IntReg, Register ResVReg, MachineInstr &I,
                       SPIRVTypeInst intTy, SPIRVTypeInst boolTy) const;

  bool selectOpUndef(Register ResVReg, SPIRVTypeInst ResType,
                     MachineInstr &I) const;
  bool selectFreeze(Register ResVReg, SPIRVTypeInst ResType,
                    MachineInstr &I) const;
  bool selectIntrinsic(Register ResVReg, SPIRVTypeInst ResType,
                       MachineInstr &I) const;
  bool selectExtractVal(Register ResVReg, SPIRVTypeInst ResType,
                        MachineInstr &I) const;
  bool selectInsertVal(Register ResVReg, SPIRVTypeInst ResType,