add tests for vector urem

llvm-svn: 270271
This commit is contained in:
Sanjay Patel 2016-05-20 20:55:17 +00:00
parent 498f2fd11b
commit 54acedf88f
1 changed files with 23 additions and 1 deletions

View File

@ -1,4 +1,4 @@
; This test makes sure that urem instructions are properly eliminated. ; This test makes sure that rem instructions are properly eliminated.
; ;
; RUN: opt < %s -instcombine -S | FileCheck %s ; RUN: opt < %s -instcombine -S | FileCheck %s
; END. ; END.
@ -25,6 +25,28 @@ define i32 @test3(i32 %A) {
ret i32 %B ret i32 %B
} }
; FIXME: This could be an 'and' just like above.
define <2 x i32> @vec_power_of_2_constant_splat_divisor(<2 x i32> %A) {
; CHECK-LABEL: @vec_power_of_2_constant_splat_divisor(
; CHECK-NEXT: [[B:%.*]] = urem <2 x i32> %A, <i32 8, i32 8>
; CHECK-NEXT: ret <2 x i32> [[B]]
;
%B = urem <2 x i32> %A, <i32 8, i32 8>
ret <2 x i32> %B
}
; FIXME: And it shouldn't matter whether we have ConstantVector or ConstantDataVector.
define <2 x i19> @weird_vec_power_of_2_constant_splat_divisor(<2 x i19> %A) {
; CHECK-LABEL: @weird_vec_power_of_2_constant_splat_divisor(
; CHECK-NEXT: [[B:%.*]] = urem <2 x i19> %A, <i19 8, i19 8>
; CHECK-NEXT: ret <2 x i19> [[B]]
;
%B = urem <2 x i19> %A, <i19 8, i19 8>
ret <2 x i19> %B
}
define i1 @test3a(i32 %A) { define i1 @test3a(i32 %A) {
; CHECK-LABEL: @test3a( ; CHECK-LABEL: @test3a(
; CHECK-NEXT: [[AND:%.*]] = and i32 %A, 7 ; CHECK-NEXT: [[AND:%.*]] = and i32 %A, 7