Skip to content

Commit b6fd6d4

Browse files
authored
[HLSL] Use hlsl vector template in type printer (llvm#95489)
In HLSL we really want to be using the HLSL vector template and other built-in sugared spellings for some builtin types. This updates the type printer to take an option to use HLSL type spellings. This changes printing vector type names from: ``` T __attribute__((ext_vector_type(N))) ``` To: ``` vector<T, N> ```
1 parent 3ecba1a commit b6fd6d4

16 files changed

+149
-126
lines changed

clang/include/clang/AST/PrettyPrinter.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct PrintingPolicy {
7777
PrintCanonicalTypes(false), PrintInjectedClassNameWithArguments(true),
7878
UsePreferredNames(true), AlwaysIncludeTypeForTemplateArgument(false),
7979
CleanUglifiedParameters(false), EntireContentsOfLargeArray(true),
80-
UseEnumerators(true) {}
80+
UseEnumerators(true), UseHLSLTypes(LO.HLSL) {}
8181

8282
/// Adjust this printing policy for cases where it's known that we're
8383
/// printing C++ code (for instance, if AST dumping reaches a C++-only
@@ -342,6 +342,11 @@ struct PrintingPolicy {
342342
LLVM_PREFERRED_TYPE(bool)
343343
unsigned UseEnumerators : 1;
344344

345+
/// Whether or not we're printing known HLSL code and should print HLSL
346+
/// sugared types when possible.
347+
LLVM_PREFERRED_TYPE(bool)
348+
unsigned UseHLSLTypes : 1;
349+
345350
/// Callbacks to use to allow the behavior of printing to be customized.
346351
const PrintingCallbacks *Callbacks = nullptr;
347352
};

clang/lib/AST/TypePrinter.cpp

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -644,16 +644,25 @@ void TypePrinter::printDependentAddressSpaceAfter(
644644
void TypePrinter::printDependentSizedExtVectorBefore(
645645
const DependentSizedExtVectorType *T,
646646
raw_ostream &OS) {
647+
if (Policy.UseHLSLTypes)
648+
OS << "vector<";
647649
printBefore(T->getElementType(), OS);
648650
}
649651

650652
void TypePrinter::printDependentSizedExtVectorAfter(
651653
const DependentSizedExtVectorType *T,
652654
raw_ostream &OS) {
653-
OS << " __attribute__((ext_vector_type(";
654-
if (T->getSizeExpr())
655-
T->getSizeExpr()->printPretty(OS, nullptr, Policy);
656-
OS << ")))";
655+
if (Policy.UseHLSLTypes) {
656+
OS << ", ";
657+
if (T->getSizeExpr())
658+
T->getSizeExpr()->printPretty(OS, nullptr, Policy);
659+
OS << ">";
660+
} else {
661+
OS << " __attribute__((ext_vector_type(";
662+
if (T->getSizeExpr())
663+
T->getSizeExpr()->printPretty(OS, nullptr, Policy);
664+
OS << ")))";
665+
}
657666
printAfter(T->getElementType(), OS);
658667
}
659668

@@ -815,14 +824,23 @@ void TypePrinter::printDependentVectorAfter(
815824

816825
void TypePrinter::printExtVectorBefore(const ExtVectorType *T,
817826
raw_ostream &OS) {
827+
if (Policy.UseHLSLTypes)
828+
OS << "vector<";
818829
printBefore(T->getElementType(), OS);
819830
}
820831

821832
void TypePrinter::printExtVectorAfter(const ExtVectorType *T, raw_ostream &OS) {
822833
printAfter(T->getElementType(), OS);
823-
OS << " __attribute__((ext_vector_type(";
824-
OS << T->getNumElements();
825-
OS << ")))";
834+
835+
if (Policy.UseHLSLTypes) {
836+
OS << ", ";
837+
OS << T->getNumElements();
838+
OS << ">";
839+
} else {
840+
OS << " __attribute__((ext_vector_type(";
841+
OS << T->getNumElements();
842+
OS << ")))";
843+
}
826844
}
827845

828846
void TypePrinter::printConstantMatrixBefore(const ConstantMatrixType *T,

clang/test/AST/HLSL/pch.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
hlsl::RWBuffer<float> Buffer;
1111

1212
float2 bar(float2 a, float2 b) {
13-
// CHECK:CallExpr 0x{{[0-9a-f]+}} <col:10, col:18> 'float2':'float __attribute__((ext_vector_type(2)))'
13+
// CHECK:CallExpr 0x{{[0-9a-f]+}} <col:10, col:18> 'float2':'vector<float, 2>'
1414
// CHECK-NEXT:ImplicitCastExpr 0x{{[0-9a-f]+}} <col:10> 'float2 (*)(float2, float2)' <FunctionToPointerDecay>
1515
// CHECK-NEXT:`-DeclRefExpr 0x{{[0-9a-f]+}} <col:10> 'float2 (float2, float2)' lvalue Function 0x[[FOO]] 'foo' 'float2 (float2, float2)'
1616
return foo(a, b);

clang/test/AST/HLSL/pch_with_buf.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
hlsl::RWBuffer<float> Buf2;
1212

1313
float2 bar(float2 a, float2 b) {
14-
// CHECK:CallExpr 0x{{[0-9a-f]+}} <col:10, col:18> 'float2':'float __attribute__((ext_vector_type(2)))'
14+
// CHECK:CallExpr 0x{{[0-9a-f]+}} <col:10, col:18> 'float2':'vector<float, 2>'
1515
// CHECK-NEXT:ImplicitCastExpr 0x{{[0-9a-f]+}} <col:10> 'float2 (*)(float2, float2)' <FunctionToPointerDecay>
1616
// CHECK-NEXT:`-DeclRefExpr 0x{{[0-9a-f]+}} <col:10> 'float2 (float2, float2)' lvalue Function 0x[[FOO]] 'foo' 'float2 (float2, float2)'
1717
return foo(a, b);

clang/test/AST/HLSL/vector-alias.hlsl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s
22

33
// CHECK: NamespaceDecl 0x{{[0-9a-fA-F]+}} <<invalid sloc>> <invalid sloc> implicit hlsl
44
// CHECK-NEXT: TypeAliasTemplateDecl 0x{{[0-9a-fA-F]+}} <<invalid sloc>> <invalid sloc> implicit vector
@@ -8,8 +8,8 @@
88
// CHECK-NEXT: NonTypeTemplateParmDecl 0x{{[0-9a-fA-F]+}} <<invalid sloc>> <invalid sloc> 'int' depth 0 index 1 element_count
99
// CHECK-NEXT: TemplateArgument expr
1010
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-fA-F]+}} <<invalid sloc>> 'int' 4
11-
// CHECK-NEXT: TypeAliasDecl 0x{{[0-9a-fA-F]+}} <<invalid sloc>> <invalid sloc> implicit vector 'element __attribute__((ext_vector_type(element_count)))'
12-
// CHECK-NEXT: DependentSizedExtVectorType 0x{{[0-9a-fA-F]+}} 'element __attribute__((ext_vector_type(element_count)))' dependent <invalid sloc>
11+
// CHECK-NEXT: TypeAliasDecl 0x{{[0-9a-fA-F]+}} <<invalid sloc>> <invalid sloc> implicit vector 'vector<element, element_count>'
12+
// CHECK-NEXT: DependentSizedExtVectorType 0x{{[0-9a-fA-F]+}} 'vector<element, element_count>' dependent <invalid sloc>
1313
// CHECK-NEXT: TemplateTypeParmType 0x{{[0-9a-fA-F]+}} 'element' dependent depth 0 index 0
1414
// CHECK-NEXT: TemplateTypeParm 0x{{[0-9a-fA-F]+}} 'element'
1515
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-fA-F]+}} <<invalid sloc>> 'int' lvalue
@@ -24,30 +24,30 @@ int entry() {
2424
hlsl::vector<float, 2> Vec2 = {1.0, 2.0};
2525

2626
// CHECK: DeclStmt 0x{{[0-9a-fA-F]+}} <line:24:3, col:43>
27-
// CHECK-NEXT: VarDecl 0x{{[0-9a-fA-F]+}} <col:3, col:42> col:26 Vec2 'hlsl::vector<float, 2>':'float __attribute__((ext_vector_type(2)))' cinit
27+
// CHECK-NEXT: VarDecl 0x{{[0-9a-fA-F]+}} <col:3, col:42> col:26 Vec2 'hlsl::vector<float, 2>':'vector<float, 2>' cinit
2828

2929
// Verify that you don't need to specify the namespace.
3030
vector<int, 2> Vec2a = {1, 2};
3131

3232
// CHECK: DeclStmt 0x{{[0-9a-fA-F]+}} <line:30:3, col:32>
33-
// CHECK-NEXT: VarDecl 0x{{[0-9a-fA-F]+}} <col:3, col:31> col:18 Vec2a 'vector<int, 2>':'int __attribute__((ext_vector_type(2)))' cinit
33+
// CHECK-NEXT: VarDecl 0x{{[0-9a-fA-F]+}} <col:3, col:31> col:18 Vec2a 'vector<int, 2>' cinit
3434

3535
// Build a bigger vector.
3636
vector<double, 4> Vec4 = {1.0, 2.0, 3.0, 4.0};
3737

3838
// CHECK: DeclStmt 0x{{[0-9a-fA-F]+}} <line:36:3, col:48>
39-
// CHECK-NEXT: VarDecl 0x{{[0-9a-fA-F]+}} <col:3, col:47> col:21 used Vec4 'vector<double, 4>':'double __attribute__((ext_vector_type(4)))' cinit
39+
// CHECK-NEXT: VarDecl 0x{{[0-9a-fA-F]+}} <col:3, col:47> col:21 used Vec4 'vector<double, 4>' cinit
4040

4141
// Verify that swizzles still work.
4242
vector<double, 3> Vec3 = Vec4.xyz;
4343

4444
// CHECK: DeclStmt 0x{{[0-9a-fA-F]+}} <line:42:3, col:36>
45-
// CHECK-NEXT: VarDecl 0x{{[0-9a-fA-F]+}} <col:3, col:33> col:21 Vec3 'vector<double, 3>':'double __attribute__((ext_vector_type(3)))' cinit
45+
// CHECK-NEXT: VarDecl 0x{{[0-9a-fA-F]+}} <col:3, col:33> col:21 Vec3 'vector<double, 3>' cinit
4646

4747
// Verify that the implicit arguments generate the correct type.
4848
vector<> ImpVec4 = {1.0, 2.0, 3.0, 4.0};
4949

5050
// CHECK: DeclStmt 0x{{[0-9a-fA-F]+}} <line:48:3, col:42>
51-
// CHECK-NEXT: VarDecl 0x{{[0-9a-fA-F]+}} <col:3, col:41> col:12 ImpVec4 'vector<>':'float __attribute__((ext_vector_type(4)))' cinit
51+
// CHECK-NEXT: VarDecl 0x{{[0-9a-fA-F]+}} <col:3, col:41> col:12 ImpVec4 'vector<>':'vector<float, 4>' cinit
5252
return 1;
5353
}

clang/test/AST/HLSL/vector-constructors.hlsl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,32 @@ void entry() {
1111

1212
// For the float2 vector, we just expect a conversion from constructor
1313
// parameters to an initialization list
14-
// CHECK-LABEL: VarDecl 0x{{[0-9a-fA-F]+}} {{.*}} used Vec2 'float2':'float __attribute__((ext_vector_type(2)))' cinit
15-
// CHECK-NEXT: CXXFunctionalCastExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float2':'float __attribute__((ext_vector_type(2)))' functional cast to float2 <NoOp>
16-
// CHECK-NEXT: InitListExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float2':'float __attribute__((ext_vector_type(2)))'
14+
// CHECK-LABEL: VarDecl 0x{{[0-9a-fA-F]+}} {{.*}} used Vec2 'float2':'vector<float, 2>' cinit
15+
// CHECK-NEXT: CXXFunctionalCastExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float2':'vector<float, 2>' functional cast to float2 <NoOp>
16+
// CHECK-NEXT: InitListExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float2':'vector<float, 2>'
1717
// CHECK-NEXT: FloatingLiteral 0x{{[0-9a-fA-F]+}} {{.*}} 'float' 1.000000e+00
1818
// CHECK-NEXT: FloatingLiteral 0x{{[0-9a-fA-F]+}} {{.*}} 'float' 2.000000e+00
1919

2020

2121
// For the float 3 things get fun...
2222
// Here we expect accesses to the vec2 to provide the first and second
2323
// components using ArraySubscriptExpr
24-
// CHECK-LABEL: VarDecl 0x{{[0-9a-fA-F]+}} {{.*}} col:10 Vec3 'float3':'float __attribute__((ext_vector_type(3)))' cinit
25-
// CHECK-NEXT: CXXFunctionalCastExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float3':'float __attribute__((ext_vector_type(3)))' functional cast to float3 <NoOp>
26-
// CHECK-NEXT: InitListExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float3':'float __attribute__((ext_vector_type(3)))'
24+
// CHECK-LABEL: VarDecl 0x{{[0-9a-fA-F]+}} {{.*}} col:10 Vec3 'float3':'vector<float, 3>' cinit
25+
// CHECK-NEXT: CXXFunctionalCastExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float3':'vector<float, 3>' functional cast to float3 <NoOp>
26+
// CHECK-NEXT: InitListExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float3':'vector<float, 3>'
2727
// CHECK-NEXT: ImplicitCastExpr 0x{{[0-9a-fA-F]+}} <col:24, <invalid sloc>> 'float' <LValueToRValue>
2828
// CHECK-NEXT: ArraySubscriptExpr 0x{{[0-9a-fA-F]+}} <col:24, <invalid sloc>> 'float' lvalue
29-
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float2':'float __attribute__((ext_vector_type(2)))' lvalue Var 0x{{[0-9a-fA-F]+}} 'Vec2' 'float2':'float __attribute__((ext_vector_type(2)))'
29+
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float2':'vector<float, 2>' lvalue Var 0x{{[0-9a-fA-F]+}} 'Vec2' 'float2':'vector<float, 2>'
3030
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-fA-F]+}} <<invalid sloc>> 'int' 0
3131
// CHECK-NEXT: ImplicitCastExpr 0x{{[0-9a-fA-F]+}} <col:24, <invalid sloc>> 'float' <LValueToRValue>
3232
// CHECK-NEXT: ArraySubscriptExpr 0x{{[0-9a-fA-F]+}} <col:24, <invalid sloc>> 'float' lvalue
33-
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float2':'float __attribute__((ext_vector_type(2)))' lvalue Var 0x{{[0-9a-fA-F]+}} 'Vec2' 'float2':'float __attribute__((ext_vector_type(2)))'
33+
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float2':'vector<float, 2>' lvalue Var 0x{{[0-9a-fA-F]+}} 'Vec2' 'float2':'vector<float, 2>'
3434
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-fA-F]+}} <<invalid sloc>> 'int' 1
3535
// CHECK-NEXT: FloatingLiteral 0x{{[0-9a-fA-F]+}} {{.*}} 'float' 3.000000e+00
3636

