[clang-tools-extra] [llvm] [clang] [HLSL] Vector standard conversions (PR #71098)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 19 11:57:36 PST 2023


================
@@ -2466,6 +2504,14 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
   case CK_IntToOCLSampler:
     return CGF.CGM.createOpenCLIntToSamplerConversion(E, CGF);
 
+  case CK_HLSLVectorTruncation: {
+    assert(DestTy->isVectorType() && "Expected dest type to be vector type");
+    Value *Vec = Visit(const_cast<Expr *>(E));
+    SmallVector<int, 16> Mask;
+    Mask.insert(Mask.begin(), DestTy->getAs<VectorType>()->getNumElements(), 0);
----------------
rjmccall wrote:

```suggestion
    Mask.insert(Mask.begin(), DestTy->castAs<VectorType>()->getNumElements(), 0);
```

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


More information about the cfe-commits mailing list