forked from OSchip/llvm-project
52 lines
1.1 KiB
LLVM
52 lines
1.1 KiB
LLVM
; NOTE: Assertions have been autogenerated by update_test_checks.py
|
|
; RUN: opt < %s -instsimplify -S | FileCheck %s
|
|
|
|
define i32 @select1(i32 %x, i1 %b) {
|
|
; CHECK-LABEL: @select1(
|
|
; CHECK: ret i32 0
|
|
;
|
|
%rhs = select i1 %b, i32 %x, i32 1
|
|
%rem = srem i32 %x, %rhs
|
|
ret i32 %rem
|
|
}
|
|
|
|
define i32 @select2(i32 %x, i1 %b) {
|
|
; CHECK-LABEL: @select2(
|
|
; CHECK: ret i32 0
|
|
;
|
|
%rhs = select i1 %b, i32 %x, i32 1
|
|
%rem = urem i32 %x, %rhs
|
|
ret i32 %rem
|
|
}
|
|
|
|
define i32 @rem1(i32 %x, i32 %n) {
|
|
; CHECK-LABEL: @rem1(
|
|
; CHECK: [[MOD:%.*]] = srem i32 %x, %n
|
|
; CHECK-NEXT: ret i32 [[MOD]]
|
|
;
|
|
%mod = srem i32 %x, %n
|
|
%mod1 = srem i32 %mod, %n
|
|
ret i32 %mod1
|
|
}
|
|
|
|
define i32 @rem2(i32 %x, i32 %n) {
|
|
; CHECK-LABEL: @rem2(
|
|
; CHECK: [[MOD:%.*]] = urem i32 %x, %n
|
|
; CHECK-NEXT: ret i32 [[MOD]]
|
|
;
|
|
%mod = urem i32 %x, %n
|
|
%mod1 = urem i32 %mod, %n
|
|
ret i32 %mod1
|
|
}
|
|
|
|
define i32 @rem3(i32 %x, i32 %n) {
|
|
; CHECK-LABEL: @rem3(
|
|
; CHECK: [[MOD:%.*]] = srem i32 %x, %n
|
|
; CHECK-NEXT: [[MOD1:%.*]] = urem i32 [[MOD]], %n
|
|
; CHECK-NEXT: ret i32 [[MOD1]]
|
|
;
|
|
%mod = srem i32 %x, %n
|
|
%mod1 = urem i32 %mod, %n
|
|
ret i32 %mod1
|
|
}
|