[llvm] r311339 - [InstCombine] add vector tests; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 21 08:11:39 PDT 2017
Author: spatel
Date: Mon Aug 21 08:11:39 2017
New Revision: 311339
URL: http://llvm.org/viewvc/llvm-project?rev=311339&view=rev
Log:
[InstCombine] add vector tests; NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/udivrem-change-width.ll
Modified: llvm/trunk/test/Transforms/InstCombine/udivrem-change-width.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/udivrem-change-width.ll?rev=311339&r1=311338&r2=311339&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/udivrem-change-width.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/udivrem-change-width.ll Mon Aug 21 08:11:39 2017
@@ -73,3 +73,73 @@ define i32 @urem_i32_c(i8 %a) {
ret i32 %udiv
}
+define <2 x i8> @udiv_i8_vec(<2 x i8> %a, <2 x i8> %b) {
+; CHECK-LABEL: @udiv_i8_vec(
+; CHECK-NEXT: [[DIV:%.*]] = udiv <2 x i8> %a, %b
+; CHECK-NEXT: ret <2 x i8> [[DIV]]
+;
+ %za = zext <2 x i8> %a to <2 x i32>
+ %zb = zext <2 x i8> %b to <2 x i32>
+ %udiv = udiv <2 x i32> %za, %zb
+ %conv3 = trunc <2 x i32> %udiv to <2 x i8>
+ ret <2 x i8> %conv3
+}
+
+define <2 x i8> @urem_i8_vec(<2 x i8> %a, <2 x i8> %b) {
+; CHECK-LABEL: @urem_i8_vec(
+; CHECK-NEXT: [[TMP1:%.*]] = urem <2 x i8> %a, %b
+; CHECK-NEXT: ret <2 x i8> [[TMP1]]
+;
+ %za = zext <2 x i8> %a to <2 x i32>
+ %zb = zext <2 x i8> %b to <2 x i32>
+ %udiv = urem <2 x i32> %za, %zb
+ %conv3 = trunc <2 x i32> %udiv to <2 x i8>
+ ret <2 x i8> %conv3
+}
+
+define <2 x i32> @udiv_i32_vec(<2 x i8> %a, <2 x i8> %b) {
+; CHECK-LABEL: @udiv_i32_vec(
+; CHECK-NEXT: [[DIV:%.*]] = udiv <2 x i8> %a, %b
+; CHECK-NEXT: [[UDIV:%.*]] = zext <2 x i8> [[DIV]] to <2 x i32>
+; CHECK-NEXT: ret <2 x i32> [[UDIV]]
+;
+ %za = zext <2 x i8> %a to <2 x i32>
+ %zb = zext <2 x i8> %b to <2 x i32>
+ %udiv = udiv <2 x i32> %za, %zb
+ ret <2 x i32> %udiv
+}
+
+define <2 x i32> @urem_i32_vec(<2 x i8> %a, <2 x i8> %b) {
+; CHECK-LABEL: @urem_i32_vec(
+; CHECK-NEXT: [[TMP1:%.*]] = urem <2 x i8> %a, %b
+; CHECK-NEXT: [[UDIV:%.*]] = zext <2 x i8> [[TMP1]] to <2 x i32>
+; CHECK-NEXT: ret <2 x i32> [[UDIV]]
+;
+ %za = zext <2 x i8> %a to <2 x i32>
+ %zb = zext <2 x i8> %b to <2 x i32>
+ %udiv = urem <2 x i32> %za, %zb
+ ret <2 x i32> %udiv
+}
+
+define <2 x i32> @udiv_i32_c_vec(<2 x i8> %a) {
+; CHECK-LABEL: @udiv_i32_c_vec(
+; CHECK-NEXT: [[ZA:%.*]] = zext <2 x i8> %a to <2 x i32>
+; CHECK-NEXT: [[UDIV:%.*]] = udiv <2 x i32> [[ZA]], <i32 10, i32 17>
+; CHECK-NEXT: ret <2 x i32> [[UDIV]]
+;
+ %za = zext <2 x i8> %a to <2 x i32>
+ %udiv = udiv <2 x i32> %za, <i32 10, i32 17>
+ ret <2 x i32> %udiv
+}
+
+define <2 x i32> @urem_i32_c_vec(<2 x i8> %a) {
+; CHECK-LABEL: @urem_i32_c_vec(
+; CHECK-NEXT: [[ZA:%.*]] = zext <2 x i8> %a to <2 x i32>
+; CHECK-NEXT: [[UDIV:%.*]] = urem <2 x i32> [[ZA]], <i32 10, i32 17>
+; CHECK-NEXT: ret <2 x i32> [[UDIV]]
+;
+ %za = zext <2 x i8> %a to <2 x i32>
+ %udiv = urem <2 x i32> %za, <i32 10, i32 17>
+ ret <2 x i32> %udiv
+}
+
More information about the llvm-commits
mailing list