[PowerPC] Parse and ignore .machine
authorFangrui Song <i@maskray.me>
Mon, 28 Dec 2020 20:20:39 +0000 (12:20 -0800)
committerFangrui Song <i@maskray.me>
Mon, 28 Dec 2020 20:20:40 +0000 (12:20 -0800)
glibc/sysdeps/powerpc/powerpc64 has .machine
{altivec,power4,power5,power6,power7,power8} (.machine power9 is planned in
sysdeps/powerpc/powerpc64/power9/strcmp.S).
The diagnostic is not useful anyway so just delete it.

llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
llvm/test/MC/PowerPC/ppc-machine.s

index 2ff87c2..085acff 100644 (file)
@@ -1656,11 +1656,7 @@ bool PPCAsmParser::ParseDirectiveMachine(SMLoc L) {
 
   // FIXME: Right now, the parser always allows any available
   // instruction, so the .machine directive is not useful.
-  // Implement ".machine any" (by doing nothing) for the benefit
-  // of existing assembler code.  Likewise, we can then implement
-  // ".machine push" and ".machine pop" as no-op.
-  if (CPU != "any" && CPU != "push" && CPU != "pop" && CPU != "ppc64")
-    return TokError("unrecognized machine type");
+  // In the wild, any/push/pop/ppc64/altivec/power[4-9] are seen.
 
   Parser.Lex();
 
index 22a6cd7..f7b71f8 100644 (file)
@@ -15,3 +15,8 @@
        .machine "pop"
 
        .machine ppc64
+
+# Used in glibc.
+       .machine altivec
+       .machine power4
+       .machine power8