diff options
author | Andrew Waterman <andrew@sifive.com> | 2022-07-18 15:15:41 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2022-07-18 15:15:41 -0700 |
commit | b0d9782e13156abd5884fa73017a0286441202d1 (patch) | |
tree | 154a16095707eab7ac4729b78cf50851e02b0282 | |
parent | 84b9d03c088af3a92505c82ff3160d984387248c (diff) | |
download | riscv-isa-sim-b0d9782e13156abd5884fa73017a0286441202d1.zip riscv-isa-sim-b0d9782e13156abd5884fa73017a0286441202d1.tar.gz riscv-isa-sim-b0d9782e13156abd5884fa73017a0286441202d1.tar.bz2 |
Fix load/store performance under clang
Hopefully for the last time :-)
-rw-r--r-- | riscv/common.h | 2 | ||||
-rw-r--r-- | riscv/mmu.h | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/riscv/common.h b/riscv/common.h index 002a83f..7d37001 100644 --- a/riscv/common.h +++ b/riscv/common.h @@ -8,11 +8,13 @@ # define unlikely(x) __builtin_expect(x, 0) # define NOINLINE __attribute__ ((noinline)) # define NORETURN __attribute__ ((noreturn)) +# define ALWAYS_INLINE __attribute__ ((always_inline)) #else # define likely(x) (x) # define unlikely(x) (x) # define NOINLINE # define NORETURN +# define ALWAYS_INLINE #endif #endif diff --git a/riscv/mmu.h b/riscv/mmu.h index 4e12805..6f24ec7 100644 --- a/riscv/mmu.h +++ b/riscv/mmu.h @@ -99,7 +99,7 @@ public: // template for functions that load an aligned value from memory #define load_func(type, prefix, xlate_flags) \ - inline type##_t prefix##_##type(reg_t addr, bool require_alignment = false) { \ + type##_t ALWAYS_INLINE prefix##_##type(reg_t addr, bool require_alignment = false) { \ if (unlikely(addr & (sizeof(type##_t)-1))) { \ if (require_alignment) load_reserved_address_misaligned(addr); \ else return misaligned_load(addr, sizeof(type##_t), xlate_flags); \ @@ -162,7 +162,7 @@ public: // template for functions that store an aligned value to memory #define store_func(type, prefix, xlate_flags) \ - void prefix##_##type(reg_t addr, type##_t val, bool actually_store=true, bool require_alignment=false) { \ + void ALWAYS_INLINE prefix##_##type(reg_t addr, type##_t val, bool actually_store=true, bool require_alignment=false) { \ if (unlikely(addr & (sizeof(type##_t)-1))) { \ if (require_alignment) store_conditional_address_misaligned(addr); \ else return misaligned_store(addr, val, sizeof(type##_t), xlate_flags, actually_store); \ |