Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,12 @@ def BREAK : MISC_I15<0x002a0000>;
def RDTIMEL_W : RDTIME_2R<0x00006000>;
def RDTIMEH_W : RDTIME_2R<0x00006400>;

// The CPUCFG instruction offers a reliable way to probing CPU features.
// Although it's undefined on LA32R, adding compiler support enables the
Copy link
Contributor

@xen0n xen0n May 15, 2025

Choose a reason for hiding this comment

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

Maybe this is better: "Although support is not guaranteed on LA32R, having compiler support nevertheless enables applications to rely on its presence, potentially via kernel emulation if not available natively."

(Apparently it's not forbidden to have it included in a LA32R implementation, it's just not in the mandatory set.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks good to me. 😃

// Linux kernel to emulate it, making the functionality available to user
// space applications.
def CPUCFG : ALU_2R<0x00006c00>;

// Cache Maintenance Instructions
def CACOP : FmtCACOP<(outs), (ins uimm5:$op, GPR:$rj, simm12:$imm12),
"$op, $rj, $imm12">;
Expand Down Expand Up @@ -895,9 +901,6 @@ def MASKNEZ : ALU_3R<0x00138000>;
// Branch Instructions
def BEQZ : BrCCZ_1RI21<0x40000000>;
def BNEZ : BrCCZ_1RI21<0x44000000>;

// Other Miscellaneous Instructions
def CPUCFG : ALU_2R<0x00006c00>;
} // Predicates = [Has32S]

/// LA64 instructions
Expand Down