summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-05-13 17:28:12 +0000
committerSanjay Patel <spatel@rotateright.com>2016-05-13 17:28:12 +0000
commit0c8f3f9332929b12c0f81dcf07169c1869098c3b (patch)
tree5dc927ce2f023135d6d4b8e7a8fef592fb6466fe /llvm/test/Transforms
parent27dba61ff313d68c9c3dcb2ea3f769477a8b789e (diff)
downloadbcm5719-llvm-0c8f3f9332929b12c0f81dcf07169c1869098c3b.tar.gz
bcm5719-llvm-0c8f3f9332929b12c0f81dcf07169c1869098c3b.zip
[InstCombine] handle zero constant vectors for LE/GE comparisons too
Enhancement to: http://reviews.llvm.org/rL269426 With discussion in: http://reviews.llvm.org/D17859 This should complete the fixes for: PR26701, PR26819: https://llvm.org/bugs/show_bug.cgi?id=26701 https://llvm.org/bugs/show_bug.cgi?id=26819 llvm-svn: 269439
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/icmp-vec.ll37
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp-vec.ll b/llvm/test/Transforms/InstCombine/icmp-vec.ll
index f8416cc6e95..df653caa56d 100644
--- a/llvm/test/Transforms/InstCombine/icmp-vec.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-vec.ll
@@ -42,6 +42,43 @@ define <2 x i1> @ule(<2 x i8> %x) {
ret <2 x i1> %cmp
}
+; Zeros are special: they're ConstantAggregateZero.
+
+define <2 x i1> @sge_zero(<2 x i8> %x) {
+; CHECK-LABEL: @sge_zero(
+; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <2 x i8> %x, <i8 -1, i8 -1>
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %cmp = icmp sge <2 x i8> %x, <i8 0, i8 0>
+ ret <2 x i1> %cmp
+}
+
+define <2 x i1> @uge_zero(<2 x i8> %x) {
+; CHECK-LABEL: @uge_zero(
+; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true>
+;
+ %cmp = icmp uge <2 x i8> %x, <i8 0, i8 0>
+ ret <2 x i1> %cmp
+}
+
+define <2 x i1> @sle_zero(<2 x i8> %x) {
+; CHECK-LABEL: @sle_zero(
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt <2 x i8> %x, <i8 1, i8 1>
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %cmp = icmp sle <2 x i8> %x, <i8 0, i8 0>
+ ret <2 x i1> %cmp
+}
+
+define <2 x i1> @ule_zero(<2 x i8> %x) {
+; CHECK-LABEL: @ule_zero(
+; CHECK-NEXT: [[CMP:%.*]] = icmp ult <2 x i8> %x, <i8 1, i8 1>
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %cmp = icmp ule <2 x i8> %x, <i8 0, i8 0>
+ ret <2 x i1> %cmp
+}
+
; Weird types are ConstantVectors, not ConstantDataVectors. For an i3 type:
; Signed min = -4
; Unsigned min = 0
OpenPOWER on IntegriCloud