[llvm] MIPS: Support '%w' token in inline asm template for MSA (PR #91920)

YunQiang Su via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 17:49:34 PDT 2024


================
@@ -565,12 +565,27 @@ bool MipsAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
       }
       break;
     }
-    case 'w':
-      // Print MSA registers for the 'f' constraint
-      // In LLVM, the 'w' modifier doesn't need to do anything.
-      // We can just call printOperand as normal.
+    case 'w': {
+      // Support to use MSA instructions on FPR.
+      // double a, b, c;
+      // asm volatile ("fmadd.d %w0, %w1, %w2" : "+f"(a) : "f"(b), "f"(c))
----------------
wzssyqa wrote:

Without this patch, `asm volatile ("fmadd.d %w0, %w1, %w2" : "+f"(a) : "f"(b), "f"(c))` will emit
```
fmadd.d $f12, $f13, $f14"
```
And then the assembler rejects it. 

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


More information about the llvm-commits mailing list