Home | History | Annotate | Download | only in InstSimplify
      1 ; NOTE: Assertions have been autogenerated by update_test_checks.py
      2 ; RUN: opt < %s -instsimplify -S | FileCheck %s
      3 
      4 define i32 @select1(i32 %x, i1 %b) {
      5 ; CHECK-LABEL: @select1(
      6 ; CHECK:         ret i32 0
      7 ;
      8   %rhs = select i1 %b, i32 %x, i32 1
      9   %rem = srem i32 %x, %rhs
     10   ret i32 %rem
     11 }
     12 
     13 define i32 @select2(i32 %x, i1 %b) {
     14 ; CHECK-LABEL: @select2(
     15 ; CHECK:         ret i32 0
     16 ;
     17   %rhs = select i1 %b, i32 %x, i32 1
     18   %rem = urem i32 %x, %rhs
     19   ret i32 %rem
     20 }
     21 
     22 define i32 @rem1(i32 %x, i32 %n) {
     23 ; CHECK-LABEL: @rem1(
     24 ; CHECK:         [[MOD:%.*]] = srem i32 %x, %n
     25 ; CHECK-NEXT:    ret i32 [[MOD]]
     26 ;
     27  %mod = srem i32 %x, %n
     28  %mod1 = srem i32 %mod, %n
     29  ret i32 %mod1
     30 }
     31 
     32 define i32 @rem2(i32 %x, i32 %n) {
     33 ; CHECK-LABEL: @rem2(
     34 ; CHECK:         [[MOD:%.*]] = urem i32 %x, %n
     35 ; CHECK-NEXT:    ret i32 [[MOD]]
     36 ;
     37  %mod = urem i32 %x, %n
     38  %mod1 = urem i32 %mod, %n
     39  ret i32 %mod1
     40 }
     41 
     42 define i32 @rem3(i32 %x, i32 %n) {
     43 ; CHECK-LABEL: @rem3(
     44 ; CHECK:         [[MOD:%.*]] = srem i32 %x, %n
     45 ; CHECK-NEXT:    [[MOD1:%.*]] = urem i32 [[MOD]], %n
     46 ; CHECK-NEXT:    ret i32 [[MOD1]]
     47 ;
     48  %mod = srem i32 %x, %n
     49  %mod1 = urem i32 %mod, %n
     50  ret i32 %mod1
     51 }
     52