-
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.
[SelectionDAG] Handle big endian target BITCAST in computeKnownBits()
The BITCAST handling in computeKnownBits() previously only worked for little endian. This patch reverses the iteration over elements for a big endian target which allows this to work in this case also. SystemZ test case. Review: Eli Friedman https://reviews.llvm.org/D44249 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327764 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
2 changed files
with
34 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
; Test that DAGCombiner gets helped by getKnownBitsForTargetNode() when | ||
; BITCAST nodes are involved on a big-endian target. | ||
; | ||
; RUN: llc -mtriple=s390x-linux-gnu -mcpu=z13 < %s | FileCheck %s | ||
|
||
define void @fun() { | ||
entry: | ||
br label %lab0 | ||
|
||
lab0: | ||
%phi = phi i64 [ %sel, %lab0 ], [ 0, %entry ] | ||
%add = add nuw nsw i64 %phi, 1 | ||
%cmp = icmp eq i64 %add, undef | ||
%ins = insertelement <2 x i1> undef, i1 %cmp, i32 0 | ||
%xor = xor <2 x i1> %ins, <i1 true, i1 true> | ||
%extr = extractelement <2 x i1> %xor, i32 0 | ||
; The EXTRACT_VECTOR_ELT is done first into an i32, and then AND:ed with | ||
; 1. The AND is not actually necessary since the element contains a CC (i1) | ||
; value. Test that the BITCAST nodes in the DAG when computing KnownBits is | ||
; handled so that the AND is removed. If this succeeds, this results in a CHI | ||
; instead of TMLL. | ||
|
||
; CHECK-LABEL: # %bb.0: | ||
; CHECK: chi | ||
; CHECK-NOT: tmll | ||
; CHECK: j | ||
%sel = select i1 %extr, i64 %add, i64 0 | ||
br label %lab0 | ||
} |