Quellcode durchsuchen

Rmove attribute on intrinsic with output param.

Xiang Li vor 8 Jahren
Ursprung
Commit
5b0b03ec0b

+ 14 - 14
tools/clang/lib/Sema/gen_intrin_main_tables_15.h

@@ -1268,16 +1268,16 @@ static const HLSL_INTRINSIC g_Intrinsics[] =
     {(UINT)hlsl::IntrinsicOp::IOP_InterlockedXor, false, false, -1, 3, g_Intrinsics_Args28},
     {(UINT)hlsl::IntrinsicOp::IOP_InterlockedXor, false, false, -1, 4, g_Intrinsics_Args29},
     {(UINT)hlsl::IntrinsicOp::IOP_NonUniformResourceIndex, false, true, -1, 2, g_Intrinsics_Args30},
-    {(UINT)hlsl::IntrinsicOp::IOP_Process2DQuadTessFactorsAvg, false, true, -1, 6, g_Intrinsics_Args31},
-    {(UINT)hlsl::IntrinsicOp::IOP_Process2DQuadTessFactorsMax, false, true, -1, 6, g_Intrinsics_Args32},
-    {(UINT)hlsl::IntrinsicOp::IOP_Process2DQuadTessFactorsMin, false, true, -1, 6, g_Intrinsics_Args33},
-    {(UINT)hlsl::IntrinsicOp::IOP_ProcessIsolineTessFactors, false, true, -1, 5, g_Intrinsics_Args34},
-    {(UINT)hlsl::IntrinsicOp::IOP_ProcessQuadTessFactorsAvg, false, true, -1, 6, g_Intrinsics_Args35},
-    {(UINT)hlsl::IntrinsicOp::IOP_ProcessQuadTessFactorsMax, false, true, -1, 6, g_Intrinsics_Args36},
-    {(UINT)hlsl::IntrinsicOp::IOP_ProcessQuadTessFactorsMin, false, true, -1, 6, g_Intrinsics_Args37},
-    {(UINT)hlsl::IntrinsicOp::IOP_ProcessTriTessFactorsAvg, false, true, -1, 6, g_Intrinsics_Args38},
-    {(UINT)hlsl::IntrinsicOp::IOP_ProcessTriTessFactorsMax, false, true, -1, 6, g_Intrinsics_Args39},
-    {(UINT)hlsl::IntrinsicOp::IOP_ProcessTriTessFactorsMin, false, true, -1, 6, g_Intrinsics_Args40},
+    {(UINT)hlsl::IntrinsicOp::IOP_Process2DQuadTessFactorsAvg, false, false, -1, 6, g_Intrinsics_Args31},
+    {(UINT)hlsl::IntrinsicOp::IOP_Process2DQuadTessFactorsMax, false, false, -1, 6, g_Intrinsics_Args32},
+    {(UINT)hlsl::IntrinsicOp::IOP_Process2DQuadTessFactorsMin, false, false, -1, 6, g_Intrinsics_Args33},
+    {(UINT)hlsl::IntrinsicOp::IOP_ProcessIsolineTessFactors, false, false, -1, 5, g_Intrinsics_Args34},
+    {(UINT)hlsl::IntrinsicOp::IOP_ProcessQuadTessFactorsAvg, false, false, -1, 6, g_Intrinsics_Args35},
+    {(UINT)hlsl::IntrinsicOp::IOP_ProcessQuadTessFactorsMax, false, false, -1, 6, g_Intrinsics_Args36},
+    {(UINT)hlsl::IntrinsicOp::IOP_ProcessQuadTessFactorsMin, false, false, -1, 6, g_Intrinsics_Args37},
+    {(UINT)hlsl::IntrinsicOp::IOP_ProcessTriTessFactorsAvg, false, false, -1, 6, g_Intrinsics_Args38},
+    {(UINT)hlsl::IntrinsicOp::IOP_ProcessTriTessFactorsMax, false, false, -1, 6, g_Intrinsics_Args39},
+    {(UINT)hlsl::IntrinsicOp::IOP_ProcessTriTessFactorsMin, false, false, -1, 6, g_Intrinsics_Args40},
     {(UINT)hlsl::IntrinsicOp::IOP_QuadReadAcrossDiagonal, false, false, -1, 2, g_Intrinsics_Args41},
     {(UINT)hlsl::IntrinsicOp::IOP_QuadReadAcrossX, false, false, -1, 2, g_Intrinsics_Args42},
     {(UINT)hlsl::IntrinsicOp::IOP_QuadReadAcrossY, false, false, -1, 2, g_Intrinsics_Args43},
