arch-gcn3: Add memcpy condition when writing EXEC_LO
authorMatthew Poremba <matthew.poremba@amd.com>
Mon, 25 Feb 2019 23:32:03 +0000 (15:32 -0800)
committerAnthony Gutierrez <anthony.gutierrez@amd.com>
Fri, 17 Jul 2020 16:31:10 +0000 (16:31 +0000)
Some compilers emit an error on the operand template class when writing
exec mask. Add a condition to explicitly set memcpy size argument to
32b or 64b based on the number of dwords.

Change-Id: I49b0e4a1680283e772d0a5a8efd687b31d4f1624
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29961
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/gcn3/operand.hh

index 9d28deb3016b87202660813c350e622d9e9be624..97c6310d38e2bfeb657422796cbb8a610c6fc724 100644 (file)
@@ -437,8 +437,15 @@ namespace Gcn3ISA
                 if (_opIdx == REG_EXEC_LO) {
                     ScalarRegU64 new_exec_mask_val
                         = wf->execMask().to_ullong();
-                    std::memcpy((void*)&new_exec_mask_val,
-                        (void*)srfData.data(), sizeof(srfData));
+                    if (NumDwords == 1) {
+                        std::memcpy((void*)&new_exec_mask_val,
+                            (void*)srfData.data(), sizeof(VecElemU32));
+                    } else if (NumDwords == 2) {
+                        std::memcpy((void*)&new_exec_mask_val,
+                            (void*)srfData.data(), sizeof(VecElemU64));
+                    } else {
+                        panic("Trying to write more than 2 DWORDS to EXEC\n");
+                    }
                     VectorMask new_exec_mask(new_exec_mask_val);
                     wf->execMask() = new_exec_mask;
                     DPRINTF(GPUSRF, "Write EXEC\n");