[ARM64] Add a PostEncoderMethod to FCMP - the Rm field should canonically be zero...
authorBradley Smith <bradley.smith@arm.com>
Wed, 9 Apr 2014 14:43:40 +0000 (14:43 +0000)
committerBradley Smith <bradley.smith@arm.com>
Wed, 9 Apr 2014 14:43:40 +0000 (14:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205883 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM64/ARM64InstrFormats.td
lib/Target/ARM64/MCTargetDesc/ARM64MCCodeEmitter.cpp
test/MC/Disassembler/ARM64/canonical-form.txt

index 83a64dc43d74e2ef21cdd4be1ade32988ef1fe20..bd16e12db78f4c3fcdce12238516c99c3a33fe89 100644 (file)
@@ -3502,11 +3502,13 @@ class BaseOneOperandFPComparison<bit signalAllNans,
   let Inst{31-23} = 0b000111100;
   let Inst{21}    = 1;
 
-  let Inst{20-16} = 0b00000;
   let Inst{15-10} = 0b001000;
   let Inst{9-5}   = Rn;
   let Inst{4}     = signalAllNans;
   let Inst{3-0}   = 0b1000;
+
+  // Rm should be 0b00000 canonically, but we need to accept any value.
+  let PostEncoderMethod = "fixOneOperandFPComparison";
 }
 
 let mayLoad = 0, mayStore = 0, hasSideEffects = 0 in
index 5d4651cf274c2b33a8870f4cf6692ffdbd3f93e0..95020e4395edc9b93712975d704032dcb7f0a941 100644 (file)
@@ -184,6 +184,8 @@ public:
   fixLoadStoreExclusive(const MCInst &MI, unsigned EncodedValue,
                         const MCSubtargetInfo &STI) const;
 
+  unsigned fixOneOperandFPComparison(const MCInst &MI, unsigned EncodedValue,
+                                     const MCSubtargetInfo &STI) const;
 };
 
 } // end anonymous namespace
@@ -588,4 +590,14 @@ ARM64MCCodeEmitter::fixLoadStoreExclusive(const MCInst &MI,
   return EncodedValue;
 }
 
+unsigned
+ARM64MCCodeEmitter::fixOneOperandFPComparison(const MCInst &MI,
+                                              unsigned EncodedValue,
+                                              const MCSubtargetInfo &STI) const {
+  // The Rm field of FCMP and friends is unused - it should be assembled
+  // as 0, but is ignored by the processor.
+  EncodedValue &= ~(0x1f << 16);
+  return EncodedValue;
+}
+
 #include "ARM64GenMCCodeEmitter.inc"
index ccc93e6e956b9c25ff3bcdc265a6a3c4d7b20cb6..3172fd2521faaf5b163b99d05891102dc9e8e378 100644 (file)
@@ -7,3 +7,7 @@
 0x00 0x00 0x40 0x9b
 
 # CHECK: smulh x0, x0, x0
+
+0x08 0x20 0x21 0x1e
+
+# CHECK: fcmp s0, #0.0