llvm / llvm/llvm-project

[RISC-V] Missed Zilsd opportunity in lmbench

Open
#188,438 4 comments 0 reactions 0 assignees View on GitHub
backend:RISC-V missed-optimization
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The fcp() function in lmbench is a perfect match for Zilsd.
However, llvm (and neither gcc) generate ld/sd on rv32.

This is the function:
https://sourceforge.net/p/lmbench/code/HEAD/tree/trunk/lmbench3/src/bw_mem.c#l374

This is a simpler reproducer:
https://godbolt.org/z/YMGqTbnGa

Contributor guide

Open the contributing guide

Research direction

Start with the fcp() function in lmbench3/src/bw_mem.c around line 374 and reproduce the rv32 case using the linked Compiler Explorer example. Inspect the generated code for the Zilsd opportunity and trace the relevant LLVM compiler path. Done means LLVM emits the expected ld/sd instructions for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.