• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Check handling of the mftb instruction.
2; For CPUs 601 and pwr3, the mftb instruction should be emitted.
3; On all other CPUs (including generic, ppc, ppc64), the mfspr instruction
4; should be used instead. There should no longer be a deprecated warning
5; message emittedfor this instruction for any CPU.
6
7; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 < %s 2>&1 \
8; RUN:    | FileCheck %s --check-prefix=CHECK-MFSPR
9; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 < %s 2>&1 \
10; RUN:    | FileCheck %s --check-prefix=CHECK-MFSPR
11; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu < %s 2>&1 \
12; RUN:    | FileCheck %s --check-prefix=CHECK-MFSPR
13; RUN: llc -mtriple=powerpc-unknown-linux-gnu  < %s 2>&1 \
14; RUN:    | FileCheck %s --check-prefix=CHECK-MFSPR
15; RUN: llc -mtriple=powerpc-unknown-linux-gnu -mcpu=ppc < %s 2>&1 \
16; RUN:    | FileCheck %s --check-prefix=CHECK-MFSPR
17; RUN: llc -mtriple=powerpc-unknown-linux-gnu -mcpu=601 < %s 2>&1 \
18; RUN:    | FileCheck %s --check-prefix=CHECK-MFTB
19; RUN: llc -mtriple=powerpc-unknown-linux-gnu -mcpu=pwr3 < %s 2>&1 \
20; RUN:    | FileCheck %s --check-prefix=CHECK-MFTB
21
22; CHECK-MFSPR-NOT: warning: deprecated
23; CHECK-MFTB-NOT: warning: deprecated
24
25define i32 @get_time() {
26       %time = call i32 asm "mftb $0, 268", "=r"()
27       ret i32 %time
28; CHECK-MFSPR-LABEL: @get_time
29; CHECK-MFSPR: mfspr 3, 268
30; CHECK-MFSPR: blr
31
32; CHECK-MFTB-LABEL: @get_time
33; CHECK-MFTB: mftb 3, 268
34; CHECK-MFTB: blr
35}
36
37define i32 @get_timeu() {
38       %time = call i32 asm "mftb $0, 269", "=r"()
39       ret i32 %time
40; CHECK-MFSPR-LABEL: @get_timeu
41; CHECK-MFSPR: mfspr 3, 269
42; CHECK-MFSPR: blr
43
44; CHECK-MFTB-LABEL: @get_timeu
45; CHECK-MFTB: mftbu 3
46; CHECK-MFTB: blr
47}
48
49define i32 @get_time_e() {
50       %time = call i32 asm "mftb $0", "=r"()
51       ret i32 %time
52; CHECK-MFSPR-LABEL: @get_time_e
53; CHECK-MFSPR: mfspr 3, 268
54; CHECK-MFSPR: blr
55
56; CHECK-MFTB-LABEL: @get_time_e
57; CHECK-MFTB: mftb 3, 268
58; CHECK-MFTB: blr
59}
60
61define i32 @get_timeu_e() {
62       %time = call i32 asm "mftbu $0", "=r"()
63       ret i32 %time
64; CHECK-MFSPR-LABEL: @get_timeu_e
65; CHECK-MFSPR: mfspr 3, 269
66; CHECK-MFSPR: blr
67
68; CHECK-MFTB-LABEL: @get_timeu_e
69; CHECK-MFTB: mftbu 3
70; CHECK-MFTB: blr
71}
72
73