llvm-6502/test/CodeGen/ARM/Windows/mov32t-bundling.ll
Saleem Abdulrasool 91bbc253bd ARM: correct bundle generation for MOV32T relocations
Although the previous code would construct a bundle and add the correct elements
to it, it would not finalise the bundle.  This resulted in the InternalRead
markers not being added to the MachineOperands nor, more importantly, the
externally visible defs to the bundle itself.  So, although the bundle was not
exposing the def, the generated code would be correct because there was no
optimisations being performed.  When optimisations were enabled, the post
register allocator would kick in, and the hazard recognizer would reorder
operations around the load which would define the value being operated upon.

Rather than manually constructing the bundle, simply construct and finalise the
bundle via the finaliseBundle call after both MIs have been emitted.  This
improves the code generation with optimisations where IMAGE_REL_ARM_MOV32T
relocations are emitted.

The changes to the other tests are the result of the bundle generation
preventing the scheduler from hoisting the moves across the loads.  The net
effect of the generated code is equivalent, but, is much more identical to what
is actually being lowered.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209267 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-21 01:25:24 +00:00

29 lines
725 B
LLVM

; RUN: llc -mtriple thumbv7-windows-itanium -filetype asm -o - %s | FileCheck %s
@_begin = external global i8
@_end = external global i8
declare arm_aapcs_vfpcc void @force_emission()
define arm_aapcs_vfpcc void @bundle() {
entry:
br i1 icmp uge (i32 sub (i32 ptrtoint (i8* @_end to i32), i32 ptrtoint (i8* @_begin to i32)), i32 4), label %if.then, label %if.end
if.then:
tail call arm_aapcs_vfpcc void @force_emission()
br label %if.end
if.end:
ret void
}
; CHECK-LABEL: bundle
; CHECK-NOT: subs r0, r1, r0
; CHECK: movw r0, :lower16:_begin
; CHECK-NEXT: movt r0, :upper16:_begin
; CHECK-NEXT: movw r1, :lower16:_end
; CHECK-NEXT: movt r1, :upper16:_end
; CHECK-NEXT: subs r0, r1, r0
; CHECK-NEXT: cmp r0, #4