| 1 |
; RUN: llc -relocation-model=pic < %s | FileCheck %s |
| 2 |
|
| 3 |
; The load restoring r30 at the end of the function was placed out of order |
| 4 |
; relative to its uses as the PIC base pointer. |
| 5 |
; This was because the r30 operand was not marked as "def" which allowed |
| 6 |
; the post-RA scheduler to move it over other uses of r30. |
| 7 |
|
| 8 |
; CHECK-LABEL: fred |
| 9 |
; CHECK: lwz 30, 24(1) |
| 10 |
; R30 should not appear in an instruction after it's been restored. |
| 11 |
; CHECK-NOT: 30, |
| 12 |
|
| 13 |
target datalayout = "E-m:e-p:32:32-i64:64-n32" |
| 14 |
target triple = "powerpc--" |
| 15 |
|
| 16 |
define double @fred(i64 %a) #0 { |
| 17 |
entry: |
| 18 |
%0 = lshr i64 %a, 32 |
| 19 |
%conv = trunc i64 %0 to i32 |
| 20 |
%conv1 = sitofp i32 %conv to double |
| 21 |
%mul = fmul double %conv1, 0x41F0000000000000 |
| 22 |
%and = and i64 %a, 4294967295 |
| 23 |
%or = or i64 %and, 4841369599423283200 |
| 24 |
%sub = fadd double %mul, 0xC330000000000000 |
| 25 |
%1 = bitcast i64 %or to double |
| 26 |
%add = fadd double %sub, %1 |
| 27 |
ret double %add |
| 28 |
} |
| 29 |
|
| 30 |
attributes #0 = { norecurse nounwind readnone "target-cpu"="ppc" "use-soft-float"="false" } |