[clang] [llvm] [mlir] [IR] Explicitly specify target feature for module asm (PR #204548)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 22 00:21:39 PDT 2026


================
@@ -0,0 +1,12 @@
+; RUN: llc -mtriple=riscv64-unknown-linux-gnu < %s | FileCheck %s
+
+; This should work fine, because the module asm specifies the necessary
+; target features
+
+; CHECK: fld ft0, 0(sp)
----------------
nikic wrote:

Yeah, piping it into an assembler doesn't work. I checked how this is handled for target features on functions, and that's handled here for RISCV: https://github.com/llvm/llvm-project/blob/de045d579791d978cce109f9348d20560e112d74/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp#L530

Though, as far as I can tell, RISCV is the only architecture that actually handles this? I tried a bunch of others and for all of them using `"target-features"` on functions results in assembly that can't be parsed back by the assembler. E.g. here for AArch64: https://llvm.godbolt.org/z/6hE6zY3zf

https://github.com/llvm/llvm-project/pull/204548


More information about the cfe-commits mailing list