Browse Source

Merged PR 76: Produce correct HL matrix store in EmitExtMatrixElementExpr

Produce correct HL matrix store in EmitExtMatrixElementExpr
Tex Riddell 7 năm trước cách đây
mục cha
commit
d4cadd8a75

+ 1 - 1
tools/clang/lib/CodeGen/CGExpr.cpp

@@ -2847,7 +2847,7 @@ CodeGenFunction::EmitExtMatrixElementExpr(const ExtMatrixElementExpr *E) {
 
     // Store the vector to memory (because LValue wants an address).
     llvm::Value *VecMem = CreateMemTemp(E->getBase()->getType());
-    Builder.CreateStore(Vec, VecMem);
+    CGM.getHLSLRuntime().EmitHLSLMatrixStore(*this, Vec, VecMem, E->getBase()->getType());
     Base = MakeAddrLValue(VecMem, E->getBase()->getType());
   }
   

+ 8 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_return_sub.hlsl

@@ -0,0 +1,8 @@
+// RUN: %dxc -T lib_6_3 %s | FileCheck %s
+
+// Make sure this works on intrinsic that returns matrix
+// CHECK: call float @dx.op.worldToObject.f32(i32 152, i32 0, i8 1)
+
+float foo() {
+  return WorldToObject()._m01;
+}