mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-16 11:30:51 +00:00
1b26bfbef1
The mftb instruction was incorrectly marked as deprecated in the PPC Backend. Instead, it should not be treated as deprecated, but rather be implemented using the mfspr instruction. A similar patch was put into GCC last year. Details can be found at: https://sourceware.org/ml/binutils/2014-11/msg00383.html. This change will replace instances of the mftb instruction with the mfspr instruction for all CPUs except 601 and pwr3. This will also be the default behaviour. Additional details can be found in: https://llvm.org/bugs/show_bug.cgi?id=23680 Phabricator review: http://reviews.llvm.org/D10419 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239827 91177308-0d34-0410-b5e6-96231b3b80d8
73 lines
2.2 KiB
LLVM
73 lines
2.2 KiB
LLVM
; Check handling of the mftb instruction.
|
|
; For CPUs 601 and pwr3, the mftb instruction should be emitted.
|
|
; On all other CPUs (including generic, ppc, ppc64), the mfspr instruction
|
|
; should be used instead. There should no longer be a deprecated warning
|
|
; message emittedfor this instruction for any CPU.
|
|
|
|
; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 < %s 2>&1 \
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-MFSPR
|
|
; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 < %s 2>&1 \
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-MFSPR
|
|
; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu < %s 2>&1 \
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-MFSPR
|
|
; RUN: llc -mtriple=powerpc-unknown-linux-gnu < %s 2>&1 \
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-MFSPR
|
|
; RUN: llc -mtriple=powerpc-unknown-linux-gnu -mcpu=ppc < %s 2>&1 \
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-MFSPR
|
|
; RUN: llc -mtriple=powerpc-unknown-linux-gnu -mcpu=601 < %s 2>&1 \
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-MFTB
|
|
; RUN: llc -mtriple=powerpc-unknown-linux-gnu -mcpu=pwr3 < %s 2>&1 \
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-MFTB
|
|
|
|
; CHECK-MFSPR-NOT: warning: deprecated
|
|
; CHECK-MFTB-NOT: warning: deprecated
|
|
|
|
define i32 @get_time() {
|
|
%time = call i32 asm "mftb $0, 268", "=r"()
|
|
ret i32 %time
|
|
; CHECK-MFSPR-LABEL: @get_time
|
|
; CHECK-MFSPR: mfspr 3, 268
|
|
; CHECK-MFSPR: blr
|
|
|
|
; CHECK-MFTB-LABEL: @get_time
|
|
; CHECK-MFTB: mftb 3, 268
|
|
; CHECK-MFTB: blr
|
|
}
|
|
|
|
define i32 @get_timeu() {
|
|
%time = call i32 asm "mftb $0, 269", "=r"()
|
|
ret i32 %time
|
|
; CHECK-MFSPR-LABEL: @get_timeu
|
|
; CHECK-MFSPR: mfspr 3, 269
|
|
; CHECK-MFSPR: blr
|
|
|
|
; CHECK-MFTB-LABEL: @get_timeu
|
|
; CHECK-MFTB: mftbu 3
|
|
; CHECK-MFTB: blr
|
|
}
|
|
|
|
define i32 @get_time_e() {
|
|
%time = call i32 asm "mftb $0", "=r"()
|
|
ret i32 %time
|
|
; CHECK-MFSPR-LABEL: @get_time_e
|
|
; CHECK-MFSPR: mfspr 3, 268
|
|
; CHECK-MFSPR: blr
|
|
|
|
; CHECK-MFTB-LABEL: @get_time_e
|
|
; CHECK-MFTB: mftb 3, 268
|
|
; CHECK-MFTB: blr
|
|
}
|
|
|
|
define i32 @get_timeu_e() {
|
|
%time = call i32 asm "mftbu $0", "=r"()
|
|
ret i32 %time
|
|
; CHECK-MFSPR-LABEL: @get_timeu_e
|
|
; CHECK-MFSPR: mfspr 3, 269
|
|
; CHECK-MFSPR: blr
|
|
|
|
; CHECK-MFTB-LABEL: @get_timeu_e
|
|
; CHECK-MFTB: mftbu 3
|
|
; CHECK-MFTB: blr
|
|
}
|
|
|