File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -2353,7 +2353,13 @@ RValue CodeGenFunction::EmitLoadOfExtVectorElementLValue(LValue LV) {
23532353 if (!ExprVT) {
23542354 unsigned InIdx = getAccessedFieldNo (0 , Elts);
23552355 llvm::Value *Elt = llvm::ConstantInt::get (SizeTy, InIdx);
2356- return RValue::get (Builder.CreateExtractElement (Vec, Elt));
2356+
2357+ llvm::Value *Element = Builder.CreateExtractElement (Vec, Elt);
2358+
2359+ if (getLangOpts ().HLSL && LV.getType ()->isBooleanType ())
2360+ Element = Builder.CreateTrunc (Element, ConvertType (LV.getType ()));
2361+
2362+ return RValue::get (Element);
23572363 }
23582364
23592365 // Always use shuffle vector to try to retain the original program structure
@@ -2364,6 +2370,10 @@ RValue CodeGenFunction::EmitLoadOfExtVectorElementLValue(LValue LV) {
23642370 Mask.push_back (getAccessedFieldNo (i, Elts));
23652371
23662372 Vec = Builder.CreateShuffleVector (Vec, Mask);
2373+
2374+ if (getLangOpts ().HLSL && LV.getType ()->isExtVectorBoolType ())
2375+ Vec = EmitFromMemory (Vec, LV.getType ());
2376+
23672377 return RValue::get (Vec);
23682378}
23692379
You can’t perform that action at this time.
0 commit comments