forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly handle the mftb instruction.
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
- Loading branch information
Showing
7 changed files
with
132 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
; 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 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters