Skip to content

Commit

Permalink
[SelectionDAG][X86][SystemZ] Add a generic nonvolatile_store/nonvolat…
Browse files Browse the repository at this point in the history
…ile_load pattern fragment in TargetSelectionDAG.td

Differential Revision: https://reviews.llvm.org/D50358

llvm-svn: 339156
  • Loading branch information
topperc committed Aug 7, 2018
1 parent 8e5e2af commit deb2899
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
9 changes: 9 additions & 0 deletions llvm/include/llvm/Target/TargetSelectionDAG.td
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,15 @@ def post_truncstf32 : PatFrag<(ops node:$val, node:$base, node:$offset),
let MemoryVT = f32;
}

def nonvolatile_load : PatFrag<(ops node:$ptr),
(load node:$ptr), [{
return !cast<LoadSDNode>(N)->isVolatile();
}]>;
def nonvolatile_store : PatFrag<(ops node:$val, node:$ptr),
(store node:$val, node:$ptr), [{
return !cast<StoreSDNode>(N)->isVolatile();
}]>;

// nontemporal store fragments.
def nontemporalstore : PatFrag<(ops node:$val, node:$ptr),
(store node:$val, node:$ptr), [{
Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/Target/SystemZ/SystemZOperators.td
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ class NonvolatileLoad<SDPatternOperator load>
auto *Load = cast<LoadSDNode>(N);
return !Load->isVolatile();
}]>;
def nonvolatile_load : NonvolatileLoad<load>;
def nonvolatile_anyextloadi8 : NonvolatileLoad<anyextloadi8>;
def nonvolatile_anyextloadi16 : NonvolatileLoad<anyextloadi16>;
def nonvolatile_anyextloadi32 : NonvolatileLoad<anyextloadi32>;
Expand All @@ -567,7 +566,6 @@ class NonvolatileStore<SDPatternOperator store>
auto *Store = cast<StoreSDNode>(N);
return !Store->isVolatile();
}]>;
def nonvolatile_store : NonvolatileStore<store>;
def nonvolatile_truncstorei8 : NonvolatileStore<truncstorei8>;
def nonvolatile_truncstorei16 : NonvolatileStore<truncstorei16>;
def nonvolatile_truncstorei32 : NonvolatileStore<truncstorei32>;
Expand Down
6 changes: 0 additions & 6 deletions llvm/lib/Target/X86/X86InstrCompiler.td
Original file line number Diff line number Diff line change
Expand Up @@ -1006,12 +1006,6 @@ def : Pat<(i64 (atomic_load_64 addr:$src)), (MOV64rm addr:$src)>;
// DAG Pattern Matching Rules
//===----------------------------------------------------------------------===//

def nonvolatile_store : PatFrag<(ops node:$val, node:$ptr),
(store node:$val, node:$ptr), [{
return !cast<StoreSDNode>(N)->isVolatile();
}]>;


// Use AND/OR to store 0/-1 in memory when optimizing for minsize. This saves
// binary size compared to a regular MOV, but it introduces an unnecessary
// load, so is not suitable for regular or optsize functions.
Expand Down

0 comments on commit deb2899

Please sign in to comment.