From c3c4928f0f4527a4f966f31964ba7170b1a2315d Mon Sep 17 00:00:00 2001 From: NanQin555 <3135247064@qq.com> Date: Mon, 19 Aug 2024 15:53:45 +0800 Subject: [PATCH] --- RISCVLib/CacheLib.cpp | 5 +++-- RISCVLib/CacheLib.s | 17 +++-------------- include/RISCVSupport/cachelib.hpp | 20 ++++---------------- upload.sh | 2 +- 4 files changed, 11 insertions(+), 33 deletions(-) diff --git a/RISCVLib/CacheLib.cpp b/RISCVLib/CacheLib.cpp index 6020f534..4fec49ee 100644 --- a/RISCVLib/CacheLib.cpp +++ b/RISCVLib/CacheLib.cpp @@ -11,8 +11,9 @@ struct CacheEntity CacheEntity list[1023]; constexpr unsigned int m1 = 1023, m2 = 1021; CacheEntity* CacheLookUp(int param1, int param2) { - unsigned long int key = (static_cast(param1) & static_cast(param2)) << 32; - key |= (static_cast(param1) | static_cast(param2)); + // unsigned long int key = (static_cast(param1) & static_cast(param2)) << 32; + // key |= (static_cast(param1) | static_cast(param2)); + unsigned long int key = (static_cast(param1) << 32 | static_cast(param2)); const auto hash = key % m1, step = 1 + key % m2; unsigned int cur = hash; constexpr unsigned int max = 5; diff --git a/RISCVLib/CacheLib.s b/RISCVLib/CacheLib.s index 0c2eb2d6..ad7e40b1 100644 --- a/RISCVLib/CacheLib.s +++ b/RISCVLib/CacheLib.s @@ -22,7 +22,7 @@ _ZL2m2: .globl CacheLookUp .type CacheLookUp, @function CacheLookUp: -.LFB0: +.LFB0_cache: .cfi_startproc addi sp,sp,-96 .cfi_def_cfa_offset 96 @@ -36,20 +36,9 @@ CacheLookUp: mv a5,a4 sw a5,-88(s0) lw a5,-84(s0) - mv a4,a5 - lw a5,-88(s0) - and a5,a4,a5 - sext.w a5,a5 - slli a5,a5,32 - sd a5,-32(s0) - lw a5,-84(s0) - mv a4,a5 + slli a4,a5,32 lw a5,-88(s0) or a5,a4,a5 - sext.w a5,a5 - mv a4,a5 - ld a5,-32(s0) - or a5,a5,a4 sd a5,-32(s0) ld a4,-32(s0) li a5,1023 @@ -133,5 +122,5 @@ CacheLookUp: .cfi_def_cfa_offset 0 jr ra .cfi_endproc -.LFE0: +.LFE0_cache: .size CacheLookUp, .-CacheLookUp \ No newline at end of file diff --git a/include/RISCVSupport/cachelib.hpp b/include/RISCVSupport/cachelib.hpp index 46614ca1..f06d43bb 100644 --- a/include/RISCVSupport/cachelib.hpp +++ b/include/RISCVSupport/cachelib.hpp @@ -22,7 +22,7 @@ R"( .text .globl CacheLookUp .type CacheLookUp, @function CacheLookUp: -.LFB0: +.LFB0_cache: .cfi_startproc addi sp,sp,-96 .cfi_def_cfa_offset 96 @@ -36,20 +36,9 @@ R"( .text mv a5,a4 sw a5,-88(s0) lw a5,-84(s0) - mv a4,a5 - lw a5,-88(s0) - and a5,a4,a5 - sext.w a5,a5 - slli a5,a5,32 - sd a5,-32(s0) - lw a5,-84(s0) - mv a4,a5 + slli a4,a5,32 lw a5,-88(s0) or a5,a4,a5 - sext.w a5,a5 - mv a4,a5 - ld a5,-32(s0) - or a5,a5,a4 sd a5,-32(s0) ld a4,-32(s0) li a5,1023 @@ -133,6 +122,5 @@ R"( .text .cfi_def_cfa_offset 0 jr ra .cfi_endproc -.LFE0: - .size CacheLookUp, .-CacheLookUp -)" \ No newline at end of file +.LFE0_cache: + .size CacheLookUp, .-CacheLookUp)" \ No newline at end of file diff --git a/upload.sh b/upload.sh index 38d0975f..2c8992a4 100644 --- a/upload.sh +++ b/upload.sh @@ -1,7 +1,7 @@ #!/bin/bash # 本地上传文件夹的绝对路径 -LOCAL_DIR="/home/nanqin/compiler/miniC-compiler/uploadfolder" +LOCAL_DIR="./uploadfolder" # 远程服务器的目标路径 REMOTE_USER="user"