From e22894353869092c9da4977ec9ef74afa94cf57a Mon Sep 17 00:00:00 2001 From: Alec Roelke Date: Sat, 2 Dec 2017 12:58:14 -0500 Subject: arch-riscv: Make use of ImmOp's polymorphism This patch makes use of ImmOp's polymorphism to remove unnecessary casting from the implementations of arithmetic instructions with immediate operands and to remove the CUIOp format by combining it with the CIOp format (compressed arithmetic instructions with immediate operands). Interestingly, RISC-V specifies that instructions with unsigned immediate operands still need to sign-extend the immediates from 12 (or 20) bits to 64 bits, so that is left alone. Change-Id: If20d70c1e90f379b9ed8a4155b2b9222b6defe16 Reviewed-on: https://gem5-review.googlesource.com/6401 Reviewed-by: Jason Lowe-Power Reviewed-by: Tuan Ta Maintainer: Alec Roelke --- .../insttest/bin/riscv/linux-rv64i/insttest | Bin 14034904 -> 14035216 bytes tests/test-progs/insttest/src/riscv/rv64i.cpp | 1 + 2 files changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/test-progs/insttest/bin/riscv/linux-rv64i/insttest b/tests/test-progs/insttest/bin/riscv/linux-rv64i/insttest index a6e5d0203..c5a21739d 100755 Binary files a/tests/test-progs/insttest/bin/riscv/linux-rv64i/insttest and b/tests/test-progs/insttest/bin/riscv/linux-rv64i/insttest differ diff --git a/tests/test-progs/insttest/src/riscv/rv64i.cpp b/tests/test-progs/insttest/src/riscv/rv64i.cpp index 95e8ee02a..cfe5e298d 100644 --- a/tests/test-progs/insttest/src/riscv/rv64i.cpp +++ b/tests/test-progs/insttest/src/riscv/rv64i.cpp @@ -137,6 +137,7 @@ int main() // SLTIU expect(false, []{return I::sltiu(-1, 0);}, "sltiu, false"); expect(true, []{return I::sltiu(0, -1);}, "sltiu, true"); + expect(true, []{return I::sltiu(0xFFFF, -1);}, "sltiu, sext"); // XORI expect(0xFF, []{return I::xori(0xAA, 0x55);}, "xori (1)"); -- cgit v1.2.3