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

John McCall via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 5 14:20:54 PST 2024


================
@@ -361,6 +361,9 @@ CAST_OPERATION(AddressSpaceConversion)
 // Convert an integer initializer to an OpenCL sampler.
 CAST_OPERATION(IntToOCLSampler)
 
+// Truncate a vector type (HLSL only).
+CAST_OPERATION(HLSLVectorTruncation)
----------------
rjmccall wrote:

Unfortunately, we already use "truncate" a lot to talk about narrowing integer conversions.  Ideally, the term here wouldn't be confusable with that; I don't have a great alternative to suggest, though.  Even if we can't find a better name, though, please briefly describe the conversion here, since it's not obvious from context.

As an aside: uh, wow, that sure seems like an unfortunate conversion to have in the language.  I guess it's not that bad for something like dropping the last element from a 4-vector, where often it's really a 3-vector in disguise.  Still, oof, what a footgun.

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


More information about the cfe-commits mailing list