[llvm] [Spirv][HLSL] Add OpAll lowering and float vec support (PR #87952)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 07:38:51 PDT 2024


================
@@ -270,20 +357,70 @@ Register SPIRVGlobalRegistry::buildConstantFP(APFloat Val,
   return Res;
 }
 
+Register SPIRVGlobalRegistry::getOrCreateFloatCompositeOrNull(
+    Constant *Val, MachineInstr &I, SPIRVType *SpvType,
+    const SPIRVInstrInfo &TII, Constant *CA, unsigned BitWidth,
+    unsigned ElemCnt, bool ZeroAsNull) {
+  // Find a constant vector in DT or build a new one.
+  Register Res = DT.find(CA, CurMF);
+  bool IsNull = Val->isNullValue() && ZeroAsNull;
+  if (!Res.isValid()) {
+    // SpvScalConst should be created before SpvVecConst to avoid undefined ID
+    // error on validation.
+    // TODO: can moved below once sorting of types/consts/defs is implemented.
+    Register SpvScalConst;
----------------
farzonl wrote:

THe TODOs are also copied from `getOrCreateIntCompositeOrNull`.  I don't know when that work is to be scheduled or if there is already an issue tracking it. But  maybe there is more I can do  to keep from having to split into two seperate functions

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


More information about the llvm-commits mailing list