@@ -1359,7 +1359,7 @@ static const HLSL_INTRINSIC g_Intrinsics[] =
     {(UINT)hlsl::IntrinsicOp::IOP_mad, false, true, -1, 4, g_Intrinsics_Args119},
     {(UINT)hlsl::IntrinsicOp::IOP_max, false, true, -1, 3, g_Intrinsics_Args120},
     {(UINT)hlsl::IntrinsicOp::IOP_min, false, true, -1, 3, g_Intrinsics_Args121},
-    {(UINT)hlsl::IntrinsicOp::IOP_modf, false, true, -1, 3, g_Intrinsics_Args122},
+    {(UINT)hlsl::IntrinsicOp::IOP_modf, false, false, -1, 3, g_Intrinsics_Args122},
     {(UINT)hlsl::IntrinsicOp::IOP_msad4, false, true, -1, 4, g_Intrinsics_Args123},
     {(UINT)hlsl::IntrinsicOp::IOP_mul, false, true, -1, 3, g_Intrinsics_Args124},
     {(UINT)hlsl::IntrinsicOp::IOP_mul, false, true, -1, 3, g_Intrinsics_Args125},
@@ -1741,7 +1741,7 @@ static const HLSL_INTRINSIC g_Texture1DMethods[] =
     {(UINT)hlsl::IntrinsicOp::MOP_SampleGrad, true, false, -1, 5, g_Texture1DMethods_Args24},
     {(UINT)hlsl::IntrinsicOp::MOP_SampleGrad, true, false, -1, 6, g_Texture1DMethods_Args25},
     {(UINT)hlsl::IntrinsicOp::MOP_SampleGrad, false, false, -1, 7, g_Texture1DMethods_Args26},
-    {(UINT)hlsl::IntrinsicOp::MOP_SampleGrad, true, false, -1, 8, g_Texture1DMethods_Args27},
+    {(UINT)hlsl::IntrinsicOp::MOP_SampleGrad, false, false, -1, 8, g_Texture1DMethods_Args27},
     {(UINT)hlsl::IntrinsicOp::MOP_SampleLevel, true, false, -1, 4, g_Texture1DMethods_Args28},
     {(UINT)hlsl::IntrinsicOp::MOP_SampleLevel, true, false, -1, 5, g_Texture1DMethods_Args29},
     {(UINT)hlsl::IntrinsicOp::MOP_SampleLevel, false, false, -1, 6, g_Texture1DMethods_Args30},
@@ -2921,7 +2921,7 @@ static const HLSL_INTRINSIC g_Texture2DMSMethods[] =
     {(UINT)hlsl::IntrinsicOp::MOP_GetSamplePosition, true, false, -1, 2, g_Texture2DMSMethods_Args2},
     {(UINT)hlsl::IntrinsicOp::MOP_Load, false, false, -1, 3, g_Texture2DMSMethods_Args3},
     {(UINT)hlsl::IntrinsicOp::MOP_Load, false, false, -1, 4, g_Texture2DMSMethods_Args4},
-    {(UINT)hlsl::IntrinsicOp::MOP_Load, true, false, -1, 5, g_Texture2DMSMethods_Args5},
+    {(UINT)hlsl::IntrinsicOp::MOP_Load, false, false, -1, 5, g_Texture2DMSMethods_Args5},
 };
 
 //
