[clang] [HLSL] Support vector swizzles on scalars (PR #67700)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 23 11:30:41 PDT 2023
================
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -x hlsl -finclude-default-header -verify %s
+
+
+int2 ToTwoInts(int V) {
+ return V.xy; // expected-error{{vector component access exceeds type 'int __attribute__((ext_vector_type(1)))' (vector of 1 'int' value)}}
+}
+
+float2 ToTwoFloats(float V) {
+ return V.rg; // expected-error{{vector component access exceeds type 'float __attribute__((ext_vector_type(1)))' (vector of 1 'float' value)}}
+}
+
+int4 SomeNonsense(int V) {
+ return V.poop; // expected-error{{illegal vector component name 'p'}}
----------------
llvm-beanz wrote:
The really sad thing is that the first case there seems to be valid on both our reference compilers:
[DXC on Compiler Explorer](https://godbolt.org/z/KETGPbdfq)
[FXC on Shader Playground](https://shader-playground.timjones.io/e91ae2cfb95892f3676a71fcb2920756)
We may need to support that. I'll add tests either way.
https://github.com/llvm/llvm-project/pull/67700
More information about the cfe-commits
mailing list