Skip to content

Commit

Permalink
[NFC] Fix failing test introduced in #67700
Browse files Browse the repository at this point in the history
This fixes the test to handle the changes in the AST printer.
../clang/test/SemaHLSL/Types/BuiltinVector/ScalarSwizzles.hlsl
  • Loading branch information
llvm-beanz committed Nov 29, 2023
1 parent f688e09 commit ff96567
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions clang/test/SemaHLSL/Types/BuiltinVector/ScalarSwizzles.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// RUN: -finclude-default-header -ast-dump %s | FileCheck %s


// CHECK-LABEL: ToTwoInts
// CHECK: ExtVectorElementExpr {{.*}} 'int __attribute__((ext_vector_type(2)))' xx
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int __attribute__((ext_vector_type(1)))' lvalue <VectorSplat>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'V' 'int'
Expand All @@ -10,6 +11,7 @@ int2 ToTwoInts(int V){
return V.xx;
}

// CHECK-LABEL: ToFourFloats
// CHECK: ExtVectorElementExpr {{.*}} 'float __attribute__((ext_vector_type(4)))' rrrr
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float __attribute__((ext_vector_type(1)))' lvalue <VectorSplat>
// CHECK-NEXT: DeclRefExpr {{.*}} 'float' lvalue ParmVar {{.*}} 'V' 'float'
Expand All @@ -19,6 +21,7 @@ float4 ToFourFloats(float V){
return V.rrrr;
}

// CHECK-LABEL: FillOne
// CHECK: ExtVectorElementExpr {{.*}} 'int __attribute__((ext_vector_type(2)))' xx
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int __attribute__((ext_vector_type(1)))' <VectorSplat>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 1
Expand All @@ -27,7 +30,7 @@ int2 FillOne(){
return 1.xx;
}


// CHECK-LABEL: FillOneUnsigned
// CHECK: ExtVectorElementExpr {{.*}} 'unsigned int __attribute__((ext_vector_type(3)))' xxx
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int __attribute__((ext_vector_type(1)))' <VectorSplat>
// CHECK-NEXT: IntegerLiteral {{.*}} 'unsigned int' 1
Expand All @@ -36,6 +39,7 @@ uint3 FillOneUnsigned(){
return 1u.xxx;
}

// CHECK-LABEL: FillOneUnsignedLong
// CHECK: ExtVectorElementExpr {{.*}} 'unsigned long __attribute__((ext_vector_type(4)))' xxxx
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned long __attribute__((ext_vector_type(1)))' <VectorSplat>
// CHECK-NEXT: IntegerLiteral {{.*}} 'unsigned long' 1
Expand All @@ -44,6 +48,7 @@ vector<uint64_t,4> FillOneUnsignedLong(){
return 1ul.xxxx;
}

// CHECK-LABEL: FillTwoPointFive
// CHECK: ExtVectorElementExpr {{.*}} 'double __attribute__((ext_vector_type(2)))' rr
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'double __attribute__((ext_vector_type(1)))' <VectorSplat>
// CHECK-NEXT: FloatingLiteral {{.*}} 'double' 2.500000e+00
Expand All @@ -52,6 +57,7 @@ double2 FillTwoPointFive(){
return 2.5.rr;
}

// CHECK-LABEL: FillOneHalf
// CHECK: ExtVectorElementExpr {{.*}} 'double __attribute__((ext_vector_type(3)))' rrr
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'double __attribute__((ext_vector_type(1)))' <VectorSplat>
// CHECK-NEXT: FloatingLiteral {{.*}} 'double' 5.000000e-01
Expand All @@ -60,6 +66,7 @@ double3 FillOneHalf(){
return .5.rrr;
}

// CHECK-LABEL: FillTwoPointFiveFloat
// CHECK: ExtVectorElementExpr {{.*}} 'float __attribute__((ext_vector_type(4)))' rrrr
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float __attribute__((ext_vector_type(1)))' <VectorSplat>
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 2.500000e+00
Expand All @@ -72,6 +79,7 @@ float4 FillTwoPointFiveFloat(){
// truncated vector, this AST formulation has an initialization list to
// initialze the returned vector.

// CHECK-LABEL: FillOneHalfFloat
// CHECK: InitListExpr {{.*}} 'vector<float, 1>':'float __attribute__((ext_vector_type(1)))'
// CHECK-NEXT: ExtVectorElementExpr {{.*}} 'float' r
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float __attribute__((ext_vector_type(1)))' <VectorSplat>
Expand All @@ -81,6 +89,7 @@ vector<float, 1> FillOneHalfFloat(){
return .5f.r;
}

// CHECK-LABEL: HowManyFloats
// CHECK: ExtVectorElementExpr {{.*}} 'float __attribute__((ext_vector_type(2)))' rr
// CHECK-NEXT: ExtVectorElementExpr {{.*}} 'float __attribute__((ext_vector_type(2)))' rr
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float __attribute__((ext_vector_type(1)))' lvalue <VectorSplat>
Expand All @@ -90,6 +99,7 @@ float2 HowManyFloats(float V) {
return V.rr.rr;
}

// CHECK-LABEL: HooBoy
// CHECK: ExtVectorElementExpr {{.*}} 'long __attribute__((ext_vector_type(4)))' xxxx
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'long __attribute__((ext_vector_type(1)))' <VectorSplat>
// CHECK-NEXT: IntegerLiteral {{.*}} 'long' 4
Expand All @@ -102,27 +112,27 @@ int64_t4 HooBoy() {
// is a double->float conversion, which results in generating an initializtion
// list with float truncation casts.


// CHECK-LABEL: AllRighty
// CHECK: InitListExpr {{.*}} 'float3':'float __attribute__((ext_vector_type(3)))'

// Vector element 0:
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float':'float' <FloatingCast>
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <FloatingCast>
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'double'
// CHECK-NEXT: ExtVectorElementExpr {{.*}} 'double __attribute__((ext_vector_type(3)))' rrr
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'double __attribute__((ext_vector_type(1)))' <VectorSplat>
// CHECK-NEXT: FloatingLiteral {{.*}} 'double' 1.000000e+00
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 0

// Vector element 1:
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float':'float' <FloatingCast>
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <FloatingCast>
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'double'
// CHECK-NEXT: ExtVectorElementExpr {{.*}} 'double __attribute__((ext_vector_type(3)))' rrr
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'double __attribute__((ext_vector_type(1)))' <VectorSplat>
// CHECK-NEXT: FloatingLiteral {{.*}} 'double' 1.000000e+00
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 1

// Vector element 2:
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float':'float' <FloatingCast>
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <FloatingCast>
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'double'
// CHECK-NEXT: ExtVectorElementExpr {{.*}} 'double __attribute__((ext_vector_type(3)))' rrr
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'double __attribute__((ext_vector_type(1)))' <VectorSplat>
Expand Down

0 comments on commit ff96567

Please sign in to comment.