Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt < %s -instcombine -S | FileCheck %s
      2 
      3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
      4 
      5 ; PR4548
      6 define i8 @udiv_i8(i8 %a, i8 %b) nounwind {
      7   %conv = zext i8 %a to i32       
      8   %conv2 = zext i8 %b to i32      
      9   %div = udiv i32 %conv, %conv2   
     10   %conv3 = trunc i32 %div to i8   
     11   ret i8 %conv3
     12 ; CHECK-LABEL: @udiv_i8(
     13 ; CHECK: udiv i8 %a, %b
     14 }
     15 
     16 define i8 @urem_i8(i8 %a, i8 %b) nounwind {
     17   %conv = zext i8 %a to i32       
     18   %conv2 = zext i8 %b to i32      
     19   %div = urem i32 %conv, %conv2   
     20   %conv3 = trunc i32 %div to i8   
     21   ret i8 %conv3
     22 ; CHECK-LABEL: @urem_i8(
     23 ; CHECK: urem i8 %a, %b
     24 }
     25 
     26 define i32 @udiv_i32(i8 %a, i8 %b) nounwind {
     27   %conv = zext i8 %a to i32
     28   %conv2 = zext i8 %b to i32
     29   %div = udiv i32 %conv, %conv2
     30   ret i32 %div
     31 ; CHECK-LABEL: @udiv_i32(
     32 ; CHECK: udiv i8 %a, %b
     33 ; CHECK: zext
     34 }
     35 
     36 define i32 @urem_i32(i8 %a, i8 %b) nounwind {
     37   %conv = zext i8 %a to i32
     38   %conv2 = zext i8 %b to i32
     39   %div = urem i32 %conv, %conv2
     40   ret i32 %div
     41 ; CHECK-LABEL: @urem_i32(
     42 ; CHECK: urem i8 %a, %b
     43 ; CHECK: zext
     44 }
     45 
     46 define i32 @udiv_i32_c(i8 %a) nounwind {
     47   %conv = zext i8 %a to i32
     48   %div = udiv i32 %conv, 10
     49   ret i32 %div
     50 ; CHECK-LABEL: @udiv_i32_c(
     51 ; CHECK: udiv i8 %a, 10
     52 ; CHECK: zext
     53 }
     54 
     55 define i32 @urem_i32_c(i8 %a) nounwind {
     56   %conv = zext i8 %a to i32
     57   %div = urem i32 %conv, 10
     58   ret i32 %div
     59 ; CHECK-LABEL: @urem_i32_c(
     60 ; CHECK: urem i8 %a, 10
     61 ; CHECK: zext
     62 }
     63