mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-18 10:24:45 +00:00
Fix bug in zero-store peephole pattern reported in pr11615.
The patch and test case were originally written by Mans Rullgard. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147024 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1022,10 +1022,14 @@ let Predicates = [IsN64] in {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// peepholes
|
// peepholes
|
||||||
def : Pat<(store (i32 0), addr:$dst), (SW ZERO, addr:$dst)>,
|
let Predicates = [NotN64] in {
|
||||||
Requires<[NotN64]>;
|
def : Pat<(store_a (i32 0), addr:$dst), (SW ZERO, addr:$dst)>;
|
||||||
def : Pat<(store (i32 0), addr:$dst), (SW_P8 ZERO, addr:$dst)>,
|
def : Pat<(store_u (i32 0), addr:$dst), (USW ZERO, addr:$dst)>;
|
||||||
Requires<[IsN64]>;
|
}
|
||||||
|
let Predicates = [IsN64] in {
|
||||||
|
def : Pat<(store_a (i32 0), addr:$dst), (SW_P8 ZERO, addr:$dst)>;
|
||||||
|
def : Pat<(store_u (i32 0), addr:$dst), (USW_P8 ZERO, addr:$dst)>;
|
||||||
|
}
|
||||||
|
|
||||||
// brcond patterns
|
// brcond patterns
|
||||||
multiclass BrcondPats<RegisterClass RC, Instruction BEQOp, Instruction BNEOp,
|
multiclass BrcondPats<RegisterClass RC, Instruction BEQOp, Instruction BNEOp,
|
||||||
|
19
test/CodeGen/Mips/swzero.ll
Normal file
19
test/CodeGen/Mips/swzero.ll
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
; RUN: llc -march=mipsel < %s | FileCheck %s
|
||||||
|
|
||||||
|
%struct.unaligned = type <{ i32 }>
|
||||||
|
|
||||||
|
define void @zero_u(%struct.unaligned* nocapture %p) nounwind {
|
||||||
|
entry:
|
||||||
|
; CHECK: usw $zero
|
||||||
|
%x = getelementptr inbounds %struct.unaligned* %p, i32 0, i32 0
|
||||||
|
store i32 0, i32* %x, align 1
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
||||||
|
define void @zero_a(i32* nocapture %p) nounwind {
|
||||||
|
entry:
|
||||||
|
; CHECK: sw $zero
|
||||||
|
store i32 0, i32* %p, align 4
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user