Skip to content

Commit 899d529

Browse files
committed
Update scalar swizzle tests
The new "correct" implicit conversion sequences change how some of these ASTs are formed and the initial code generation. ../clang/test/CodeGenHLSL/builtins/ScalarSwizzles.hlsl ../clang/test/SemaHLSL/Types/BuiltinVector/ScalarSwizzles.hlsl
1 parent 6cbf74c commit 899d529

File tree

2 files changed

+11
-48
lines changed

2 files changed

+11
-48
lines changed

clang/test/CodeGenHLSL/builtins/ScalarSwizzles.hlsl

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ float4 FillTwoPointFiveFloat(){
8585
// CHECK: [[vec1Ptr:%.*]] = alloca <1 x float>, align 4
8686
// CHECK: store <1 x float> <float 5.000000e-01>, ptr [[vec1Ptr]], align 4
8787
// CHECK: [[vec1:%.*]] = load <1 x float>, ptr [[vec1Ptr]], align 4
88-
// CHECK: [[vec1Ret:%.*]] = shufflevector <1 x float> [[vec1]], <1 x float> undef, <1 x i32> zeroinitializer
88+
// CHECK: [[el0:%.*]] = extractelement <1 x float> [[vec1]], i32 0
89+
// CHECK: [[vec1Splat:%.*]] = insertelement <1 x float> poison, float [[el0]], i64 0
90+
// CHECK: [[vec1Ret:%.*]] = shufflevector <1 x float> [[vec1Splat]], <1 x float> poison, <1 x i32> zeroinitializer
8991
// CHECK: ret <1 x float> [[vec1Ret]]
9092
vector<float, 1> FillOneHalfFloat(){
9193
return .5f.r;
@@ -113,30 +115,12 @@ float2 HowManyFloats(float V) {
113115
// up nicely too.
114116

115117
// CHECK-LABEL: AllRighty
116-
// CHECK: [[XTmp:%.*]] = alloca <1 x double>, align 8
117-
// CHECK: [[YTmp:%.*]] = alloca <1 x double>, align 8
118-
// CHECK: [[ZTmp:%.*]] = alloca <1 x double>, align 8
119-
120-
// CHECK: store <1 x double> <double 1.000000e+00>, ptr [[XTmp]], align 8
121-
// CHECK: [[XVec:%.*]] = load <1 x double>, ptr [[XTmp]], align 8
122-
// CHECK: [[XVec3:%.*]] = shufflevector <1 x double> [[XVec]], <1 x double> poison, <3 x i32> zeroinitializer
123-
// CHECK: [[XVal:%.*]] = extractelement <3 x double> [[XVec3]], i32 0
124-
// CHECK: [[XValF:%.*]] = fptrunc double [[XVal]] to float
125-
// CHECK: [[Vec3F1:%.*]] = insertelement <3 x float> undef, float [[XValF]], i32 0
126-
127-
// CHECK: store <1 x double> <double 1.000000e+00>, ptr [[YTmp]], align 8
128-
// CHECK: [[YVec:%.*]] = load <1 x double>, ptr [[YTmp]], align 8
129-
// CHECK: [[YVec3:%.*]] = shufflevector <1 x double> [[YVec]], <1 x double> poison, <3 x i32> zeroinitializer
130-
// CHECK: [[YVal:%.*]] = extractelement <3 x double> [[YVec3]], i32 1
131-
// CHECK: [[YValF:%.*]] = fptrunc double [[YVal]] to float
132-
// CHECK: [[Vec3F2:%.*]] = insertelement <3 x float> [[Vec3F1]], float [[YValF]], i32 1
133-
134-
// CHECK: store <1 x double> <double 1.000000e+00>, ptr [[ZTmp]], align 8
135-
// CHECK: [[ZVec:%.*]] = load <1 x double>, ptr [[ZTmp]], align 8
136-
// CHECK: [[ZVec3:%.*]] = shufflevector <1 x double> [[ZVec]], <1 x double> poison, <3 x i32> zeroinitializer
137-
// CHECK: [[ZVal:%.*]] = extractelement <3 x double> [[ZVec3]], i32 2
138-
// CHECK: [[ZValF:%.*]] = fptrunc double [[ZVal]] to float
139-
// CHECK: [[Vec3F3:%.*]] = insertelement <3 x float> [[Vec3F2]], float [[ZValF]], i32 2
118+
// CHECK: [[Tmp:%.*]] = alloca <1 x double>, align 8
119+
// CHECK: store <1 x double> <double 1.000000e+00>, ptr [[Tmp]], align 8
120+
// CHECK: [[vec1:%.*]] = load <1 x double>, ptr [[Tmp]], align 8
121+
// CHECK: [[vec3:%.*]] = shufflevector <1 x double> [[vec1]], <1 x double> poison, <3 x i32> zeroinitializer
122+
// CHECK: [[vec3f:%.*]] = fptrunc <3 x double> [[vec3]] to <3 x float>
123+
// ret <3 x float> [[vec3f]]
140124

141125
// ret <3 x float> [[Vec3F3]]
142126
float3 AllRighty() {

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

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ float4 FillTwoPointFiveFloat(){
8080
// initialze the returned vector.
8181

8282
// CHECK-LABEL: FillOneHalfFloat
83-
// CHECK: InitListExpr {{.*}} 'vector<float, 1>':'float __attribute__((ext_vector_type(1)))'
83+
// CHECK: ImplicitCastExpr {{.*}} 'vector<float, 1>':'float __attribute__((ext_vector_type(1)))' <VectorSplat>
8484
// CHECK-NEXT: ExtVectorElementExpr {{.*}} 'float' r
8585
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float __attribute__((ext_vector_type(1)))' <VectorSplat>
8686
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 5.000000e-01
@@ -113,31 +113,10 @@ int64_t4 HooBoy() {
113113
// list with float truncation casts.
114114

115115
// CHECK-LABEL: AllRighty
116-
// CHECK: InitListExpr {{.*}} 'float3':'float __attribute__((ext_vector_type(3)))'
117-
118-
// Vector element 0:
119-
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <FloatingCast>
120-
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'double'
121-
// CHECK-NEXT: ExtVectorElementExpr {{.*}} 'double __attribute__((ext_vector_type(3)))' rrr
122-
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'double __attribute__((ext_vector_type(1)))' <VectorSplat>
123-
// CHECK-NEXT: FloatingLiteral {{.*}} 'double' 1.000000e+00
124-
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 0
125-
126-
// Vector element 1:
127-
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <FloatingCast>
128-
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'double'
129-
// CHECK-NEXT: ExtVectorElementExpr {{.*}} 'double __attribute__((ext_vector_type(3)))' rrr
130-
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'double __attribute__((ext_vector_type(1)))' <VectorSplat>
131-
// CHECK-NEXT: FloatingLiteral {{.*}} 'double' 1.000000e+00
132-
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 1
133-
134-
// Vector element 2:
135-
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <FloatingCast>
136-
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'double'
116+
// CHECK: ImplicitCastExpr {{.*}} 'float3':'float __attribute__((ext_vector_type(3)))' <FloatingCast>
137117
// CHECK-NEXT: ExtVectorElementExpr {{.*}} 'double __attribute__((ext_vector_type(3)))' rrr
138118
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'double __attribute__((ext_vector_type(1)))' <VectorSplat>
139119
// CHECK-NEXT: FloatingLiteral {{.*}} 'double' 1.000000e+00
140-
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 2
141120

142121
float3 AllRighty() {
143122
return 1..rrr;

0 commit comments

Comments
 (0)