diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2018-06-25 18:27:14 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2018-06-25 18:27:14 +0000 |
| commit | a46bcbec583b5ac8256c0698efe77d04789e1b92 (patch) | |
| tree | abe80e874d6a5a0837c6376ccc4475fdcdcb47d9 /llvm/test/Transforms/InstSimplify | |
| parent | 88fee5fdbc2a4769f1f9428e4d4017815aef1849 (diff) | |
| download | bcm5719-llvm-a46bcbec583b5ac8256c0698efe77d04789e1b92.tar.gz bcm5719-llvm-a46bcbec583b5ac8256c0698efe77d04789e1b92.zip | |
[InstSimplify] add tests for div/rem with bool divisor; NFC
llvm-svn: 335509
Diffstat (limited to 'llvm/test/Transforms/InstSimplify')
| -rw-r--r-- | llvm/test/Transforms/InstSimplify/div.ll | 22 | ||||
| -rw-r--r-- | llvm/test/Transforms/InstSimplify/rem.ll | 22 |
2 files changed, 44 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/div.ll b/llvm/test/Transforms/InstSimplify/div.ll index 146112a48c6..4cd2bae2cfa 100644 --- a/llvm/test/Transforms/InstSimplify/div.ll +++ b/llvm/test/Transforms/InstSimplify/div.ll @@ -95,6 +95,28 @@ define <2 x i1> @udiv_bool_vec(<2 x i1> %x, <2 x i1> %y) { ret <2 x i1> %div } +define i32 @zext_bool_udiv_divisor(i1 %x, i32 %y) { +; CHECK-LABEL: @zext_bool_udiv_divisor( +; CHECK-NEXT: [[EXT:%.*]] = zext i1 [[X:%.*]] to i32 +; CHECK-NEXT: [[R:%.*]] = udiv i32 [[Y:%.*]], [[EXT]] +; CHECK-NEXT: ret i32 [[R]] +; + %ext = zext i1 %x to i32 + %r = udiv i32 %y, %ext + ret i32 %r +} + +define <2 x i32> @zext_bool_sdiv_divisor_vec(<2 x i1> %x, <2 x i32> %y) { +; CHECK-LABEL: @zext_bool_sdiv_divisor_vec( +; CHECK-NEXT: [[EXT:%.*]] = zext <2 x i1> [[X:%.*]] to <2 x i32> +; CHECK-NEXT: [[R:%.*]] = sdiv <2 x i32> [[Y:%.*]], [[EXT]] +; CHECK-NEXT: ret <2 x i32> [[R]] +; + %ext = zext <2 x i1> %x to <2 x i32> + %r = sdiv <2 x i32> %y, %ext + ret <2 x i32> %r +} + define i32 @udiv_dividend_known_smaller_than_constant_divisor(i32 %x) { ; CHECK-LABEL: @udiv_dividend_known_smaller_than_constant_divisor( ; CHECK-NEXT: ret i32 0 diff --git a/llvm/test/Transforms/InstSimplify/rem.ll b/llvm/test/Transforms/InstSimplify/rem.ll index 205fdedf246..cf586bf9153 100644 --- a/llvm/test/Transforms/InstSimplify/rem.ll +++ b/llvm/test/Transforms/InstSimplify/rem.ll @@ -95,6 +95,28 @@ define <2 x i1> @urem_bool_vec(<2 x i1> %x, <2 x i1> %y) { ret <2 x i1> %rem } +define <2 x i32> @zext_bool_urem_divisor_vec(<2 x i1> %x, <2 x i32> %y) { +; CHECK-LABEL: @zext_bool_urem_divisor_vec( +; CHECK-NEXT: [[EXT:%.*]] = zext <2 x i1> [[X:%.*]] to <2 x i32> +; CHECK-NEXT: [[R:%.*]] = urem <2 x i32> [[Y:%.*]], [[EXT]] +; CHECK-NEXT: ret <2 x i32> [[R]] +; + %ext = zext <2 x i1> %x to <2 x i32> + %r = urem <2 x i32> %y, %ext + ret <2 x i32> %r +} + +define i32 @zext_bool_srem_divisor(i1 %x, i32 %y) { +; CHECK-LABEL: @zext_bool_srem_divisor( +; CHECK-NEXT: [[EXT:%.*]] = zext i1 [[X:%.*]] to i32 +; CHECK-NEXT: [[R:%.*]] = srem i32 [[Y:%.*]], [[EXT]] +; CHECK-NEXT: ret i32 [[R]] +; + %ext = zext i1 %x to i32 + %r = srem i32 %y, %ext + ret i32 %r +} + define i32 @select1(i32 %x, i1 %b) { ; CHECK-LABEL: @select1( ; CHECK-NEXT: ret i32 0 |

