Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[RISCV] Change the InstFormat for Zicbop prefetch instructions to InstFormatOther.#148934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
topperc merged 1 commit intollvm:mainfromtopperc:pr/prefetch-format
Jul 15, 2025

Conversation

topperc
Copy link
Collaborator

The lower 5-bits of the immediate are not part of the address unlike other InstFormatS instructions.

We use InstFormatS in RISCVRegisterInfo::needsFrameBaseReg and RISCVRegisterInfo::getFrameIndexInstrOffset which is not aware of this special encoding. Force the format to InstFormatOther so those functions will ignore it.

InstFormatS is also used by relocation emission, but I don't believe we ever emit these instructions with a relocation because of the encoding.

…tFormatOther.The lower 5-bits of the immediate are not part of the address unlikeother InstFormatS instructions.We use InstFormatS in RISCVRegisterInfo::needsFrameBaseRegand RISCVRegisterInfo::getFrameIndexInstrOffset which is not aware ofthis special encoding. Force the format to InstFormatOther so thosefunctions will ignore it.InstFormatS is also used by relocation emission, but I don't believewe ever emit these instructions with a relocation because of the encoding.
@llvmbot
Copy link
Member

@llvm/pr-subscribers-backend-risc-v

Author: Craig Topper (topperc)

Changes

The lower 5-bits of the immediate are not part of the address unlike other InstFormatS instructions.

We use InstFormatS in RISCVRegisterInfo::needsFrameBaseReg and RISCVRegisterInfo::getFrameIndexInstrOffset which is not aware of this special encoding. Force the format to InstFormatOther so those functions will ignore it.

InstFormatS is also used by relocation emission, but I don't believe we ever emit these instructions with a relocation because of the encoding.


Full diff:https://github.com/llvm/llvm-project/pull/148934.diff

2 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVInstrFormats.td (+3-1)
  • (modified) llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.td (+1)
diff --git a/llvm/lib/Target/RISCV/RISCVInstrFormats.td b/llvm/lib/Target/RISCV/RISCVInstrFormats.tdindex b6b64b57b1b3e..e23001a3a0bff 100644--- a/llvm/lib/Target/RISCV/RISCVInstrFormats.td+++ b/llvm/lib/Target/RISCV/RISCVInstrFormats.td@@ -193,7 +193,9 @@ class RVInstCommon<dag outs, dag ins, string opcodestr, string argstr,   let AsmString = opcodestr # !if(!empty(argstr), "", "\t" # argstr);   let Pattern = pattern;-  let TSFlags{4-0} = format.Value;+  InstFormat Format = format;++  let TSFlags{4-0} = Format.Value;    // Defaults   RISCVVConstraint RVVConstraint = NoConstraint;diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.tdindex 878b85b141578..0723b2f568a79 100644--- a/llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.td+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZicbo.td@@ -41,6 +41,7 @@ class Prefetch_ri<bits<5> optype, string opcodestr>               opcodestr, "${imm12}(${rs1})"> {   let Inst{11-7} = 0b00000;   let rs2 = optype;+  let Format = InstFormatOther; // this does not follow the normal S format. }  //===----------------------------------------------------------------------===//

Copy link
Member

@lenarylenary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM. Thanks.

@topperctopperc merged commitb64d7ba intollvm:mainJul 15, 2025
10 of 11 checks passed
@topperctopperc deleted the pr/prefetch-format branchJuly 15, 2025 21:49
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@lenarylenarylenary approved these changes

@asbasbAwaiting requested review from asb

@wangpc-ppwangpc-ppAwaiting requested review from wangpc-pp

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@topperc@llvmbot@lenary

[8]ページ先頭

©2009-2025 Movatter.jp