https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233405

--- Comment #9 from Conrad Meyer <c...@freebsd.org> ---
More "necessary but not sufficient" IAS support (needed to compile libc).


--- contrib/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp  (revision
354566)
+++ contrib/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp  (working copy)
@@ -815,7 +815,7 @@
                                                  Parser.getTok().getLoc()));
     Parser.Lex(); // Eat the [

-    if (Mnemonic == "cas" || Mnemonic == "casx" || Mnemonic == "casa") {
+    if (Mnemonic == "cas" || Mnemonic == "casx" || Mnemonic == "casa" ||
Mnemonic == "casxa") {
       SMLoc S = Parser.getTok().getLoc();
       if (getLexer().getKind() != AsmToken::Percent)
         return MatchOperand_NoMatch;
@@ -1014,7 +1014,22 @@
       return true;
     }

-    // %fprs is an alias of %asr6.
+    // %asrN aliases.
+    if (name.equals("ccr")) {
+      RegNo = ASRRegs[2];
+      RegKind = SparcOperand::rk_Special;
+      return true;
+    }
+    if (name.equals("asi")) {
+      RegNo = ASRRegs[3];
+      RegKind = SparcOperand::rk_Special;
+      return true;
+    }
+    if (name.equals("pc")) {
+      RegNo = ASRRegs[5];
+      RegKind = SparcOperand::rk_Special;
+      return true;
+    }
     if (name.equals("fprs")) {
       RegNo = ASRRegs[6];
       RegKind = SparcOperand::rk_Special;
--- contrib/llvm/lib/Target/Sparc/SparcInstr64Bit.td    (revision 354566)
+++ contrib/llvm/lib/Target/Sparc/SparcInstr64Bit.td    (working copy)
@@ -495,6 +495,15 @@

 } // Predicates = [Is64Bit], Constraints = ...

+// CASX with explicit ASI; ASM-only, LLVM doesn't grok ASIs, etc, etc.
+let Predicates = [Is64Bit], Constraints = "$swap = $rd" in {
+  def CASXArr: F3_1_asi<3, 0b111110,
+                (outs I64Regs:$rd), (ins I64Regs:$rs1, i8imm:$asi,
+                                    I64Regs:$rs2, I64Regs:$swap),
+                 "casxa [$rs1] $asi, $rs2, $rd",
+                 []>;
+}
+
 let Predicates = [Is64Bit] in {

 def : Pat<(atomic_fence imm, imm), (MEMBARi 0xf)>;
--- contrib/llvm/lib/Target/Sparc/SparcInstrAliases.td  (revision 354566)
+++ contrib/llvm/lib/Target/Sparc/SparcInstrAliases.td  (working copy)
@@ -477,6 +477,8 @@

 // unimp -> unimp 0
 def : InstAlias<"unimp", (UNIMP 0), 0>;
+// illtrap -> unimp (same instruction, FreeBSD .S uses illtrap)
+def : MnemonicAlias<"illtrap", "unimp">;

 def : MnemonicAlias<"iflush", "flush">;

@@ -492,6 +494,9 @@
 def : MnemonicAlias<"stuha", "stha">;
 def : MnemonicAlias<"stsha", "stha">;

+// V8 ST renamed to STW in V9 (equivalent) (also: stuw, stsw, but we don't use
those)
+def : MnemonicAlias<"stw", "st">;
+
 def : MnemonicAlias<"lduw", "ld">, Requires<[HasV9]>;
 def : MnemonicAlias<"lduwa", "lda">, Requires<[HasV9]>;


Still runs into linking issues (using LLD) *very* early on (and ld.bfd
segfaults).  LLD.SPARC doesn't grok symbolic R_SPARC_64 relocations in shared
libraries (used by self-referential __dso_handle pointer in CRT), doesn't grok
GOT, and doesn't grok TLS relocations.  This probably needs someone with an
intimate knowledge of at least two out of three of: SPARCV9, LLD, and ELF
loader/linker model.  (Not to mention: time, and caring about 15-20 year old
dead hardware.)

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to