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

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 07:11:21 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;
----------------
Keenuts wrote:

What's happening if you don't put this below? Is it a test failure, or something else?
If it's that we generate an invalid SPIR-V module, could you open an issue and reference the issue # in the TODO?

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


More information about the llvm-commits mailing list