diff options
Diffstat (limited to 'test/Transforms/InstCombine/sub.ll')
-rw-r--r-- | test/Transforms/InstCombine/sub.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/sub.ll b/test/Transforms/InstCombine/sub.ll index 41d803c8..67b7c49 100644 --- a/test/Transforms/InstCombine/sub.ll +++ b/test/Transforms/InstCombine/sub.ll @@ -444,3 +444,23 @@ define <2 x i64> @test36(<2 x i64> %A) { ; CHECK-NEXT: %sub = mul <2 x i64> %A, <i64 7, i64 15> ; CHECK-NEXT: ret <2 x i64> %sub } + +define <2 x i32> @test37(<2 x i32> %A) { + %div = sdiv <2 x i32> %A, <i32 -2147483648, i32 -2147483648> + %sub = sub nsw <2 x i32> zeroinitializer, %div + ret <2 x i32> %sub +; CHECK-LABEL: @test37( +; CHECK-NEXT: [[ICMP:%.*]] = icmp eq <2 x i32> %A, <i32 -2147483648, i32 -2147483648> +; CHECK-NEXT: [[SEXT:%.*]] = sext <2 x i1> [[ICMP]] to <2 x i32> +; CHECK-NEXT: ret <2 x i32> [[SEXT]] +} + +define i32 @test38(i32 %A) { + %div = sdiv i32 %A, -2147483648 + %sub = sub nsw i32 0, %div + ret i32 %sub +; CHECK-LABEL: @test38( +; CHECK-NEXT: [[ICMP:%.*]] = icmp eq i32 %A, -2147483648 +; CHECK-NEXT: [[SEXT:%.*]] = sext i1 [[ICMP]] to i32 +; CHECK-NEXT: ret i32 [[SEXT]] +} |