mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
InstCombine: Implement X - A*-B -> X + A*B.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119984 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -281,3 +281,23 @@ define i32 @test26(i32 %x) {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test27(i32 %x, i32 %y) {
|
||||
%mul = mul i32 %y, -8
|
||||
%sub = sub i32 %x, %mul
|
||||
ret i32 %sub
|
||||
; CHECK: @test27
|
||||
; CHECK-NEXT: shl i32 %y, 3
|
||||
; CHECK-NEXT: add i32
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test28(i32 %x, i32 %y, i32 %z) {
|
||||
%neg = sub i32 0, %z
|
||||
%mul = mul i32 %neg, %y
|
||||
%sub = sub i32 %x, %mul
|
||||
ret i32 %sub
|
||||
; CHECK: @test28
|
||||
; CHECK-NEXT: mul i32 %z, %y
|
||||
; CHECK-NEXT: add i32
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
Reference in New Issue
Block a user