37-
// CHECK: VarDecl 0x{{[0-9a-fA-F]+}} {{.*}} col:10 Vec3b 'float3':'float __attribute__((ext_vector_type(3)))' cinit
38-
// CHECK-NEXT: CXXFunctionalCastExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float3':'float __attribute__((ext_vector_type(3)))' functional cast to float3 <NoOp>
39-
// CHECK-NEXT: InitListExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float3':'float __attribute__((ext_vector_type(3)))'
37+
// CHECK: VarDecl 0x{{[0-9a-fA-F]+}} {{.*}} col:10 Vec3b 'float3':'vector<float, 3>' cinit
38+
// CHECK-NEXT: CXXFunctionalCastExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float3':'vector<float, 3>' functional cast to float3 <NoOp>
39+
// CHECK-NEXT: InitListExpr 0x{{[0-9a-fA-F]+}} {{.*}} 'float3':'vector<float, 3>'
4040

4141
// CHECK-NEXT: FloatingLiteral 0x{{[0-9a-fA-F]+}} {{.*}} 'float' 1.000000e+00
4242
// CHECK-NEXT: FloatingLiteral 0x{{[0-9a-fA-F]+}} {{.*}} 'float' 2.000000e+00

clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ RWBuffer<> BufferErr2;
1515