@@ -4831,7 +4831,7 @@ static const HLSL_INTRINSIC g_TextureCUBEArrayMethods[] =
     {(UINT)hlsl::IntrinsicOp::MOP_SampleCmp, true, false, -1, 5, g_TextureCUBEArrayMethods_Args33},
     {(UINT)hlsl::IntrinsicOp::MOP_SampleCmp, false, false, -1, 6, g_TextureCUBEArrayMethods_Args34},
     {(UINT)hlsl::IntrinsicOp::MOP_SampleCmpLevelZero, true, false, -1, 4, g_TextureCUBEArrayMethods_Args35},
-    {(UINT)hlsl::IntrinsicOp::MOP_SampleCmpLevelZero, true, false, -1, 5, g_TextureCUBEArrayMethods_Args36},
+    {(UINT)hlsl::IntrinsicOp::MOP_SampleCmpLevelZero, false, false, -1, 5, g_TextureCUBEArrayMethods_Args36},
     {(UINT)hlsl::IntrinsicOp::MOP_SampleGrad, true, false, -1, 5, g_TextureCUBEArrayMethods_Args37},
     {(UINT)hlsl::IntrinsicOp::MOP_SampleGrad, true, false, -1, 6, g_TextureCUBEArrayMethods_Args38},
     {(UINT)hlsl::IntrinsicOp::MOP_SampleGrad, false, false, -1, 7, g_TextureCUBEArrayMethods_Args39},

+ 16 - 0
tools/clang/test/CodeGenHLSL/modf.hlsl

@@ -0,0 +1,16 @@
+// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
+
+// CHECK: Round_z
+
+float test(float a)
+{
+  float b;
+  modf(a, b);
+  return b;
+}
+
+
+float4 main(float a : A) : SV_TARGET
+{
+   return test(a);
+}

+ 5 - 0
tools/clang/unittests/HLSL/CompilerTest.cpp

@@ -542,6 +542,7 @@ public:
   TEST_METHOD(CodeGenMinprec5)
   TEST_METHOD(CodeGenMinprec6)
   TEST_METHOD(CodeGenMinprec7)
+  TEST_METHOD(CodeGenModf)
   TEST_METHOD(CodeGenMinprecCast)
   TEST_METHOD(CodeGenMultiUAVLoad1)
   TEST_METHOD(CodeGenMultiUAVLoad2)
@@ -2916,6 +2917,10 @@ TEST_F(CompilerTest, CodeGenMinprec7) {
   CodeGenTestCheck(L"..\\CodeGenHLSL\\minprec7.hlsl");
 }
 
+TEST_F(CompilerTest, CodeGenModf) {
+  CodeGenTestCheck(L"..\\CodeGenHLSL\\modf.hlsl");
+}
+
 TEST_F(CompilerTest, CodeGenMinprecCast) {
   CodeGenTest(L"..\\CodeGenHLSL\\minprec_cast.hlsl");
 }

+ 14 - 14
utils/hct/gen_intrin_main.txt

@@ -166,7 +166,7 @@ $type1 [[rn]] log2(in float_like<> x);
 $type1 [[rn,unsigned_op=umad]] mad(in numeric<> a, in $type1 b, in $type1 c);
 $type1 [[rn,unsigned_op=umax]] max(in numeric<> a, in $type1 b);
 $type1 [[rn,unsigned_op=umin]] min(in numeric<> a, in $type1 b);
-$type1 [[rn]] modf(in float_like<> x, out $type1 ip);
+$type1 [[]] modf(in float_like<> x, out $type1 ip);
 uint<4> [[rn]] msad4(in uint reference, in uint<2> source, in uint<4> accum);
 numeric [[rn]] mul(in $match<1, 0> numeric a, in $match<2, 0> numeric b) : mul_ss;
 numeric<c2> [[rn]] mul(in $match<1, 0> numeric a, in $match<2, 0> numeric<c2> b) : mul_sv;
