mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Peephole optimization for ABS on ARM.
Patch by Ana Pazos! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141365 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
|
||||
;; Integer absolute value, should produce something as good as:
|
||||
;; Thumb:
|
||||
;; asr r2, r0, #31
|
||||
;; add r0, r0, r2
|
||||
;; eor r0, r2
|
||||
;; movs r0, r0
|
||||
;; bpl
|
||||
;; rsb r0, r0, #0 (with opitmization, bpl + rsb is if-converted into rsbmi)
|
||||
;; bx lr
|
||||
|
||||
define i32 @test(i32 %a) {
|
||||
@@ -13,5 +13,10 @@ define i32 @test(i32 %a) {
|
||||
%b = icmp sgt i32 %a, -1
|
||||
%abs = select i1 %b, i32 %a, i32 %tmp1neg
|
||||
ret i32 %abs
|
||||
; CHECK: movs r0, r0
|
||||
; CHECK: bpl
|
||||
; CHECK: rsb r0, r0, #0
|
||||
; CHECK: bx lr
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user