1616
[numthreads(1,1,1)]
1717
void main() {
18-
(void)Buffer.h; // expected-error {{'h' is a private member of 'hlsl::RWBuffer<float __attribute__((ext_vector_type(3)))>'}}
18+
(void)Buffer.h; // expected-error {{'h' is a private member of 'hlsl::RWBuffer<vector<float, 3> >'}}
1919
// expected-note@* {{implicitly declared private here}}
2020
}

clang/test/SemaHLSL/BuiltIns/clamp-errors.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ float2 test_clamp_no_second_arg(float2 p0) {
2222

2323
float2 test_clamp_vector_size_mismatch(float3 p0, float2 p1) {
2424
return clamp(p0, p0, p1);
25-
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
25+
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}}
2626
}
2727

2828
float2 test_clamp_builtin_vector_size_mismatch(float3 p0, float2 p1) {

clang/test/SemaHLSL/BuiltIns/dot-errors.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ float test_dot_no_second_arg(float2 p0) {
1717

1818
float test_dot_vector_size_mismatch(float3 p0, float2 p1) {
1919
return dot(p0, p1);
20-
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
20+
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}}
2121
}
2222

2323
float test_dot_builtin_vector_size_mismatch(float3 p0, float2 p1) {

clang/test/SemaHLSL/BuiltIns/lerp-errors.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ float2 test_lerp_no_second_arg(float2 p0) {
2222

2323
float2 test_lerp_vector_size_mismatch(float3 p0, float2 p1) {
2424
return lerp(p0, p0, p1);
25-
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
25+
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}}
2626
}
2727

2828
float2 test_lerp_builtin_vector_size_mismatch(float3 p0, float2 p1) {

clang/test/SemaHLSL/BuiltIns/mad-errors.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ float2 test_mad_no_second_arg(float2 p0) {
2222

2323
float2 test_mad_vector_size_mismatch(float3 p0, float2 p1) {
2424
return mad(p0, p0, p1);
25-
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}}
25+
// expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'vector<float, 2>' (vector of 2 'float' values)}}
2626
}
2727

2828
float2 test_mad_builtin_vector_size_mismatch(float3 p0, float2 p1) {

clang/test/SemaHLSL/BuiltIns/vector-errors.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Some bad declarations
44
hlsl::vector ShouldWorkSomeday; // expected-error{{use of alias template 'hlsl::vector' requires template arguments}}
5-
// expected-note@*:* {{template declaration from hidden source: template <class element = float, int element_count = 4> using vector = element __attribute__((ext_vector_type(element_count)))}}
5+
// expected-note@*:* {{template declaration from hidden source: template <class element = float, int element_count = 4> using vector = vector<element, element_count>}}
66

77
hlsl::vector<1> BadVec; // expected-error{{template argument for template type parameter must be a type}}
88
// expected-note@*:* {{template parameter from hidden source: class element = float}}
@@ -11,7 +11,7 @@ hlsl::vector<int, float> AnotherBadVec; // expected-error{{template argument for
1111
// expected-note@*:* {{template parameter from hidden source: int element_count = 4}}
1212

1313
hlsl::vector<int, 2, 3> YABV; // expected-error{{too many template arguments for alias template 'vector'}}
14-
// expected-note@*:* {{template declaration from hidden source: template <class element = float, int element_count = 4> using vector = element __attribute__((ext_vector_type(element_count)))}}
14+
// expected-note@*:* {{template declaration from hidden source: template <class element = float, int element_count = 4> using vector = vector<element, element_count>}}
1515

1616
// This code is rejected by clang because clang puts the HLSL built-in types
1717
// into the HLSL namespace.

clang/test/SemaHLSL/Types/BuiltinVector/ScalarSwizzleErrors.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -x hlsl -finclude-default-header -verify %s
22

33
int2 ToTwoInts(int V) {
4-
return V.xy; // expected-error{{vector component access exceeds type 'int __attribute__((ext_vector_type(1)))' (vector of 1 'int' value)}}
4+
return V.xy; // expected-error{{vector component access exceeds type 'vector<int, 1>' (vector of 1 'int' value)}}
55
}
66

77
float2 ToTwoFloats(float V) {
8-
return V.rg; // expected-error{{vector component access exceeds type 'float __attribute__((ext_vector_type(1)))' (vector of 1 'float' value)}}
8+
return V.rg; // expected-error{{vector component access exceeds type 'vector<float, 1>' (vector of 1 'float' value)}}
99
}
1010

1111
int4 SomeNonsense(int V) {

0 commit comments

Comments
 (0)