summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstSimplify
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-06-26 14:47:31 +0000
committerSanjay Patel <spatel@rotateright.com>2018-06-26 14:47:31 +0000
commit0e0dbebeed131709e334b2aff26aeeba6e2e0f5e (patch)
tree23c06cd1783bc2eeb8dabd8515971faff7300bed /llvm/test/Transforms/InstSimplify
parenta7f9e66cfd44093733615fc3818287ef6ec26268 (diff)
downloadbcm5719-llvm-0e0dbebeed131709e334b2aff26aeeba6e2e0f5e.tar.gz
bcm5719-llvm-0e0dbebeed131709e334b2aff26aeeba6e2e0f5e.zip
[InstSimplify] add tests for srem with sext bool divisor; NFC
llvm-svn: 335609
Diffstat (limited to 'llvm/test/Transforms/InstSimplify')
-rw-r--r--llvm/test/Transforms/InstSimplify/rem.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/rem.ll b/llvm/test/Transforms/InstSimplify/rem.ll
index eba5b74e3fb..54a7b5bfcae 100644
--- a/llvm/test/Transforms/InstSimplify/rem.ll
+++ b/llvm/test/Transforms/InstSimplify/rem.ll
@@ -306,3 +306,26 @@ define i32 @rem10(i32 %x, i32 %y) {
%mod = urem i32 %shl, %x
ret i32 %mod
}
+
+define i32 @srem_with_sext_bool_divisor(i1 %x, i32 %y) {
+; CHECK-LABEL: @srem_with_sext_bool_divisor(
+; CHECK-NEXT: [[S:%.*]] = sext i1 [[X:%.*]] to i32
+; CHECK-NEXT: [[R:%.*]] = srem i32 [[Y:%.*]], [[S]]
+; CHECK-NEXT: ret i32 [[R]]
+;
+ %s = sext i1 %x to i32
+ %r = srem i32 %y, %s
+ ret i32 %r
+}
+
+define <2 x i32> @srem_with_sext_bool_divisor_vec(<2 x i1> %x, <2 x i32> %y) {
+; CHECK-LABEL: @srem_with_sext_bool_divisor_vec(
+; CHECK-NEXT: [[S:%.*]] = sext <2 x i1> [[X:%.*]] to <2 x i32>
+; CHECK-NEXT: [[R:%.*]] = srem <2 x i32> [[Y:%.*]], [[S]]
+; CHECK-NEXT: ret <2 x i32> [[R]]
+;
+ %s = sext <2 x i1> %x to <2 x i32>
+ %r = srem <2 x i32> %y, %s
+ ret <2 x i32> %r
+}
+
OpenPOWER on IntegriCloud