@@ -180,16 +180,16 @@ numeric<r, c2> [[rn,unsigned_op=umul]] mul(in row_major $match<1, 0> numeric<r,
 $type1 [[rn]] normalize(in float_like<c> x);
 $type1 [[rn]] pow(in float_like<> x, in $type1 y);
 // void printf(in string Format, ...);
-void [[rn]] Process2DQuadTessFactorsAvg(in float<4> RawEdgeFactors, in float<2> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_2dqavg;
-void [[rn]] Process2DQuadTessFactorsMax(in float<4> RawEdgeFactors, in float<2> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_2dqmax;
-void [[rn]] Process2DQuadTessFactorsMin(in float<4> RawEdgeFactors, in float<2> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_2dqmin;
-void [[rn]] ProcessIsolineTessFactors(in float<1> RawDetailFactor, in float<1> RawDensityFactor, out float<1> RoundedDetailFactorr, out float<1> RoundedDensityFactor) : ptf_i;
-void [[rn]] ProcessQuadTessFactorsAvg(in float<4> RawEdgeFactors, in float<1> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_qavg;
-void [[rn]] ProcessQuadTessFactorsMax(in float<4> RawEdgeFactors, in float<1> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_qmax;
-void [[rn]] ProcessQuadTessFactorsMin(in float<4> RawEdgeFactors, in float<1> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_qmin;
-void [[rn]] ProcessTriTessFactorsAvg(in float<3> RawEdgeFactors, in float<1> InsideScale, out float<3> RoundedEdgeFactors, out float<1> RoundedInsideFactor, out float<1> UnroundedInsideFactor) : ptf_tmin;
-void [[rn]] ProcessTriTessFactorsMax(in float<3> RawEdgeFactors, in float<1> InsideScale, out float<3> RoundedEdgeFactors, out float<1> RoundedInsideFactor, out float<1> UnroundedInsideFactor) : ptf_tmax;
-void [[rn]] ProcessTriTessFactorsMin(in float<3> RawEdgeFactors, in float<1> InsideScale, out float<3> RoundedEdgeFactors, out float<1> RoundedInsideFactor, out float<1> UnroundedInsideFactor) : ptf_tavg;
+void [[]] Process2DQuadTessFactorsAvg(in float<4> RawEdgeFactors, in float<2> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_2dqavg;
+void [[]] Process2DQuadTessFactorsMax(in float<4> RawEdgeFactors, in float<2> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_2dqmax;
+void [[]] Process2DQuadTessFactorsMin(in float<4> RawEdgeFactors, in float<2> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_2dqmin;
+void [[]] ProcessIsolineTessFactors(in float<1> RawDetailFactor, in float<1> RawDensityFactor, out float<1> RoundedDetailFactorr, out float<1> RoundedDensityFactor) : ptf_i;
+void [[]] ProcessQuadTessFactorsAvg(in float<4> RawEdgeFactors, in float<1> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_qavg;
+void [[]] ProcessQuadTessFactorsMax(in float<4> RawEdgeFactors, in float<1> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_qmax;
+void [[]] ProcessQuadTessFactorsMin(in float<4> RawEdgeFactors, in float<1> InsideScale, out float<4> RoundedEdgeFactors, out float<2> RoundedInsideFactors, out float<2> UnroundedInsideFactors) : ptf_qmin;
+void [[]] ProcessTriTessFactorsAvg(in float<3> RawEdgeFactors, in float<1> InsideScale, out float<3> RoundedEdgeFactors, out float<1> RoundedInsideFactor, out float<1> UnroundedInsideFactor) : ptf_tmin;
+void [[]] ProcessTriTessFactorsMax(in float<3> RawEdgeFactors, in float<1> InsideScale, out float<3> RoundedEdgeFactors, out float<1> RoundedInsideFactor, out float<1> UnroundedInsideFactor) : ptf_tmax;
+void [[]] ProcessTriTessFactorsMin(in float<3> RawEdgeFactors, in float<1> InsideScale, out float<3> RoundedEdgeFactors, out float<1> RoundedInsideFactor, out float<1> UnroundedInsideFactor) : ptf_tavg;
 $type1 [[rn]] radians(in float_like<> x);
 $type1 [[rn]] rcp(in any_float<> x) : rcp_approx;
 $type1 [[rn]] reflect(in float_like<c> i, in $type1 n);
@@ -305,7 +305,7 @@ $unspec [[]] SampleLevel(in sampler s, in float_like<1> x, in float lod, in int<
 $unspec [[ro]] SampleBias(in sampler s, in float_like<1> x, in float bias, in int<1> o, in float clamp) : tex1d_t_bias_o_cl;
 $unspec [[]] SampleBias(in sampler s, in float_like<1> x, in float bias, in int<1> o, in float clamp, out uint_only status) : tex1d_t_bias_o_cl_s;
 $unspec [[]] SampleGrad(in sampler s, in float_like<1> x, in $type2 ddx, in $type2 ddy, in int<1> o, in float clamp) : tex1d_t_dd_o_cl;
-$unspec [[ro]] SampleGrad(in sampler s, in float_like<1> x, in $type2 ddx, in $type2 ddy, in int<1> o, in float clamp, out uint_only status) : tex1d_t_dd_o_cl_s;
+$unspec [[]] SampleGrad(in sampler s, in float_like<1> x, in $type2 ddx, in $type2 ddy, in int<1> o, in float clamp, out uint_only status) : tex1d_t_dd_o_cl_s;
 } namespace
 
 namespace Texture1DArrayMethods {
@@ -433,7 +433,7 @@ void [[]] GetDimensions(out float_like width, out $type1 height, out $type2 samp
 float_like<2> [[ro]] GetSamplePosition(in int s) : samplepos;
 $unspec [[]] Load(in int<2> x, in int s) : texture2d_ms;
 $unspec [[]] Load(in int<2> x, in int s, in int<2> o) : texture2d_ms_o;
-$unspec [[ro]] Load(in int<2> x, in int s, in int<2> o, out uint_only status) : texture2d_ms_o_s;
+$unspec [[]] Load(in int<2> x, in int s, in int<2> o, out uint_only status) : texture2d_ms_o_s;
 
 } namespace
 
@@ -631,7 +631,7 @@ $unspec [[ro]] Sample(in sampler s, in float_like<4> x, in float clamp) : texcub
 $unspec [[]] Sample(in sampler s, in float_like<4> x, in float clamp, out uint_only status) : texcube_t_array_cl_s;
 float_like [[ro]] SampleCmp(in sampler_cmp s, in float_like<4> x, in float compareValue, in float clamp) : texcube_t_comp_array_cl;
 float_like [[]] SampleCmp(in sampler_cmp s, in float_like<4> x, in float compareValue, in float clamp, out uint_only status) : texcube_t_comp_array_cl_s;
-float_like [[ro]] SampleCmpLevelZero(in sampler_cmp s, in float_like<4> x, in float compareValue, out uint_only status) : texcube_t_comp_array_s;
+float_like [[]] SampleCmpLevelZero(in sampler_cmp s, in float_like<4> x, in float compareValue, out uint_only status) : texcube_t_comp_array_s;
 $unspec [[]] SampleLevel(in sampler s, in float_like<4> x, in float lod, out uint_only status) : texcube_t_lod_array_s;
 $unspec [[ro]] SampleBias(in sampler s, in float_like<4> x, in float bias, in float clamp) : texcube_t_bias_array_cl;
 $unspec [[]] SampleBias(in sampler s, in float_like<4> x, in float bias, in float clamp, out uint_only status) : texcube_t_bias_array_cl_s;