@@ -160,7 +160,8 @@ static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) {
160160 return LastInst;
161161}
162162
163- static Value *handleElementwiseF16ToF32 (CodeGenFunction &CGF, const CallExpr *E) {
163+ static Value *handleElementwiseF16ToF32 (CodeGenFunction &CGF,
164+ const CallExpr *E) {
164165 Value *Op0 = CGF.EmitScalarExpr (E->getArg (0 ));
165166 QualType Op0Ty = E->getArg (0 )->getType ();
166167 llvm::Type *ResType = CGF.FloatTy ;
@@ -176,37 +177,38 @@ static Value *handleElementwiseF16ToF32(CodeGenFunction &CGF, const CallExpr *E)
176177 " f16tof32 operand must have an unsigned int representation" );
177178
178179 if (CGF.CGM .getTriple ().isDXIL ())
179- return CGF.Builder .CreateIntrinsic (
180- ResType, Intrinsic::dx_legacyf16tof32 ,
181- ArrayRef<Value *>{Op0}, nullptr , " hlsl.f16tof32" );
180+ return CGF.Builder .CreateIntrinsic (ResType, Intrinsic::dx_legacyf16tof32,
181+ ArrayRef<Value *>{Op0}, nullptr ,
182+ " hlsl.f16tof32" );
182183
183184 if (CGF.CGM .getTriple ().isSPIRV ()) {
184185 // We use the SPIRV UnpackHalf2x16 operation to avoid the need for the
185186 // Int16 and Float16 capabilities
186- auto UnpackType = llvm::VectorType::get (CGF.FloatTy , ElementCount::getFixed (2 ));
187+ auto UnpackType =
188+ llvm::VectorType::get (CGF.FloatTy , ElementCount::getFixed (2 ));
187189 if (NumElements == 0 ) {
188- // a scalar input - simply extract the first element of the unpacked vector
189- Value *Unpack = CGF. Builder . CreateIntrinsic (
190- UnpackType, Intrinsic::spv_unpackhalf2x16,
191- ArrayRef<Value *>{Op0});
190+ // a scalar input - simply extract the first element of the unpacked
191+ // vector
192+ Value *Unpack = CGF. Builder . CreateIntrinsic (
193+ UnpackType, Intrinsic::spv_unpackhalf2x16, ArrayRef<Value *>{Op0});
192194 return CGF.Builder .CreateExtractElement (Unpack, (uint64_t )0 );
193195 } else {
194196 // a vector input - build a congruent output vector by iterating through
195197 // the input vector calling unpackhalf2x16 for each element
196198 Value *Result = PoisonValue::get (ResType);
197199 for (uint64_t i = 0 ; i < NumElements; i++) {
198200 Value *InVal = CGF.Builder .CreateExtractElement (Op0, i);
199- Value *Unpack = CGF.Builder .CreateIntrinsic (UnpackType,
200- Intrinsic::spv_unpackhalf2x16, ArrayRef<Value *>{InVal});
201+ Value *Unpack = CGF.Builder .CreateIntrinsic (
202+ UnpackType, Intrinsic::spv_unpackhalf2x16,
203+ ArrayRef<Value *>{InVal});
201204 Value *Res = CGF.Builder .CreateExtractElement (Unpack, (uint64_t )0 );
202205 Result = CGF.Builder .CreateInsertElement (Result, Res, i);
203206 }
204207 return Result;
205208 }
206209 }
207210
208- llvm_unreachable (
209- " Intrinsic F16ToF32 not supported by target architecture" );
211+ llvm_unreachable (" Intrinsic F16ToF32 not supported by target architecture" );
210212}
211213
212214static Value *emitBufferStride (CodeGenFunction *CGF, const Expr *HandleExpr,
0 commit comments