@@ -1993,8 +1993,27 @@ void TestOptimizationSteps::testCombineDMALoads()
19931993
19941994 auto testCombineDMALoadsSub = [&](Module& module , Method& inputMethod, Configuration& config, DataType vectorType) {
19951995
1996+ uint8_t elementBitCount = vectorType.getElementType ().getScalarBitCount ();
1997+ uint8_t dmaSetupMode = 0 ;
1998+ uint8_t vpitch = 1 ;
1999+ switch (elementBitCount)
2000+ {
2001+ case 8 :
2002+ dmaSetupMode = 4 ;
2003+ vpitch = 4 ;
2004+ break ;
2005+ case 16 :
2006+ dmaSetupMode = 2 ;
2007+ vpitch = 2 ;
2008+ break ;
2009+ case 32 :
2010+ dmaSetupMode = 0 ;
2011+ vpitch = 1 ;
2012+ break ;
2013+ }
2014+
19962015 const int numOfLoads = 3 ;
1997- periphery::VPRDMASetup expectedDMASetup (0 , vectorType.getVectorWidth () % 16 , numOfLoads, 1 , 0 );
2016+ periphery::VPRDMASetup expectedDMASetup (dmaSetupMode , vectorType.getVectorWidth () % 16 , numOfLoads, vpitch , 0 );
19982017
19992018 inputMethod.dumpInstructions ();
20002019
@@ -2086,8 +2105,10 @@ void TestOptimizationSteps::testCombineDMALoads()
20862105 Module module {config};
20872106 Method inputMethod (module );
20882107
2108+ const DataType FloatPtr = inputMethod.createPointerType (TYPE_FLOAT);
2109+
20892110 auto inIt = inputMethod.createAndInsertNewBlock (inputMethod.end (), " %dummy" ).walkEnd ();
2090- auto in = assign (inIt, TYPE_INT32 , " %in" ) = UNIFORM_REGISTER;
2111+ auto in = assign (inIt, FloatPtr , " %in" ) = UNIFORM_REGISTER;
20912112
20922113 putMethodCall (inputMethod, inIt, Float16, vload16f, {0_val, in});
20932114 putMethodCall (inputMethod, inIt, Float16, vload16f, {1_val, in});
@@ -2102,8 +2123,10 @@ void TestOptimizationSteps::testCombineDMALoads()
21022123 Module module {config};
21032124 Method inputMethod (module );
21042125
2126+ const DataType FloatPtr = inputMethod.createPointerType (TYPE_FLOAT);
2127+
21052128 auto inIt = inputMethod.createAndInsertNewBlock (inputMethod.end (), " %dummy" ).walkEnd ();
2106- auto in = assign (inIt, TYPE_INT32 , " %in" ) = UNIFORM_REGISTER;
2129+ auto in = assign (inIt, FloatPtr , " %in" ) = UNIFORM_REGISTER;
21072130
21082131 putMethodCall (inputMethod, inIt, Float8, vload8f, {0_val, in});
21092132 putMethodCall (inputMethod, inIt, Float8, vload8f, {1_val, in});
@@ -2118,8 +2141,10 @@ void TestOptimizationSteps::testCombineDMALoads()
21182141 Module module {config};
21192142 Method inputMethod (module );
21202143
2144+ const DataType Int8Ptr = inputMethod.createPointerType (TYPE_INT8);
2145+
21212146 auto inIt = inputMethod.createAndInsertNewBlock (inputMethod.end (), " %dummy" ).walkEnd ();
2122- auto in = assign (inIt, TYPE_INT32 , " %in" ) = UNIFORM_REGISTER;
2147+ auto in = assign (inIt, Int8Ptr , " %in" ) = UNIFORM_REGISTER;
21232148
21242149 putMethodCall (inputMethod, inIt, Uchar16, vload16uc, {0_val, in});
21252150 putMethodCall (inputMethod, inIt, Uchar16, vload16uc, {1_val, in});
@@ -2134,8 +2159,11 @@ void TestOptimizationSteps::testCombineDMALoads()
21342159 Module module {config};
21352160 Method inputMethod (module );
21362161
2162+ const DataType FloatPtr = inputMethod.createPointerType (TYPE_FLOAT);
2163+
21372164 auto inIt = inputMethod.createAndInsertNewBlock (inputMethod.end (), " %dummy" ).walkEnd ();
2138- auto in = assign (inIt, TYPE_INT32, " %in" ) = UNIFORM_REGISTER;
2165+ auto in = assign (inIt, FloatPtr, " %in" ) = UNIFORM_REGISTER;
2166+
21392167 auto offset1 = assign (inIt, TYPE_INT32, " %offset1" ) = 42_val;
21402168 auto offset2 = assign (inIt, TYPE_INT32, " %offset2" ) = offset1 + 1_val;
21412169 auto offset3 = assign (inIt, TYPE_INT32, " %offset3" ) = offset1 + 2_val;
0 commit comments