summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SPARC
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2015-08-19 14:47:04 +0000
committerJames Y Knight <jyknight@google.com>2015-08-19 14:47:04 +0000
commitd966fb6fef351da66768cbe560c90dceeb6bf07a (patch)
treeb0ed5be4eac5c0211b1bef42f9dc5f5c58e22a89 /llvm/test/CodeGen/SPARC
parent494abf1ad8d4771b0d15ae1437b39e26aa69a7bf (diff)
downloadbcm5719-llvm-d966fb6fef351da66768cbe560c90dceeb6bf07a.tar.gz
bcm5719-llvm-d966fb6fef351da66768cbe560c90dceeb6bf07a.zip
[SPARC] Fix BooleanContents, so that select of a trunc doesn't
eliminate the trunc. Differential Revision: http://reviews.llvm.org/D10442 llvm-svn: 245444
Diffstat (limited to 'llvm/test/CodeGen/SPARC')
-rw-r--r--llvm/test/CodeGen/SPARC/select-mask.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SPARC/select-mask.ll b/llvm/test/CodeGen/SPARC/select-mask.ll
new file mode 100644
index 00000000000..12e57103594
--- /dev/null
+++ b/llvm/test/CodeGen/SPARC/select-mask.ll
@@ -0,0 +1,17 @@
+; RUN: llc -march=sparc < %s
+
+;; getBooleanContents on Sparc used to claim that no bits mattered
+;; other than the first for SELECT. Thus, the 'trunc' got eliminated
+;; as redundant. But, cmp does NOT ignore the other bits!
+
+; CHECK-LABEL select_mask:
+; CHECK: ldub [%o0], [[R:%[goli][0-7]]]
+; CHECK: and [[R]], 1, [[V:%[goli][0-7]]]
+; CHECK: cmp [[V]], 0
+define i32 @select_mask(i8* %this) {
+entry:
+ %bf.load2 = load i8, i8* %this, align 4
+ %bf.cast5 = trunc i8 %bf.load2 to i1
+ %cond = select i1 %bf.cast5, i32 2, i32 0
+ ret i32 %cond
+}
OpenPOWER on IntegriCloud