Skip to content
  1. Nov 25, 2013
    • David Peixotto's avatar
      ARM integrated assembler generates incorrect nop opcode · 7266731f
      David Peixotto authored
      This patch fixes a bug in the assembler that was causing bad code to
      be emitted.  When switching modes in an assembly file (e.g. arm to
      thumb mode) we would always emit the opcode from the original mode.
      
      Consider this small example:
      
      $ cat align.s
      .code 16
      foo:
        add r0, r0
      .align 3
        add r0, r0
      
      $ llvm-mc -triple armv7-none-linux align.s -filetype=obj -o t.o
      $ llvm-objdump -triple thumbv7 -d t.o
      Disassembly of section .text:
      foo:
             0:       00 44         add     r0, r0
             2:       00 f0 20 e3   blx #4195904
             6:       00 00         movs    r0, r0
             8:       00 44         add     r0, r0
      
      This shows that we have actually emitted an arm nop (e320f000)
      instead of a thumb nop. Unfortunately, this encodes to a thumb
      branch which causes bad things to happen when compiling assembly
      code with align directives.
      
      The fix is to notify the ARMAsmBackend when we switch mode. The
      MCMachOStreamer was already doing this correctly. This patch makes
      the same change for the MCElfStreamer.
      
      There is still a bug in the way nops are emitted for alignment
      because the MCAlignment fragment does not store the correct mode.
      The ARMAsmBackend will emit nops for the last mode it knew about. In
      the example above, we still generate an arm nop if we add a `.code
      32` to the end of the file.
      
      PR18019
      
      llvm-svn: 195677
      7266731f
  2. Nov 12, 2013
    • Tim Northover's avatar
      ARM: diagnose invalid system LDM/STM · 8eaf1543
      Tim Northover authored
      The system LDM and STM instructions can't usually writeback to the base
      register. The one exception is when an LDM is actually an exception-return
      (i.e. contains PC in the register list).
      
      (There's already a test that "ldm sp!, {r0-r3, pc}^" works, which is why there
      is no positive test).
      
      rdar://problem/15223374
      
      llvm-svn: 194512
      8eaf1543
  3. Nov 11, 2013
  4. Nov 08, 2013
  5. Nov 05, 2013
  6. Oct 29, 2013
  7. Oct 28, 2013
    • Rafael Espindola's avatar
      Convert another llc -filetype=obj test. · 940ca0ba
      Rafael Espindola authored
      llvm-svn: 193539
      940ca0ba
    • Lang Hames's avatar
      Return early from getUnconditionalBranchTargetOpValue if the branch target is · b5281661
      Lang Hames authored
      an MCExpr, in order to avoid writing an encoded zero value in the immediate
      field.
      
      When getUnconditionalBranchTargetOpValue is called with an MCExpr target, we
      don't know what the final immediate field value should be. We shouldn't
      explicitly set the immediate field to an encoded zero value as zero is encoded
      with a non-zero bit pattern. This leads to bits being set that pollute the
      final immediate value. The nature of the encoding is such that the polluted
      bits only affect very large immediate values, explaining why this hasn't
      caused problems earlier.
      
      Fixes <rdar://problem/15155975>.
      
      llvm-svn: 193535
      b5281661
    • Logan Chien's avatar
      [arm] Implement eabi_attribute, cpu, and fpu directives. · 8cbb80d1
      Logan Chien authored
      This commit allows the ARM integrated assembler to parse
      and assemble the code with .eabi_attribute, .cpu, and
      .fpu directives.
      
      To implement the feature, this commit moves the code from
      AttrEmitter to ARMTargetStreamers, and several new test
      cases related to cortex-m4, cortex-r5, and cortex-a15 are
      added.
      
      Besides, this commit also change the Subtarget->isFPOnlySP()
      to Subtarget->hasD16() to match the usage of .fpu directive.
      
      This commit changes the test cases:
      
      * Several .eabi_attribute directives in
        2010-09-29-mc-asm-header-test.ll are removed because the .fpu
        directive already cover the functionality.
      
      * In the Cortex-A15 test case, the value for
        Tag_Advanced_SIMD_arch has be changed from 1 to 2,
        which is more precise.
      
      llvm-svn: 193524
      8cbb80d1
  8. Oct 25, 2013
  9. Oct 24, 2013
    • Tim Northover's avatar
      ARM: Mark double-precision instructions as such · 5620faf7
      Tim Northover authored
      This prevents us from silently accepting invalid instructions on (for example)
      Cortex-M4 with just single-precision VFP support.
      
      No tests for the extra Pat Requires because they're essentially assertions: the
      affected code should have been lowered to libcalls before ISel.
      
      rdar://problem/15302004
      
      llvm-svn: 193354
      5620faf7
    • Tim Northover's avatar
      ARM: add a couple more NEON predicates. · 225bcbbe
      Tim Northover authored
      The fused multiply instructions were added in VFPv4 but are still NEON
      instructions, in particular they shouldn't be available on a Cortex-M4 not
      matter how floaty it is.
      
      llvm-svn: 193342
      225bcbbe
    • Tim Northover's avatar
      ARM: mark various aliases with their architecture requirements. · 64dacb2b
      Tim Northover authored
      If an alias inherits directly from InstAlias then it doesn't get any default
      "Requires" values, so llvm-mc will allow it even on architectures that don't
      support the underlying instruction.
      
      This tidies up the obvious VFP and NEON cases I found.
      
      llvm-svn: 193340
      64dacb2b
    • Tim Northover's avatar
      ARM: fix assert on unpredictable POP instruction. · 741e6ef4
      Tim Northover authored
      POP instructions are aliased to the ARM LDM variants but have different syntax.
      This caused two problems: we tried to access a non-existent operand to annotate
      the '!', and the error message didn't make much sense.
      
      With some vigorous hand-waving in the error message both problems can be
      fixed.
      
      llvm-svn: 193322
      741e6ef4
  10. Oct 23, 2013
  11. Oct 22, 2013
    • Tim Northover's avatar
      ARM: provide diagnostics on more writeback LDM/STM instructions · 08a86602
      Tim Northover authored
      The set of circumstances where the writeback register is allowed to be in the
      list of registers is rather baroque, but I think this implements them all on
      the assembly parsing side.
      
      For disassembly, we still warn about an ARM-mode LDM even if the architecture
      revision is < v7 (the required architecture information isn't available). It's
      a silly instruction anyway, so hopefully no-one will mind.
      
      rdar://problem/15223374
      
      llvm-svn: 193185
      08a86602
  12. Oct 18, 2013
  13. Oct 14, 2013
  14. Oct 11, 2013
  15. Oct 07, 2013
  16. Oct 05, 2013
    • Rafael Espindola's avatar
      Remove some really nasty uses of hasRawTextSupport. · ac4ad25a
      Rafael Espindola authored
      When MC was first added, targets could use hasRawTextSupport to keep features
      working before they were added to the MC interface.
      
      The design goal of MC is to provide an uniform api for printing assembly and
      object files. Short of relaxations and other corner cases, a object file is
      just another representation of the assembly.
      
      It was never the intention that targets would keep doing things like
      
      if (hasRawTextSupport())
        Set flags in one way.
      else
        Set flags in another way.
      
      When they do that they create two code paths and the object file is no longer
      just another representation of the assembly. This also then requires testing
      with llc -filetype=obj, which is extremelly brittle.
      
      This patch removes some of these hacks by replacing them with smaller ones.
      The ARM flag setting is trivial, so I just moved it to the constructor. For
      Mips, the patch adds two temporary hack directives that allow the assembly
      to represent the same things as the object file was already able to.
      
      The hope is that the mips developers will replace the hack directives with
      the same ones that gas uses and drop the -print-hack-directives flag.
      
      I will also try to implement a target streamer interface, so that we can
      move this out of the common code.
      
      In summary, for any new work, two rules of the thumb are
        * Don't use "llc -filetype=obj" in tests.
        * Don't add calls to hasRawTextSupport.
      
      llvm-svn: 192035
      ac4ad25a
  17. Oct 03, 2013
  18. Oct 01, 2013
  19. Sep 30, 2013
  20. Sep 27, 2013
    • Tilmann Scheller's avatar
      ARM: Teach assembler to enforce constraints for ARM LDRD destination register operands. · 1aebfa0a
      Tilmann Scheller authored
      As specified in A8.8.72/A8.8.73/A8.8.74 in the ARM ARM, all variants of the ARM LDRD instruction have the following two constraints:
      
      LDRD<c> <Rt>, <Rt2>, ...
      
      (a) Rt must be even-numbered and not r14
      (b) Rt2 must be R(t+1)
      
      If those two constraints are not met the result of executing the instruction will be unpredictable.
      
      Constraint (b) was already enforced, this commit adds support for constraint (a).
      
      Fixes rdar://14479793.
      
      llvm-svn: 191520
      1aebfa0a
    • Tilmann Scheller's avatar
      ARM: Teach assembler to enforce constraint for Thumb2 LDRD (literal/immediate)... · 88c8f165
      Tilmann Scheller authored
      ARM: Teach assembler to enforce constraint for Thumb2 LDRD (literal/immediate) destination register operands.
      
      LDRD<c> <Rt>, <Rt2>, <label>
      LDRD<c> <Rt>, <Rt2>, [<Rn>{, #+/-<imm>}]
      LDRD<c> <Rt>, <Rt2>, [<Rn>], #+/-<imm>
      LDRD<c> <Rt>, <Rt2>, [<Rn>, #+/-<imm>]!
      
      As specified in A8.8.72/A8.8.73 in the ARM ARM, the T1 encoding has a constraint which enforces that Rt != Rt2.
      
      If this constraint is not met the result of executing the instruction will be unpredictable.
      
      Fixes rdar://14479780.
      
      llvm-svn: 191504
      88c8f165
  21. Sep 19, 2013
  22. Sep 18, 2013
  23. Sep 17, 2013
  24. Sep 13, 2013
  25. Sep 12, 2013
Loading