xref: /llvm-project/llvm/test/CodeGen/PowerPC/restore-r30.ll (revision e2d2ce9ff1fabe751d3990af4bfa82cbf4998d41)
1*e2d2ce9fSMatthias Braun; RUN: llc -relocation-model=pic < %s | FileCheck %s
2038a0546SKrzysztof Parzyszek
3038a0546SKrzysztof Parzyszek; The load restoring r30 at the end of the function was placed out of order
4038a0546SKrzysztof Parzyszek; relative to its uses as the PIC base pointer.
5038a0546SKrzysztof Parzyszek; This was because the r30 operand was not marked as "def" which allowed
6038a0546SKrzysztof Parzyszek; the post-RA scheduler to move it over other uses of r30.
7038a0546SKrzysztof Parzyszek
8038a0546SKrzysztof Parzyszek; CHECK-LABEL: fred
9038a0546SKrzysztof Parzyszek; CHECK:       lwz 30, 24(1)
10038a0546SKrzysztof Parzyszek; R30 should not appear in an instruction after it's been restored.
11038a0546SKrzysztof Parzyszek; CHECK-NOT:   30,
12038a0546SKrzysztof Parzyszek
13038a0546SKrzysztof Parzyszektarget datalayout = "E-m:e-p:32:32-i64:64-n32"
14*e2d2ce9fSMatthias Brauntarget triple = "powerpc--"
15038a0546SKrzysztof Parzyszek
16038a0546SKrzysztof Parzyszekdefine double @fred(i64 %a) #0 {
17038a0546SKrzysztof Parzyszekentry:
18038a0546SKrzysztof Parzyszek  %0 = lshr i64 %a, 32
19038a0546SKrzysztof Parzyszek  %conv = trunc i64 %0 to i32
20038a0546SKrzysztof Parzyszek  %conv1 = sitofp i32 %conv to double
21038a0546SKrzysztof Parzyszek  %mul = fmul double %conv1, 0x41F0000000000000
22038a0546SKrzysztof Parzyszek  %and = and i64 %a, 4294967295
23038a0546SKrzysztof Parzyszek  %or = or i64 %and, 4841369599423283200
24038a0546SKrzysztof Parzyszek  %sub = fadd double %mul, 0xC330000000000000
25038a0546SKrzysztof Parzyszek  %1 = bitcast i64 %or to double
26038a0546SKrzysztof Parzyszek  %add = fadd double %sub, %1
27038a0546SKrzysztof Parzyszek  ret double %add
28038a0546SKrzysztof Parzyszek}
29038a0546SKrzysztof Parzyszek
30038a0546SKrzysztof Parzyszekattributes #0 = { norecurse nounwind readnone "target-cpu"="ppc" "use-soft-float"="false" }
31