[llvm] r297407 - [InstSimplify] add tests for vector constant folding div/rem-by-0; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 12:31:20 PST 2017
Author: spatel
Date: Thu Mar 9 14:31:20 2017
New Revision: 297407
URL: http://llvm.org/viewvc/llvm-project?rev=297407&view=rev
Log:
[InstSimplify] add tests for vector constant folding div/rem-by-0; NFC
Modified:
llvm/trunk/test/Transforms/InstSimplify/div.ll
llvm/trunk/test/Transforms/InstSimplify/rem.ll
Modified: llvm/trunk/test/Transforms/InstSimplify/div.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/div.ll?rev=297407&r1=297406&r2=297407&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/div.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/div.ll Thu Mar 9 14:31:20 2017
@@ -2,6 +2,22 @@
; Division-by-zero is undef. UB in any vector lane means the whole op is undef.
+define <2 x i8> @sdiv_zero_elt_vec_constfold(<2 x i8> %x) {
+; CHECK-LABEL: @sdiv_zero_elt_vec_constfold(
+; CHECK-NEXT: ret <2 x i8> <i8 undef, i8 0>
+;
+ %div = sdiv <2 x i8> <i8 1, i8 2>, <i8 0, i8 -42>
+ ret <2 x i8> %div
+}
+
+define <2 x i8> @udiv_zero_elt_vec_constfold(<2 x i8> %x) {
+; CHECK-LABEL: @udiv_zero_elt_vec_constfold(
+; CHECK-NEXT: ret <2 x i8> <i8 0, i8 undef>
+;
+ %div = udiv <2 x i8> <i8 1, i8 2>, <i8 42, i8 0>
+ ret <2 x i8> %div
+}
+
define <2 x i8> @sdiv_zero_elt_vec(<2 x i8> %x) {
; CHECK-LABEL: @sdiv_zero_elt_vec(
; CHECK-NEXT: ret <2 x i8> undef
Modified: llvm/trunk/test/Transforms/InstSimplify/rem.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/rem.ll?rev=297407&r1=297406&r2=297407&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/rem.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/rem.ll Thu Mar 9 14:31:20 2017
@@ -3,6 +3,22 @@
; Division-by-zero is undef. UB in any vector lane means the whole op is undef.
+define <2 x i8> @srem_zero_elt_vec_constfold(<2 x i8> %x) {
+; CHECK-LABEL: @srem_zero_elt_vec_constfold(
+; CHECK-NEXT: ret <2 x i8> <i8 undef, i8 2>
+;
+ %rem = srem <2 x i8> <i8 1, i8 2>, <i8 0, i8 -42>
+ ret <2 x i8> %rem
+}
+
+define <2 x i8> @urem_zero_elt_vec_constfold(<2 x i8> %x) {
+; CHECK-LABEL: @urem_zero_elt_vec_constfold(
+; CHECK-NEXT: ret <2 x i8> <i8 1, i8 undef>
+;
+ %rem = urem <2 x i8> <i8 1, i8 2>, <i8 42, i8 0>
+ ret <2 x i8> %rem
+}
+
define <2 x i8> @srem_zero_elt_vec(<2 x i8> %x) {
; CHECK-LABEL: @srem_zero_elt_vec(
; CHECK-NEXT: ret <2 x i8> undef
More information about the llvm-commits
mailing list