[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 14 13:47:22 PST 2025
================
@@ -2752,7 +2787,17 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
llvm::Value *Zero = llvm::Constant::getNullValue(CGF.SizeTy);
return Builder.CreateExtractElement(Vec, Zero, "cast.vtrunc");
}
+ case CK_HLSLAggregateCast: {
+ RValue RV = CGF.EmitAnyExpr(E);
+ SourceLocation Loc = CE->getExprLoc();
+ QualType SrcTy = E->getType();
+ if (RV.isAggregate()) { // RHS is an aggregate
+ Address SrcVal = RV.getAggregateAddress();
+ return EmitHLSLAggregateFlatCast(CGF, SrcVal, SrcTy, DestTy, Loc);
+ }
+ llvm_unreachable("Not a valid HLSL Flat Cast.");
----------------
llvm-beanz wrote:
I'd also make this an assert rather than an unreachable.
https://github.com/llvm/llvm-project/pull/118842
More information about the cfe-commits
mailing list