[llvm] [SPIRV] Create a new OpSelect selector and fix register types. (PR #152311)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 09:58:12 PDT 2025


================
@@ -2564,8 +2577,54 @@ Register SPIRVInstructionSelector::buildOnesVal(bool AllOnes,
 
 bool SPIRVInstructionSelector::selectSelect(Register ResVReg,
                                             const SPIRVType *ResType,
-                                            MachineInstr &I,
-                                            bool IsSigned) const {
+                                            MachineInstr &I) const {
+  bool IsFloatTy =
+      GR.isScalarOrVectorOfType(I.getOperand(2).getReg(), SPIRV::OpTypeFloat) ||
+      GR.isScalarOrVectorOfType(I.getOperand(3).getReg(), SPIRV::OpTypeFloat);
----------------
Keenuts wrote:

Operand 2 and 3, and ResType must all have the same type.
Shall the code assert 3 types are the same, and then do the `isFloatTy`/`IsPtrTy` type check on a single operand?

https://github.com/llvm/llvm-project/pull/152311


More information about the llvm-commits mailing list